Analytic Question with lag and lead

Hello,
I'm working on tracking a package and the number of times it was recorded in an office. I want to see the start and end dates along with number of occurrences (or records) during the start/end dates. I'm pretty confident I can get the start end date correct but it is the number of occurences that is the issue.
Essentially, I want to build a time line start and end_dates and the number of times the package was recorded in the office.
I am fumbling around with using the lag and lead analytic to build start/end dates along with the count of occurrences during that period.
I've been using analytics lag and lead feature and can pretty much get the start and end dates setup but having difficulty determining count ---count(*) within the analytic. (I think I can do it outside of the analytic with a self join but performance will suffer). I have millions of records in this table.
I've been playing with the windowing using RANGE and INTERVAL days but to no avail. When I try this and count(*) (over partition by package_ID, location_office_id order by event_date range ......) I can calculate the interval correctly by subtracting the lead date - current date, however,
the count is off because when I partition the values by package_id, location_office_id I get the third group of package 12 partitioned with the first group of package 12 (or in same window) because they are at the same office. However, I want to treat these separately because the package has gone to a different office in be-tween.
I've attached the DDL/DML to create my test case. Any help would be appreciated.
--Current
package_id, location_office_ID. event_date
12 1 20010101
12 1 20010102
12 1 20010103
13 5 20010102
13 5 20010104
13 5 20010105
13 6 20010106
13 6 20010111
12 2 20010108
12 2 20010110
12 1 20010111
12 1 20010112
12 1 20010113
12 1 20010114
--Needs to look like
package_id location_office_id start_date end_date count
12     1      20010101 20010103 3
12 2      20010108 20010110 2
12 1      20010111 20010114 4
13 5 20010102 20010105 3
13 6 20010106 20010111 2
create table test (package_id number, location_office_id number,event_date date);
insert into test values (12,1,to_date('20010101','YYYYMMDD'));
insert into test values (12,1,to_date('20010102','YYYYMMDD'));
insert into test values (12,1,to_date('20010103','YYYYMMDD'));
insert into test values (13,5,to_date('20010102','YYYYMMDD'));
insert into test values (13,5,to_date('20010104','YYYYMMDD'));
insert into test values (13,5,to_date('20010105','YYYYMMDD'));
insert into test values (13,6,to_date('20010106','YYYYMMDD'));
insert into test values (13,6,to_date('20010111','YYYYMMDD'));
insert into test values (12,2,to_date('20010108','YYYYMMDD'));
insert into test values (12,2,to_date('20010110','YYYYMMDD'));
insert into test values (12,1,to_date('20010111','YYYYMMDD'));
insert into test values (12,1,to_date('20010112','YYYYMMDD'));
insert into test values (12,1,to_date('20010113','YYYYMMDD'));
insert into test values (12,1,to_date('20010114','YYYYMMDD'));
commit;
--I'm trying something like
select package_id, location_office_id, event_date,
lead(event_date) over (partition by package_id, location_office_id order by event_date) lead_event,
count(*) over (partition by package_id, location_office_id order by event_date) rcount -- When I do this it merges the window together for package 12 and location 1 so I get the total, However, I want to keep them separate because the package moved to another office in between).
Appreciate your help,

Hi,
Thanks for posting the CREATE TABLE and INSERT statements; that's very helpful!
You can do what you want with LEAD and/or LAG, but here's a more elegant way, using the analytic ROW_NUMBER function:
WITH     got_grp_num     AS
     SELECT     package_id, location_office_id, event_date
     ,     ROW_NUMBER () OVER ( PARTITION BY  package_id
                         ORDER BY        event_date
           -     ROW_NUMBER () OVER ( PARTITION BY  package_id
                         ,             location_office_id
                         ORDER BY        event_date
                       )     AS grp_num
     FROM     test
--     WHERE     ...     -- If you need any filtering, put it here
SELECT       package_id
,       location_office_id
,       MIN (event_date)     AS start_date
,       MAX (event_date)     AS end_date
,       COUNT (*)          AS cnt
FROM       got_grp_num
GROUP BY  package_id
,       location_office_id
,       grp_num
ORDER BY  package_id
,       start_date
;This approach treats the problem as a GROUP BY problem. Getting the start_date, end_date and cnt are all trivial using aggregate functions. The tricky part is what to GROUP BY. We can't just GROUP BY package_id and location_office_id, because, when a package (like package_id=1) leaves an office, goes to another office, then comes back, the two periods spent in the same office have to be treated as separate groups. We need something else to GROUP BY. The query above uses the Fixed Difference method to provide that something else. To see how this works, let's run the sub-query (slightly modified) by itself:
WITH     got_grp_num     AS
     SELECT     package_id, location_office_id, event_date
     ,     ROW_NUMBER () OVER ( PARTITION BY  package_id
                         ORDER BY        event_date
                       )     AS p_num
     ,          ROW_NUMBER () OVER ( PARTITION BY  package_id
                         ,             location_office_id
                         ORDER BY        event_date
                       )     AS p_l_num
     FROM     test
SELECT       g.*
,       p_num - p_l_num     AS grp_num
FROM       got_grp_num     g
ORDER BY  package_id
,       event_date
;Output:
`       LOCATION
PACKAGE  _OFFICE
    _ID      _ID EVENT_DATE P_NUM P_L_NUM GRP_NUM
     12        1 2001-01-01     1       1       0
     12        1 2001-01-02     2       2       0
     12        1 2001-01-03     3       3       0
     12        2 2001-01-08     4       1       3
     12        2 2001-01-10     5       2       3
     12        1 2001-01-11     6       4       2
     12        1 2001-01-12     7       5       2
     12        1 2001-01-13     8       6       2
     12        1 2001-01-14     9       7       2
     13        5 2001-01-02     1       1       0
     13        5 2001-01-04     2       2       0
     13        5 2001-01-05     3       3       0
     13        6 2001-01-06     4       1       3
     13        6 2001-01-11     5       2       3As you can see, p_num numbers the rows for each package with consecutive integers. P_l_num likewise numbers the rows with consecutive integers, but instead of having a separate series of numbers for each package, it has a separate series for each package and location . As long as a package remains at the same location, both numbers increase by 1, and therefore the difference between those two numbers stays fixed. (This assumes that the combination (package_id, event_date is unique.) But whenever a pacakge changes from one location to another, and then comes back, p_num will have increased, but p_l_num will resume where it left off, and so the difference will not be the same as it was previously. The amount of the difference doesn't mean anything by itself; it's just a number (more or less arbitrary) that, together wth package_id and location_office_id, uniquely identifies the groups.
Edited by: Frank Kulash on Oct 26, 2011 8:49 PM
Added explanation.

Similar Messages

  • 2 Questions with Spry and Dreamweaver and IE

    I am using a horizontal spry menu and it works fine in firefox, i have a transparent background on the main nav.  But in IE the main part of the nav is the color of the submenus... I want the submenus to have this color.  Website is hopechurchla.com
    Also.. I am usiing a Spry slideshow... it slides fiine in Firefox, but it does not "slide" in ie...
    Thanks for your help... with this, and all you have answered before...
    avery

    Hi avery,
    'cause there was no-one who answered to your question till now, you could bring your thread into the Spry-forum:
    http://forums.adobe.com/community/labs/spry?view=discussions.
    There you will find the experts for all your questions about Spry applications.
    Good luck!
    Hans-Günter
    P.S.
    You better split your questions.

  • Display Questions with Retina and VMware Fusion (Windows 7/8)

    Looking to buy my first MacBook Pro and looking to make sure I get the specs I need and have a couple of questions.
    I would like to be able to run (simultaenously)
    During the day for work:
    Windows 7 x64 - 30GB HD - 1 Core - 1GB Ram - Purpose: Has a VPN client that allows me to VPN and RDP only
    Windows 8.1 x64 - 60GB HD - 2 Cores - 4GB+ Ram - Purpose: Office 2013 installed on this VM and all my other work applicatons (light weight)
    OSX 10.10 - Whatever it can take - Light Web Browsing etc while at work.
    After work:
    Guess it doesn't matter really - i'd like to play games (bootcamp fine) if possible too. Nothing crazy so barely worth mentioning.
    My main questions:
    Display: Iris Pro or nVidia - Can the base 15 inch GPU/CPU handle the two VMs at the same time plus the host OS (OSX) without hiccups?
    Display: How does VMware Fusion recognize the discrete GPU - will the system be smooth/quiet without activating it?
    Battery life: Virtualization is pretty heavy battery wise. Does anyone know what happens to the battery when you're running a couple VMs?
    Display: How is running Windows 7/8 on a MacBook with a specifically retina display? Do the Windows PCs look really ugly/blurry due to such a high resolution?
    What is the minimum hardware required for these VMs to run fast and responsive? (CPU/GPU/RAM only)
    Thanks!!

    Sorry - we're users here, just like you, and some questions just get lost sometimes.
    The fastest hardware you can buy, the easier you'll be able to run Windows. If you use Boot Camp to run Windows (7, 8 or 8.1) the machine will run at it's best. If you want to run Windows alongside the Mac OS, you'll need to use a VM application (I use Parallels - I've tried VMwareFusion but like Parallels better and it just works best for me).
    So, to your questions:
    The Retina machine with the NVIDIA GPU will be the fastest - it's a faster processor and has more VRAM.
    Any VM is going to use resources - how much RAM, for example, is up to you. I have 16 GB of RAM and 8GB dedicated to Parallels/Windows 7 Pro.
    I wouldn't (and you really can't) run a VM for very long on battery. If you're using VM's, that's the time to plug into mains. Running a 'couple' of VM would put further heavy use on your GPU, CPU and shorten your battery life.
    I would make sure to get a good, fast quad-core i7 processor, the 2GB of VRAM NVIDIA GPU and the maximum amount of RAM (16GB).
    Good luck,
    Clinton

  • IVI questions with DMM and SWitch

    I am trying to simulate an NI-4060 DMM and numerous SCXI-1129 cards using the IVI drivers in CVI.
    Of preference I want to setup the simulation in MAX rather than programmatically in my application. I have numerous questions:
    Is there a document that shows you how to setup MAX to simulate an IVI instrument??? Everything that I have read so far talks about the architecture, how wonderful IVI is what you can do etc, but NOT EXACTLY HOW you set-up MAX - one document briefly touched on this but with no detail whatsoever. There seems to be a lot of assumed knowledge in all the docs.
    If I try and configure in MAX I can get the DMM working, but the exact same steps give an error for the switch cards in my application. An
    y ideas?
    How do I use Soft-panels from my application?
    If I am programmatically using an InitWithOptions which seems to be the only way to get the Switch cards to simulate what is the expected syntax or options for the "DriverSetup" string????
    I am using NI-DAQ 6.9.0f7 and IVI 1.61 with CVI 5.5 on NT 4.0

    Ricardo,
    There is a document on our web site on how to configure your IVI system in MAX and also how to simulate your hardware in LV and CVI using IVI drivers:
    ni.com>>Resource Library>>Instrument Connectivity>>Instrument Driver IVI
    or
    http://zone.ni.com/devzone/devzone.nsf/webcategori​es/5FB594A1C20D93E3862569FD0071D18A?opendocument
    This should point you in the right direction. I will continue to gather information and post what I find!
    Best Regards,
    Chris D
    Applications Engineer
    National Instruments

  • C2504 with LAG and VLAN tagging

    Having issues with setting up LAG on a Cisco 2504 WLC and implementing VLAN tagging on the different SSID´s.
    Without LAG I had this up and running by using dynamic interfaces and assigning the different SSID´s to a perticular interface which was then assigned a specific VLAN.
    However once I enabled LAG on the 2504, the dynamic interfaces became disabled and im unable to find documentation on how to configure VLAN tagging on SSID´s when using LAG.
    Relevant info:
    Cisco 2504 WLC running 7.4.100.0 (FUS 1.8.0)
    Cisco 2602 APs
    Cisco 3560 switch running IOS 15 (c3560-ipbasek9-mz.150-2.SE3)
    Switch output:
    C3560-PoE8#show etherchannel 1 summary
    Flags:  D - down        P - bundled in port-channel
            I - stand-alone s - suspended
            H - Hot-standby (LACP only)
            R - Layer3      S - Layer2
            U - in use      f - failed to allocate aggregator
            M - not in use, minimum links not met
            u - unsuitable for bundling
            w - waiting to be aggregated
            d - default port
    Number of channel-groups in use: 1
    Number of aggregators:           1
    Group  Port-channel  Protocol    Ports
    ------+-------------+-----------+-----------------------------------------------
    1      Po1(SU)          -        Fa0/1(P)    Fa0/2(P)    Fa0/3(P)
                                     Fa0/4(P)
    WLC output:
    (Cisco Controller) >show lag summary
    LAG Enabled
    So basically what im trying to achieve is to implement LAG, use 2 SSID´s which are tagged in VLAN 300 and 400 respectively and keep management traffic untagged.

    Hi Scott,
    Yes I did.. But it seems that after deselecting the "Interface/Interface Group(G)" under the SSID´s and then selecting the dynamic interface again that the problem is resolved.

  • OC question with E6700 and Cellshock 6400 mem ?

    Hi guys.
    Been away 25 days on work (Bali) 
    Now i´m back to questions here to get better in all this stuff.
    Question now is.
    I´v been running my P965 Platinum bios 1.4, E6700 and Cellshock DDR2-800 PC2-6400 like this for some times:
    E6700 OC to 305FSB, mem set to 800 and in timming 5-5-5-12 2T. The system was running fine i think.
    Now today i just tryed some new testing, and tryed this now. My question is now. Is these new settings better than my old ones ?
    New settings:
    E6700 OC to 340FSB with 0.375 more CPU v and the rest on auto. Then the mem is configured to 5-5-5-18 2T
    So from E6700 305FSB = 2987Mhz Manuel setting on mem to 5-5-5-12 2T to now E6700 340FSB = 3398Mhz Auto setting on mem 5-5-5-18 2T
    What would be my best settings ? because the board cant set my ram correct 4-4-4-12 i was using the 5-5-5-12
    Thx..

    Just tryed a little more.
    Now i left it at 340FSB = 3.4Ghz and i then first tryed 5-5-5-12 was also running fine. Now i chanced it to 4-4-4-12 and ofcause the
    bios chanced it to 3-4-4-12
    Now my next question. Would 3-4-4-12 be better than 5-5-5-12
    I still cant figure out all this x-x-x-x stuff..  lol
    So i just try different settings. But i guess the speed gains are to small to notice just by normal running 
    But i would still love to hear from someone who can set me in the right direction.
    Witch of all the settings i used since yesterday is best for my system. Thx guys

  • Many problems and questions with CC and PS CC 2014. HELP!!!

    I'm having way too many problems with this whole Creative Cloud system, and PS CC 2014 in particular.
    The courtesy of a response from a qualified Adobe staff member would be greatly appreciated by this long-time loyal patron of Adobe products.
    1. When and why was my membership downgraded from Single App to Photographer?
         I signed up to Single App CC almost a year ago, and am able to access Typekit, 20GB of cloud storage and all the other features of Individual App membership, but not Market Assets. When I attempt to download any CC Market Assets I get a message stating "Market Assets are a premium feature" and "is only available to paid Creative Cloud members".
          I must still be subscribed to Single App because the subscription payment receipt I received a few weeks ago states: "We received payment for your Creative Cloud single-app membership for Photoshop (one-year) subscription, and your membership will renew on 30-July-2014 (PT)".
         The CC website states that Market Assets are not included in the Individual "Photography" subscription level (which seems to be a relatively new category), but I am clearly paying for Single App membership as indicated on my receipt. However, when I check my account, I'm listed as a Photographer subscriber.
         What gives?
    2. Lightroom 5 is no longer listed as "Installed" in CC Apps window.
         I installed Lightroom 5 at Adobe's invitation last fall. Every time there is a CC update, the CC App widow shows that Lightroom 5 is not installed. So, I reinstall it, and the App list behaves properly until the next "update", which de-installs the app again.
         How do I keep Lightroom 5 installed?
    3. My Extensions are not accessible in PS CC 2014
         I migrated my presets from PS CC to PS CC 2014, but the Extensions are still greyed out (Windows>Extensions). I updated Extension Manager and synced the desktop CC app, which downloaded some plug-ins to CC 2014, but not the Adobe Watermark extension (v2.2.3). Also, because Window>Extension is greyed out, I can't access AdobeExchange via CC 2014 to download any possible updates.
         Why can't I access my extensions in PS CC 2004?
    4. CC Files wont stop syncing
         I thought I'd try uploading something to Creative Cloud to see what this storage feature could offer me. CC has been attempting to sync my files for aver a day now, chewing up bandwidth and seriously slowing down my internet connection to other content-dense sites. How do I stop the syncing process? I can pause it, but not stop it. I only have one file (a jpg image) in my Creative Cloud Files, which has a green check mark, so I don't understand what is being synced and why. I toogle syncing off and on again, but all I get is the spinning wheel. I've now turned off syncing, so this feature is now of no use to me.
         What am I doing wrong?
    5. How do I make the previous version of PS CC the default PS app in Mac OS 10.8.5
         How do I deactivate PS CC 2014 as the default PS app?
         My workflow regularly includes the Oil Paint filter and Adobe Watermark extension to produce the images I am currently marketing. Therefore, I prefer to use PS CC v14.2.1, and not PS CC 2004, as my default PS app. Mac OS10.8.5 want to open all my RAW and PSD files in PS CC 2014. I change the "Open With" preference in the "Get Info" window to PS CC 14.2.1, but it immediately reverts to PS CC 2014.
    I have several other issues with the latest CC platform, but lets see if I can get these ones solved before moving forward.
    This whole Creative Cloud process is becoming very frustrating and overly time consuming, and seems to be much more complex than most users need or want (based on the comments and problems I read in this forum).  I like the ongoing bug-fixes and camera/lens support updates, but the whole multi-app, internet-dependent format has gotten out of control, producing more problems than solutions, at least for me. This 2014 update makes it impossible to follow the workflow I've developed over the past several years. PixelBender is complex and non-intuitive, and does not effectively replace the Oil Paint filter. My extensions don't work. And now, the CC app won't let me access all the features I think I'm paying for. It seem to me these recent "upgrades" are half-baked. I've now spent countless hours trying to fix the problems imposed by CC 2014.
    These "Community Discussions" sometimes take days to produce any sort of assistance, helpful or otherwise, and Adobe does not have the decency to offer direct access to customer service personnel to solve these problems.

    I too, have many of the same problems: constantly reminded to "Install" the apps I have already done so (and paid for); Market Assets asks for me to become a paid member (I am); Adobe Bridge is missing from the apps page. I have reinstalled CC several times. Frustrating is the kindest word I can say--I seem to spend more time reading the "help" and discussion boards rather than working on photos. Dear Adobe, wake up and give us some solutions here! I too, have been using Adobe PS for years and UGH! CC is a mess and truly a bad experience for me! I apologize to the user above (RGMeyer) I could not be helpful, rather I am only adding fuel to your frustration.

  • A few questions with XML and Flash

    Hi there.
    I am currently trying to create a 3d carousel using AS2 and XML.  I've made a lot of progress, but there ar e few things I am still struggling with and was hopoing that someone here could please steer me in the right direction.
    Here is a URL where the Carousel can be found:
    http://iongeo.com/ru_innovation_test_dev/carousel_test.html
    Here are a few of the things I am wondering:
    1.  I would like to be ablle to add a back button movide clip, similar to how the tooltip movie clip is presented now; this movie clip would be able to allow users to go back home to the caousel.  I can't seem to get it to load correctly however, I would imagine that it would be set up similarly to how the tooltip icon is set up now, but to be able to have an alpha of 100 when the text is loaded in.
    2.  I was also wondering how I mihgt be able to add links to my .xml document to be able to call in URLs on the web.  I've tried several things using the CDATA approach, but can't seem to get it to work.
    I would greatly appreciate any assistance privded and am very greatful for any consideration thac ould be provided.  Please let me know if there is anything htat I should clarify on.
    Below is my code for AS2 and XML so that you might see how things are currently working.
    import mx.utils.Delegate;
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    var numOfItems:Number;
    var radiusX:Number = 200;
    var radiusY:Number = 75;
    var centerX:Number = 300;
    var centerY:Number = 150;
    var speed:Number = 0.00;
    var perspective:Number = 20;
    var home:MovieClip = this;
    theText._alpha = 0;
    theHeader._alpha = 0;
    var tooltip:MovieClip = this.attachMovie("tooltip","tooltip",8000);
    tooltip._alpha = 0;
    var xml:XML = new XML();
    xml.ignoreWhite = true;
    xml.onLoad = function()
        var nodes = this.firstChild.childNodes;
        numOfItems = nodes.length;
        for(var i=0;i<numOfItems;i++)
            var t = home.attachMovie("item","item"+i,i+1);
            t.angle = i * ((Math.PI*2)/numOfItems);
            t.onEnterFrame = mover;
            t.toolText = nodes[i].attributes.tooltip;
            t.content = nodes[i].attributes.content;
            t.header = nodes[i].attributes.header;
            t.icon.inner.loadMovie(nodes[i].attributes.image);
            t.r.inner.loadMovie(nodes[i].attributes.image);
            t.icon.onRollOver = over;
            t.icon.onRollOut = out;
            t.icon.onRelease = released;
    function over()
        //BONUS Section
        home.tooltip.tipText.text = this._parent.toolText;
        home.tooltip._x = this._parent._x;
        home.tooltip._y = this._parent._y - this._parent._height/2;
        home.tooltip.onEnterFrame = Delegate.create(this,moveTip);
        home.tooltip._alpha = 100;
    function out()
        delete home.tooltip.onEnterFrame;
        home.tooltip._alpha = 0;
    function released()
        //BONUS Section
        home.tooltip._alpha = 100;
        for(var i=0;i<numOfItems;i++)
            var t:MovieClip = home["item"+i];
            t.xPos = t._x;
            t.yPos = t._y;
            t.theScale = t._xscale;
            delete t.icon.onRollOver;
            delete t.icon.onRollOut;
            delete t.icon.onRelease;
            delete t.onEnterFrame;
            if(t != this._parent)
                var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,t._xscale,0,1,true);
                var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,t._yscale,0,1,true);
                var tw3:Tween = new Tween(t,"_alpha",Strong.easeOut,100,0,1,true);
            else
                var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,t._xscale,100,1,true);
                var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,t._yscale,100,1,true);
                var tw3:Tween = new Tween(t,"_x",Strong.easeOut,t._x,100,1,true);
                var tw4:Tween = new Tween(t,"_y",Strong.easeOut,t._y,200,1,true);
                var tw5:Tween = new Tween(theText,"_alpha",Strong.easeOut,0,100,1,true);
                theText.text = t.content;
                var s:Object = this;
                tw.onMotionStopped = function()
                    s.onRelease = unReleased;
    function unReleased()
        var sou:Sound = new Sound();
        sou.attachSound("sdown");
        sou.start();
        delete this.onRelease;
        var tw:Tween = new Tween(theText,"_alpha",Strong.easeOut,100,0,0.5,true);
        for(var i=0;i<numOfItems;i++)
            var t:MovieClip = home["item"+i];
            if(t != this._parent)
                var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,0,t.theScale,1,true);
                var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,0,t.theScale,1,true);
                var tw3:Tween = new Tween(t,"_alpha",Strong.easeOut,0,100,1,true);
            else
                var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,100,t.theScale,1,true);
                var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,100,t.theScale,1,true);
                var tw3:Tween = new Tween(t,"_x",Strong.easeOut,t._x,t.xPos,1,true);
                var tw4:Tween = new Tween(t,"_y",Strong.easeOut,t._y,t.yPos,1,true);
                tw.onMotionStopped = function()
                    for(var i=0;i<numOfItems;i++)
                        var t:MovieClip = home["item"+i];
                        t.icon.onRollOver = Delegate.create(t.icon,over);
                        t.icon.onRollOut = Delegate.create(t.icon,out);
                        t.icon.onRelease = Delegate.create(t.icon,released);
                        t.onEnterFrame = mover;
    function moveTip()
        home.tooltip._x = this._parent._x;
        home.tooltip._y = this._parent._y - this._parent._height/2;
    xml.load("icons.xml");
    function mover()
        this._x = Math.cos(this.angle) * radiusX + centerX;
        this._y = Math.sin(this.angle) * radiusY + centerY;
        var s = (this._y - perspective) /(centerY+radiusY-perspective);
        this._xscale = this._yscale = s*100;
        this.angle += this._parent.speed;
        this.swapDepths(Math.round(this._xscale) + 100);
    this.onMouseMove = function()
        speed = (this._xmouse-centerX)/8000;
    // inactive mouse time (in seconds) to start slowing the carousel
    var inactiveMouseTime:Number =1;
    // rate of slowing carousel;
    var speedDamp:Number = .4;
    var speedI:Number;
    var startSlowTO:Number;
    this.onMouseMove = function(){
    clearInterval(speedI);
    clearTimeout(startSlowTO);
    startSlowTO = setTimeout(startSlowF,inactiveMouseTime);
        speed = (this._xmouse-centerX)/8000;
    function startSlowF(){
    clearInterval(speedI);
    speedI=setInterval(speedF,2000);
    function speedF(){
    speed = speedDamp*speed;
    if(speed<.1){
    clearInterval(speedI);
    speed=0;
    Here is an example of how things are loaded from XML:
    <icons>
    <icon image="Denver_test_icon.png" tooltip="Denver Icon Test" header="test header" content="Test Paragraph. Greeked:. Suspendisse condimentum sagittis luctus." />
    </icons>

    Hi there.
    I am currently trying to create a 3d carousel using AS2 and XML.  I've made a lot of progress, but there ar e few things I am still struggling with and was hopoing that someone here could please steer me in the right direction.
    Here is a URL where the Carousel can be found:
    http://iongeo.com/ru_innovation_test_dev/carousel_test.html
    Here are a few of the things I am wondering:
    1.  I would like to be ablle to add a back button movide clip, similar to how the tooltip movie clip is presented now; this movie clip would be able to allow users to go back home to the caousel.  I can't seem to get it to load correctly however, I would imagine that it would be set up similarly to how the tooltip icon is set up now, but to be able to have an alpha of 100 when the text is loaded in.
    2.  I was also wondering how I mihgt be able to add links to my .xml document to be able to call in URLs on the web.  I've tried several things using the CDATA approach, but can't seem to get it to work.
    I would greatly appreciate any assistance privded and am very greatful for any consideration thac ould be provided.  Please let me know if there is anything htat I should clarify on.
    Below is my code for AS2 and XML so that you might see how things are currently working.
    import mx.utils.Delegate;
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    var numOfItems:Number;
    var radiusX:Number = 200;
    var radiusY:Number = 75;
    var centerX:Number = 300;
    var centerY:Number = 150;
    var speed:Number = 0.00;
    var perspective:Number = 20;
    var home:MovieClip = this;
    theText._alpha = 0;
    theHeader._alpha = 0;
    var tooltip:MovieClip = this.attachMovie("tooltip","tooltip",8000);
    tooltip._alpha = 0;
    var xml:XML = new XML();
    xml.ignoreWhite = true;
    xml.onLoad = function()
        var nodes = this.firstChild.childNodes;
        numOfItems = nodes.length;
        for(var i=0;i<numOfItems;i++)
            var t = home.attachMovie("item","item"+i,i+1);
            t.angle = i * ((Math.PI*2)/numOfItems);
            t.onEnterFrame = mover;
            t.toolText = nodes[i].attributes.tooltip;
            t.content = nodes[i].attributes.content;
            t.header = nodes[i].attributes.header;
            t.icon.inner.loadMovie(nodes[i].attributes.image);
            t.r.inner.loadMovie(nodes[i].attributes.image);
            t.icon.onRollOver = over;
            t.icon.onRollOut = out;
            t.icon.onRelease = released;
    function over()
        //BONUS Section
        home.tooltip.tipText.text = this._parent.toolText;
        home.tooltip._x = this._parent._x;
        home.tooltip._y = this._parent._y - this._parent._height/2;
        home.tooltip.onEnterFrame = Delegate.create(this,moveTip);
        home.tooltip._alpha = 100;
    function out()
        delete home.tooltip.onEnterFrame;
        home.tooltip._alpha = 0;
    function released()
        //BONUS Section
        home.tooltip._alpha = 100;
        for(var i=0;i<numOfItems;i++)
            var t:MovieClip = home["item"+i];
            t.xPos = t._x;
            t.yPos = t._y;
            t.theScale = t._xscale;
            delete t.icon.onRollOver;
            delete t.icon.onRollOut;
            delete t.icon.onRelease;
            delete t.onEnterFrame;
            if(t != this._parent)
                var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,t._xscale,0,1,true);
                var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,t._yscale,0,1,true);
                var tw3:Tween = new Tween(t,"_alpha",Strong.easeOut,100,0,1,true);
            else
                var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,t._xscale,100,1,true);
                var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,t._yscale,100,1,true);
                var tw3:Tween = new Tween(t,"_x",Strong.easeOut,t._x,100,1,true);
                var tw4:Tween = new Tween(t,"_y",Strong.easeOut,t._y,200,1,true);
                var tw5:Tween = new Tween(theText,"_alpha",Strong.easeOut,0,100,1,true);
                theText.text = t.content;
                var s:Object = this;
                tw.onMotionStopped = function()
                    s.onRelease = unReleased;
    function unReleased()
        var sou:Sound = new Sound();
        sou.attachSound("sdown");
        sou.start();
        delete this.onRelease;
        var tw:Tween = new Tween(theText,"_alpha",Strong.easeOut,100,0,0.5,true);
        for(var i=0;i<numOfItems;i++)
            var t:MovieClip = home["item"+i];
            if(t != this._parent)
                var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,0,t.theScale,1,true);
                var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,0,t.theScale,1,true);
                var tw3:Tween = new Tween(t,"_alpha",Strong.easeOut,0,100,1,true);
            else
                var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,100,t.theScale,1,true);
                var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,100,t.theScale,1,true);
                var tw3:Tween = new Tween(t,"_x",Strong.easeOut,t._x,t.xPos,1,true);
                var tw4:Tween = new Tween(t,"_y",Strong.easeOut,t._y,t.yPos,1,true);
                tw.onMotionStopped = function()
                    for(var i=0;i<numOfItems;i++)
                        var t:MovieClip = home["item"+i];
                        t.icon.onRollOver = Delegate.create(t.icon,over);
                        t.icon.onRollOut = Delegate.create(t.icon,out);
                        t.icon.onRelease = Delegate.create(t.icon,released);
                        t.onEnterFrame = mover;
    function moveTip()
        home.tooltip._x = this._parent._x;
        home.tooltip._y = this._parent._y - this._parent._height/2;
    xml.load("icons.xml");
    function mover()
        this._x = Math.cos(this.angle) * radiusX + centerX;
        this._y = Math.sin(this.angle) * radiusY + centerY;
        var s = (this._y - perspective) /(centerY+radiusY-perspective);
        this._xscale = this._yscale = s*100;
        this.angle += this._parent.speed;
        this.swapDepths(Math.round(this._xscale) + 100);
    this.onMouseMove = function()
        speed = (this._xmouse-centerX)/8000;
    // inactive mouse time (in seconds) to start slowing the carousel
    var inactiveMouseTime:Number =1;
    // rate of slowing carousel;
    var speedDamp:Number = .4;
    var speedI:Number;
    var startSlowTO:Number;
    this.onMouseMove = function(){
    clearInterval(speedI);
    clearTimeout(startSlowTO);
    startSlowTO = setTimeout(startSlowF,inactiveMouseTime);
        speed = (this._xmouse-centerX)/8000;
    function startSlowF(){
    clearInterval(speedI);
    speedI=setInterval(speedF,2000);
    function speedF(){
    speed = speedDamp*speed;
    if(speed<.1){
    clearInterval(speedI);
    speed=0;
    Here is an example of how things are loaded from XML:
    <icons>
    <icon image="Denver_test_icon.png" tooltip="Denver Icon Test" header="test header" content="Test Paragraph. Greeked:. Suspendisse condimentum sagittis luctus." />
    </icons>

  • Importing files with sequence and leading 0's

    I can not figure out how to import files and rename them so they have leading zeros. I can do this in Adobe bridge
    image.001, image.011 instead of image.1 image.11
    I do a lot of slide shows in Premiere pro and in order to sort the files within the BIN, i need leading zeros.
    Thanks

    When you do a rename, there's a drop down box for how you want to rename your files. At the bottom of that box is the word "edit". Use that.

  • Macbook wireless network question with vista and xp PLEASE HELP

    Ok I just bought a macbook computer and introduced it to a windows family using vista and xp computers. I was able to set up wireless networking and surf the internet with all computers. However I cannot see the windows computers from the mac but can see the mac on the windows computers. I have a linksys wrt54g router. I tried everything and Im unable to see other computers or the printer thats attached to the desktop pc using vista. I went ahead and purchased the extreme airport router and after being on the phone with apple care for 3 hours and reformatting the operating system on the mac I was finally able to see the other pc's and installed bonjour for windows on all windows based pc's and was able to print from the mac without a glitch but the windows based pc's were horribly very very slow printing using bonjour. Needless to say I didnt want to spend all the extra money on a apple router for all this to work and after doing so the printing from windows machines just plain *****. So I returned the airport extreme and Im back to the linksys. When the linksys wrt54g is hooked up I cannot see the printer or other windows machines. Any ideas please to keep my current setup so I dont have to go out and by more apple products for everything to play nice. Thanks

    What is the exact model number of your Linksys router for this Linksys forum??

  • Query question with MULTI_COLUMN_DATASTORE and BASIC_SECTION_GROUP

    Dear experts!
    Do I always need the WITHIN operator when using BASIC_SECTION_GROUP?
    I have created the following test case:
    connect ctxsys/ctxsys
    begin
    ctx_ddl.create_preference('otext_multi', 'MULTI_COLUMN_DATASTORE');
    ctx_ddl.set_attribute('otext_multi', 'columns', 'c2, c3');
    end;
    begin
    ctx_ddl.create_section_group('otext_section', 'BASIC_SECTION_GROUP');
    ctx_ddl.add_field_section('otext_section','c2','c2');
    ctx_ddl.add_field_section('otext_section','c3','c3');
    end;
    connect testuser/testuser
    create table otext (
    c1 number primary key,
    c2 varchar2(15),
    c3 clob,
    textidx char
    insert into otext values (1, 'First line', 'This is an Oracle Text Index test', null);
    insert into otext values (2, 'Second line', 'My Oracle database version is 10.2.0.1', null);
    insert into otext values (3, 'Third line', 'I hope you will help me', null);
    commit;
    create index idx_otext on otext(textidx) indextype is ctxsys.context parameters
    ('datastore ctxsys.otext_multi section group ctxsys.otext_section');
    select c3 from otext where contains (textidx, 'Oracle within c3') > 0;
    C3
    This is an Oracle Text Index test
    My Oracle database version is 10.2.0.1
    select c3 from otext where contains (textidx, 'Oracle') > 0;
    no rows returned
    So what do you think? Shouldn't the last select also return 2 rows?
    I mean a workaround would be like the following:
    select c3 from otext where contains (textidx, 'Oracle within c2 OR Oracle within c3') > 0;
    But I would expect if I have no sections in my contains clause Oracle will search in all available sections...
    Thanks
    Markus

    There is a fourth boolean "visible" parameter to ctx_ddl.add_field_section. The default is FALSE. Specify TRUE to make the text visible without using a "within" clause.
    Also, I noticed that you created your multi_column_datastore in the ctxsys schema. In 9i that was required, but as of 10g it can be created in another schema.
    Please see the demonstration below.
    SCOTT@10gXE> begin
    2 ctx_ddl.create_preference ('otext_multi', 'MULTI_COLUMN_DATASTORE');
    3 ctx_ddl.set_attribute ('otext_multi', 'columns', 'c2, c3');
    4 ctx_ddl.create_section_group ('otext_section', 'BASIC_SECTION_GROUP');
    5 ctx_ddl.add_field_section ('otext_section', 'c2', 'c2', TRUE);
    6 ctx_ddl.add_field_section ('otext_section', 'c3', 'c3', TRUE);
    7 end;
    8 /
    PL/SQL procedure successfully completed.
    SCOTT@10gXE> create table otext (
    2 c1 number primary key,
    3 c2 varchar2(15),
    4 c3 clob,
    5 textidx char
    6 )
    7 /
    Table created.
    SCOTT@10gXE> insert all
    2 into otext values (1, 'First line', 'This is an Oracle Text Index test', null)
    3 into otext values (2, 'Second line', 'My Oracle database version is 10.2.0.1', null)
    4 into otext values (3, 'Third line', 'I hope you will help me', null)
    5 select * from dual
    6 /
    3 rows created.
    SCOTT@10gXE> create index idx_otext on otext (textidx) indextype is ctxsys.context parameters
    2 ('datastore otext_multi section group otext_section')
    3 /
    Index created.
    SCOTT@10gXE> select c3 from otext where contains (textidx, 'Oracle within c3') > 0
    2 /
    C3
    This is an Oracle Text Index test
    My Oracle database version is 10.2.0.1
    SCOTT@10gXE> select c3 from otext where contains (textidx, 'Oracle') > 0
    2 /
    C3
    This is an Oracle Text Index test
    My Oracle database version is 10.2.0.1
    SCOTT@10gXE> select c3 from otext where contains (textidx, 'Oracle within c2 OR Oracle within c3') > 0
    2 /
    C3
    This is an Oracle Text Index test
    My Oracle database version is 10.2.0.1
    SCOTT@10gXE>

  • Update will not connect to server, continuous lagging and questionable security?

    I actually have a few questions. I recently switched to Firefox from IE9 for a few reasons. My IT Security professor mentioned Firefox was safer than most and an online article suggested it was faster than IE9. So I decided to give it a chance; the previous version was too slow and wouldn't play any video so I downloaded version 4. It worked great for about 3-4 weeks and now I'm having the following problems:
    1. Every time Firefox says it has to update, the window pops up to connect to server. All it does is continuously try to connect (nothing happens). Now, one time I left it open all day to see if it would and that night a window popped up and said to restart Firefox to complete. I did what it said and it just started trying to connect to the server again.
    2. When I first downloaded Firefox 4 it was fast and almost never lagged. Now, it seems as if every page I try to connect to lags. In fact, sometimes I have to close it down and restart. It's actually normal pages I open everyday like school, mail, weather and typical Yahoo pages. Nothing has changed on my end, so I'm unaware of why this is happening now.
    3. I'm really concerned with the security issues. I still have IE9; recently, because of lagging and security issues, I've tried switching between the two to check cleaning details. I'll run my cleaner after a day of IE9 and do the same for Firefox (same typical searches). With IE9, there's not much to clean, maybe 17-18 mb's at most (cookies, typical stuff) and never had a virus. The CPU monitor also stays calm. On Firefox, I get 160-210 mb's every time. The CPU gauge fluctuates constantly and I've had three viruses.
    I'm not sure if it's because the updates will not take or what, but I've had to switch back to IE9 because of these problems. I really enjoyed Firefox (when it worked); the interface was easy to navigate and use and in the beginning was very fast. I miss it! But because of these issues, I have to take a break until they are fixed. I can't afford to have my computer crash. Please help!

    If there are problems with updating then best is to download the full version and uninstall the currently installed version.
    Download a fresh Firefox copy and save the file to the desktop.
    * Firefox 4.0.x: http://www.mozilla.com/en-US/firefox/all.html
    * Uninstall your current Firefox version.
    * Do not remove personal data when you uninstall the current version.
    Remove the Firefox program folder before installing that newly downloaded copy of the Firefox installer.
    * It is important to delete the Firefox program folder to remove all the files and make sure that there are no problems with files that were leftover after uninstalling.
    Your bookmarks and other profile data are stored elsewhere in the [http://kb.mozillazine.org/Profile_folder_-_Firefox Firefox Profile Folder] and won't be affected by a reinstall, but make sure that you do not select to remove personal data if you uninstall Firefox.
    * http://kb.mozillazine.org/Software_Update (Software Update not working properly)

  • My MacBook Pro gets really hot when I open a video file of any kind and the video starts lagging and the image fades away, also with anything that starts the fan. Is extremely hot on the left upper corner. Is there something I can do about it?

    My MacBook Pro gets really hot when I open a video file of any kind and the video starts lagging and the image fades away, also with anything that starts the fan. Is extremely hot on the left upper corner. Is there something I can do about it?

    You are still under warranty.  Call Apple Care. Make sure you get a case number as all repairs have an additional 90 days of warranty. 
    #1 - You have 14 days from the date of purchase to return your computer with no questions asked.
    #2 - You have 90 days of FREE phone tech support.
    #3 - You have the standard one year Apple warranty.
    #4 - If you've purchased an AppleCare Protection Plan, your warranty last for 3 years.   You can obtain AppleCare anytime up to the first year of the purchase of your computer.
    Take FULL advantage of your warranty.  Posting on a message board should be done as a last resort and if you are out of warranty or Apple Care has expired.

  • Does YouTube always lag with iPhones and iPads?

    Once again I have a noob question. On my Android devices I have no lagging issues but on both my iPad2 and iPhone 4s (using the preloaded app)I can't get YouTube to play for more than a couple of seconds without lagging and freezing. Netflix works great on both apple devices . This does not matter if I am on wifi or 3G and I have checked for an app update. Does this happen to others?

    Yes it does happen to others. It happens to me from time to time. It depends on - among other things - the speed of your Internet connection. I have the original iPad and the new iPad as well. I have no experience with Android devices so I can't comment on that or make any comparison.
    If you wait until the video fully loads, or at least wait until it loads far enough in advance before you start to play it, it should play OK.

  • How can I transfer photos from an IPhone 5 to an IPad 2 using a cable.  I have tried using the lightning to firewire adapter with my current lead but this only seems to allow a download from the Ipad to the Iphone and not the other way around.

    How can I transfer photos from an IPhone 5 to an IPad 2 using a cable.  I have tried using the lightning to firewire adapter with my current lead but this only seems to allow a download from the IPad to the IPhone and not the other way around.

    The devices are not designed for transfer of that kind.  Use Photo Stream as suggested by another poster, or transfer photos to your computer (a good idea anyway since they will be lost if your device needs to be reset), then use iTunes to sync them to the other devices.

Maybe you are looking for

  • Free goods price discount when free goods are not required  by customer

    Hi In a promotional activity for purchase of 10 items 2 free goods (which are different) have been determined, which is exclusive.  The customer wishes not to take the free goods and asks for a discount equivalent to the value of free goods, please a

  • Can I use a Time Machine Backup (on an external drive) as a "start up" drive?  I need to do a disk repair.

    I am upgrading my MacBook Pro (17"; Intel Core Duo; Speed 2.16 GHz; 2 GB 667MHz DDR2 SDRAM) from Leopard (10.5.8) to Snow Leopard (10.6.8).  I successfully Time Machine to make a backup to an external LaCie drive.  Some issues appeared when I ran a "

  • SAPScript:GRN Printing Label

    Hello Experts, I m working on SAPScript .My requirement is i want to add storage bin(MARD-LGPBE) field in SAPScript for GRN Label printing FORM:(rm07etikett).Everything else is coming from mseg, mkpf, ekko table but not from MARD Plz sugget how to pr

  • Error viewing .jspx document in internet explorer

    Hi all , I have a .jspx document that part of a ADF-BC JSF project The document displays ok in firefox but when I try to view it from IE I get the following message The XML page cannot be displayed Cannot view XML input using style sheet. Please corr

  • Maximum Temp tablespace size you've seen

    DB version: 10.2.0.4 Our DB caters a retail application . Total DB Size of 3TB. Its is a bit of mix of both OLTP and Batch processing environment. Our temp tablespace has 1 file and we had set the tempfile as AUTOEXTEND. Somehow its size has reached