问:
Typescript Callstack Size Exceeded
The following code throws a Callstack Size Exceeded Error:</p>

```<code>    declare var createjs:any;

import {Animation} from '../animation';
import {Events} from 'ionic-angular';
import { Inject } from '@angular/core';

export class FischSuccess extends Animation {

    constructor(@Inject(Events) public events: Events) {
        super(events);
        this.initAnimation();
    }

    initAnimation() {

        var lib, images, ss;

        (function (lib, img, cjs, ss, events) {

            var cjs = createjs;

            var p; // shortcut to reference prototypes
            lib.webFontTxtFilters = {};

// library properties:
            lib.properties = {
                width: 1000,
                height: 650,
                fps: 25,
                color: "#FFFFFF",
                opacity: 1.00,
                webfonts: {},
                manifest: [
                    {src:"images/fisch_atlas_success.png", id:"fisch_atlas_"}
                ]
            };

            lib.ssMetadata = [
                {name:"fisch_atlas_", frames: [[158,0,156,110],[0,0,156,110],[316,0,156,110],[0,112,156,110],[158,112,156,110]]}
            ];

            lib.webfontAvailable = function(family) {
                lib.properties.webfonts[family] = true;
                var txtFilters = lib.webFontTxtFilters && lib.webFontTxtFilters[family] || [];
                for(var f = 0; f < txtFilters.length; ++f) {
                    txtFilters[f].updateCache();
                }
            };
// symbols:

            (lib.Fisch1 = function() {
                this.spriteSheet = ss["fisch_atlas_"];
                this.gotoAndStop(0);
            }).prototype = p = new cjs.Sprite();

            (lib.Fisch2 = function() {
                this.spriteSheet = ss["fisch_atlas_"];
                this.gotoAndStop(1);
            }).prototype = p = new cjs.Sprite();

            (lib.Fisch3 = function() {
                this.spriteSheet = ss["fisch_atlas_"];
                this.gotoAndStop(2);
            }).prototype = p = new cjs.Sprite();

            (lib.Fisch7 = function() {
                this.spriteSheet = ss["fisch_atlas_"];
                this.gotoAndStop(3);
            }).prototype = p = new cjs.Sprite();

            (lib.Fisch9 = function() {
                this.spriteSheet = ss["fisch_atlas_"];
                this.gotoAndStop(4);
            }).prototype = p = new cjs.Sprite();

            (lib.mc_blasen3 = function(mode,startPosition,loop) {
                this.initialize(mode,startPosition,loop,{});

                // Ebene 1
                this.instance = new lib.Fisch9();
                this.instance.setTransform(-78,-55);

                this.timeline.addTween(cjs.Tween.get(this.instance).wait(1));

            }).prototype = p = new cjs.MovieClip();
            p.nominalBounds = new cjs.Rectangle(-78,-55,156,110);

            (lib.mc_blasen2 = function(mode,startPosition,loop) {
                this.initialize(mode,startPosition,loop,{});

                // Ebene 1
                this.instance = new lib.Fisch7();
                this.instance.setTransform(-78,-55);

                this.timeline.addTween(cjs.Tween.get(this.instance).wait(1));

            }).prototype = p = new cjs.MovieClip();
            p.nominalBounds = new cjs.Rectangle(-78,-55,156,110);

            (lib.mc_anim_fisch = function(mode,startPosition,loop) {
                this.initialize(mode,startPosition,loop,{});

                // Ebene 1
                this.instance = new lib.Fisch1();
                this.instance.setTransform(-78,-55);

                this.instance_1 = new lib.Fisch3();
                this.instance_1.setTransform(-78,-55);

                this.instance_2 = new lib.Fisch2();
                this.instance_2.setTransform(-78,-55);

                this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.instance}]}).to({state:[{t:this.instance_1}]},9).to({state:[{t:this.instance}]},10).to({state:[{t:this.instance_1}]},10).to({state:[{t:this.instance}]},10).to({state:[{t:this.instance_2}]},10).to({state:[{t:this.instance}]},10).wait(1));

            }).prototype = p = new cjs.MovieClip();
            p.nominalBounds = new cjs.Rectangle(-78,-55,156,110);

// stage content:
            (lib.mainAnimation = function(mode,startPosition,loop, finished, playSound = null) {
                if (loop == null) { loop = false; } this.initialize(mode,startPosition,loop,{});

                // Ebene 1
                this.instance = new lib.mc_blasen3();
                this.instance.setTransform(841,419);
                this.instance._off = true;

                this.timeline.addTween(cjs.Tween.get(this.instance).wait(29).to({_off:false},0).to({y:-45.9},75).wait(55).to({x:441,y:419},0).to({y:-45.9},75).wait(45).to({x:41,y:419},0).to({y:-45.9},75).to({_off:true},1).wait(1));

                // Ebene 2
                this.instance_1 = new lib.mc_blasen2();
                this.instance_1.setTransform(845,431);
                this.instance_1._off = true;

                this.timeline.addTween(cjs.Tween.get(this.instance_1).wait(9).to({_off:false},0).to({y:-45.9},75).wait(15).to({x:645,y:431},0).to({y:-45.9},75).wait(45).to({x:245,y:431},0).to({y:-45.9},75).to({_off:true},61).wait(1));

                // Ebene 4
                this.instance_2 = new lib.Fisch1();
                this.instance_2.setTransform(816,400);

                this.instance_3 = new lib.Fisch2();
                this.instance_3.setTransform(816,400);

                this.instance_4 = new lib.mc_anim_fisch();
                this.instance_4.setTransform(894,455);
                this.instance_4._off = true;

                this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.instance_2}]}).to({state:[{t:this.instance_2}]},4).to({state:[{t:this.instance_3}]},5).to({state:[{t:this.instance_2}]},10).to({state:[{t:this.instance_3}]},10).to({state:[{t:this.instance_2}]},10).to({state:[{t:this.instance_4}]},10).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[]},1).wait(16).call(() => { finished(events); }));
  this.timeline.addTween(cjs.Tween.get(this.instance_4).wait(49).to({_off:false},0).wait(1).to({x:890.6,y:451.8},0).wait(1).to({x:887.2,y:448.6},0).wait(1).to({x:883.8,y:445.5},0).wait(1).to({x:880.3,y:442.4},0).wait(1).to({x:876.8,y:439.5},0).wait(1).to({x:873.2,y:436.5},0).wait(1).to({x:869.5,y:433.7},0).wait(1).to({x:865.8,y:430.9},0).wait(1).to({x:862,y:428.2},0).wait(1).to({x:858.2,y:425.6},0).wait(1).to({x:854.3,y:423.1},0).wait(1).to({x:850.3,y:420.8},0).wait(1).to({x:846.3,y:418.5},0).wait(1).to({x:842.2,y:416.3},0).wait(1).to({x:838,y:414.3},0).wait(1).to({x:833.8,y:412.4},0).wait(1).to({x:829.5,y:410.6},0).wait(1).to({x:825.2,y:409.1},0).wait(1).to({x:820.8,y:407.6},0).wait(1).to({x:816.3,y:406.4},0).wait(1).to({x:811.8,y:405.3},0).wait(1).to({x:807.3,y:404.5},0).wait(1).to({x:802.7,y:403.8},0).wait(1).to({x:798.1,y:403.4},0).wait(1).to({x:793.4,y:403.2},0).wait(1).to({x:788.8},0).wait(1).to({x:784.2,y:403.4},0).wait(1).to({x:779.6,y:403.8},0).wait(1).to({x:775,y:404.5},0).wait(1).to({x:770.4,y:405.4},0).wait(1).to({x:765.9,y:406.5},0).wait(1).to({x:761.5,y:407.8},0).wait(1).to({x:757.1,y:409.2},0).wait(1).to({x:752.8,y:410.9},0).wait(1).to({x:748.5,y:412.8},0).wait(1).to({x:744.4,y:414.8},0).wait(1).to({x:740.3,y:416.9},0).wait(1).to({x:736.2,y:419.2},0).wait(1).to({x:732.3,y:421.7},0).wait(1).to({x:728.5,y:424.2},0).wait(1).to({x:724.7,y:426.9},0).wait(1).to({x:721,y:429.7},0).wait(1).to({x:717.4,y:432.6},0).wait(1).to({x:713.8,y:435.6},0).wait(1).to({x:710.3,y:438.6},0).wait(1).to({x:706.9,y:441.8},0).wait(1).to({x:703.6,y:445},0).wait(1).to({x:700.3,y:448.2},0).wait(1).to({x:697.1,y:451.6},0).wait(1).to({x:694,y:455},0).wait(11).to({x:690.6,y:451.6},0).wait(1).to({x:687.2,y:448.2},0).wait(1).to({x:683.7,y:444.8},0).wait(1).to({x:680.2,y:441.5},0).wait(1).to({x:676.6,y:438.3},0).wait(1).to({x:673,y:435.1},0).wait(1).to({x:669.3,y:432},0).wait(1).to({x:665.6,y:429},0).wait(1).to({x:661.8,y:426},0).wait(1).to({x:658,y:423.1},0).wait(1).to({x:654.1,y:420.3},0).wait(1).to({x:650.1,y:417.6},0).wait(1).to({x:646.1,y:415},0).wait(1).to({x:642,y:412.5},0).wait(1).to({x:637.8,y:410.1},0).wait(1).to({x:633.5,y:407.9},0).wait(1).to({x:629.2,y:405.8},0).wait(1).to({x:624.8,y:403.8},0).wait(1).to({x:620.3,y:402},0).wait(1).to({x:615.8,y:400.4},0).wait(1).to({x:611.2,y:399},0).wait(1).to({x:606.5,y:397.9},0).wait(1).to({x:601.8,y:396.9},0).wait(1).to({x:597.1,y:396.2},0).wait(1).to({x:592.3,y:395.7},0).wait(1).to({x:587.5,y:395.5},0).wait(1).to({x:582.7,y:395.6},0).wait(1).to({x:577.9,y:395.9},0).wait(1).to({x:573.1,y:396.5},0).wait(1).to({x:568.4,y:397.5},0).wait(1).to({x:563.7,y:398.6},0).wait(1).to({x:559.1,y:400.1},0).wait(1).to({x:554.6,y:401.8},0).wait(1).to({x:550.2,y:403.7},0).wait(1).to({x:545.9,y:405.8},0).wait(1).to({x:541.7,y:408.2},0).wait(1).to({x:537.6,y:410.7},0).wait(1).to({x:533.7,y:413.4},0).wait(1).to({x:529.8,y:416.3},0).wait(1).to({x:526.1,y:419.3},0).wait(1).to({x:522.4,y:422.5},0).wait(1).to({x:518.9,y:425.7},0).wait(1).to({x:515.4,y:429.1},0).wait(1).to({x:512.1,y:432.6},0).wait(1).to({x:508.9,y:436.1},0).wait(1).to({x:505.7,y:439.8},0).wait(1).to({x:502.7,y:443.5},0).wait(1).to({x:499.7,y:447.3},0).wait(1).to({x:496.8,y:451.1},0).wait(1).to({x:494,y:455},0).wait(11).to({x:490.6,y:451.7},0).wait(1).to({x:487.2,y:448.4},0).wait(1).to({x:483.8,y:445.2},0).wait(1).to({x:480.3,y:442},0).wait(1).to({x:476.8,y:438.9},0).wait(1).to({x:473.2,y:435.9},0).wait(1).to({x:469.5,y:432.9},0).wait(1).to({x:465.8,y:430},0).wait(1).to({x:462,y:427.2},0).wait(1).to({x:458.2,y:424.5},0).wait(1).to({x:454.3,y:421.9},0).wait(1).to({x:450.3,y:419.3},0).wait(1).to({x:446.3,y:416.9},0).wait(1).to({x:442.2,y:414.6},0).wait(1).to({x:438.1,y:412.4},0).wait(1).to({x:433.8,y:410.4},0).wait(1).to({x:429.5,y:408.5},0).wait(1).to({x:425.1,y:406.7},0).wait(1).to({x:420.7,y:405.2},0).wait(1).to({x:416.2,y:403.8},0).wait(1).to({x:411.6,y:402.6},0).wait(1).to({x:407.1,y:401.6},0).wait(1).to({x:402.4,y:400.8},0).wait(1).to({x:397.7,y:400.3},0).wait(1).to({x:393.1,y:400},0).wait(1).to({x:388.3,y:399.9},0).wait(1).to({x:383.6,y:400.1},0).wait(1).to({x:379,y:400.5},0).wait(1).to({x:374.3,y:401.2},0).wait(1).to({x:369.7,y:402.1},0).wait(1).to({x:365.1,y:403.2},0).wait(1).to({x:360.6,y:404.6},0).wait(1).to({x:356.2,y:406.2},0).wait(1).to({x:351.8,y:407.9},0).wait(1).to({x:347.6,y:409.9},0).wait(1).to({x:343.4,y:412.1},0).wait(1).to({x:339.3,y:414.4},0).wait(1).to({x:335.3,y:416.9},0).wait(1).to({x:331.4,y:419.5},0).wait(1).to({x:327.6,y:422.2},0).wait(1).to({x:323.8,y:425.1},0).wait(1).to({x:320.2,y:428.1},0).wait(1).to({x:316.6,y:431.2},0).wait(1).to({x:313.2,y:434.3},0).wait(1).to({x:309.8,y:437.6},0).wait(1).to({x:306.5,y:440.9},0).wait(1).to({x:303.2,y:444.4},0).wait(1).to({x:300.1,y:447.8},0).wait(1).to({x:297,y:451.4},0).wait(1).to({x:294,y:455},0).wait(11).to({x:290.7,y:451.7},0).wait(1).to({x:287.4,y:448.4},0).wait(1).to({x:284.1,y:445.2},0).wait(1).to({x:280.7,y:442.1},0).wait(1).to({x:277.2,y:439.1},0).wait(1).to({x:273.7,y:436.1},0).wait(1).to({x:270.1,y:433.2},0).wait(1).to({x:266.4,y:430.4},0).wait(1).to({x:262.7,y:427.7},0).wait(1).to({x:258.9,y:425},0).wait(1).to({x:255,y:422.5},0).wait(1).to({x:251,y:420.1},0).wait(1).to({x:247,y:417.8},0).wait(1).to({x:242.9,y:415.7},0).wait(1).to({x:238.8,y:413.7},0).wait(1).to({x:234.5,y:411.8},0).wait(1).to({x:230.2,y:410.1},0).wait(1).to({x:225.9,y:408.6},0).wait(1).to({x:221.4,y:407.3},0).wait(1).to({x:217,y:406.2},0).wait(1).to({x:212.4,y:405.2},0).wait(1).to({x:207.9,y:404.5},0).wait(1).to({x:203.3,y:403.9},0).wait(1).to({x:198.7,y:403.6},0).wait(1).to({x:194},0).wait(1).to({x:189.4,y:403.7},0).wait(1).to({x:184.8,y:404},0).wait(1).to({x:180.2,y:404.6},0).wait(1).to({x:175.7,y:405.4},0).wait(1).to({x:171.2,y:406.3},0).wait(1).to({x:166.7,y:407.5},0).wait(1).to({x:162.3,y:408.9},0).wait(1).to({x:157.9,y:410.4},0).wait(1).to({x:153.6,y:412.1},0).wait(1).to({x:149.4,y:414},0).wait(1).to({x:145.2,y:416},0).wait(1).to({x:141.1,y:418.1},0).wait(1).to({x:137.1,y:420.4},0).wait(1).to({x:133.2,y:422.8},0).wait(1).to({x:129.3,y:425.3},0).wait(1).to({x:125.4,y:427.9},0).wait(1).to({x:121.7,y:430.6},0).wait(1).to({x:118,y:433.4},0).wait(1).to({x:114.4,y:436.3},0).wait(1).to({x:110.8,y:439.2},0).wait(1).to({x:107.4,y:442.3},0).wait(1).to({x:103.9,y:445.3},0).wait(1).to({x:100.5,y:448.5},0).wait(1).to({x:97.2,y:451.7},0).wait(1).to({x:94,y:455},0).wait(11).to({x:90.6,y:451.9},0).wait(1).to({x:87.2,y:448.8},0).wait(1).to({x:83.8,y:445.9},0).wait(1).to({x:80.3,y:442.9},0).wait(1).to({x:76.8,y:440.1},0).wait(1).to({x:73.2,y:437.3},0).wait(1).to({x:69.5,y:434.6},0).wait(1).to({x:65.8,y:432},0).wait(1).to({x:62,y:429.4},0).wait(1).to({x:58.1,y:427},0).wait(1).to({x:54.2,y:424.6},0).wait(1).to({x:50.3,y:422.4},0).wait(1).to({x:46.2,y:420.3},0).wait(1).to({x:42.1,y:418.3},0).wait(1).to({x:38,y:416.4},0).wait(1).to({x:33.8,y:414.7},0).wait(1).to({x:29.5,y:413.1},0).wait(1).to({x:25.2,y:411.7},0).wait(1).to({x:20.8,y:410.5},0).wait(1).to({x:16.4,y:409.4},0).wait(1).to({x:11.9,y:408.5},0).wait(1).to({x:7.4,y:407.7},0).wait(1).to({x:2.9,y:407.2},0).wait(1).to({x:-1.7,y:406.9},0).wait(1).to({x:-6.2,y:406.7},0).wait(1).to({x:-10.8,y:406.8},0).wait(1).to({x:-15.3,y:407.1},0).wait(1).to({x:-19.8,y:407.5},0).wait(1).to({x:-24.3,y:408.2},0).wait(1).to({x:-28.8,y:409},0).wait(1).to({x:-33.3,y:410.1},0).wait(1).to({x:-37.6,y:411.3},0).wait(1).to({x:-42,y:412.7},0).wait(1).to({x:-46.3,y:414.2},0).wait(1).to({x:-50.5,y:415.9},0).wait(1).to({x:-54.6,y:417.8},0).wait(1).to({x:-58.7,y:419.8},0).wait(1).to({x:-62.8,y:421.9},0).wait(1).to({x:-66.7,y:424.1},0).wait(1).to({x:-70.6,y:426.5},0).wait(1).to({x:-74.5,y:429},0).wait(1).to({x:-78.2,y:431.5},0).wait(1).to({x:-81.9,y:434.2},0).wait(1).to({x:-85.5,y:436.9},0).wait(1).to({x:-89.1,y:439.8},0).wait(1).to({x:-92.6,y:442.7},0).wait(1).to({x:-96.1,y:445.7},0).wait(1).to({x:-99.4,y:448.7},0).wait(1).to({x:-102.8,y:451.8},0).wait(1).to({x:-106,y:455},0).to({_off:true},1).wait(16).call(() => { finished(events); }));

            }).prototype = p = new cjs.MovieClip();
            p.nominalBounds = new cjs.Rectangle(1316,725,156,110);

        })(lib = lib||{}, images = images||{}, createjs = createjs||{}, ss = ss||{}, this.events);

        this.animationInit = this.setupAnimations(ss, images, lib, createjs);

    }

}
</code>```

<p>This code is mostly generated. I had to add some code to integrate it into Angular 5 and add some events. </p>

<p>The Error appears when I compile with the --prod flag in Ionic. Or When I compile the file via the tsc command. ionic cordova build without --prod flag works fine.</p>

答:
try to install this version of zone

```<code>npm install --save zone.js@0.8.16
</code>```

the problems is related to old version of zone

Title: Typescript Callstack Size Exceeded

Body:
The following code throws a Callstack Size Exceeded Error:

    declare var createjs:any;

import {Animation} from '../animation';
import {Events} from 'ionic-angular';
import { Inject } from '@angular/core';

export class FischSuccess extends Animation {

    constructor(@Inject(Events) public events: Events) {
        super(events);
        this.initAnimation();
    }

    initAnimation() {

        var lib, images, ss;

        (function (lib, img, cjs, ss, events) {

            var cjs = createjs;

            var p; // shortcut to reference prototypes
            lib.webFontTxtFilters = {};

// library properties:
            lib.properties = {
                width: 1000,
                height: 650,
                fps: 25,
                color: "#FFFFFF",
                opacity: 1.00,
                webfonts: {},
                manifest: [
                    {src:"images/fisch_atlas_success.png", id:"fisch_atlas_"}
                ]
            };

            lib.ssMetadata = [
                {name:"fisch_atlas_", frames: [[158,0,156,110],[0,0,156,110],[316,0,156,110],[0,112,156,110],[158,112,156,110]]}
            ];

            lib.webfontAvailable = function(family) {
                lib.properties.webfonts[family] = true;
                var txtFilters = lib.webFontTxtFilters && lib.webFontTxtFilters[family] || [];
                for(var f = 0; f < txtFilters.length; ++f) {
                    txtFilters[f].updateCache();
                }
            };
// symbols:

            (lib.Fisch1 = function() {
                this.spriteSheet = ss["fisch_atlas_"];
                this.gotoAndStop(0);
            }).prototype = p = new cjs.Sprite();

            (lib.Fisch2 = function() {
                this.spriteSheet = ss["fisch_atlas_"];
                this.gotoAndStop(1);
            }).prototype = p = new cjs.Sprite();

            (lib.Fisch3 = function() {
                this.spriteSheet = ss["fisch_atlas_"];
                this.gotoAndStop(2);
            }).prototype = p = new cjs.Sprite();

            (lib.Fisch7 = function() {
                this.spriteSheet = ss["fisch_atlas_"];
                this.gotoAndStop(3);
            }).prototype = p = new cjs.Sprite();

            (lib.Fisch9 = function() {
                this.spriteSheet = ss["fisch_atlas_"];
                this.gotoAndStop(4);
            }).prototype = p = new cjs.Sprite();

            (lib.mc_blasen3 = function(mode,startPosition,loop) {
                this.initialize(mode,startPosition,loop,{});

                // Ebene 1
                this.instance = new lib.Fisch9();
                this.instance.setTransform(-78,-55);

                this.timeline.addTween(cjs.Tween.get(this.instance).wait(1));

            }).prototype = p = new cjs.MovieClip();
            p.nominalBounds = new cjs.Rectangle(-78,-55,156,110);

            (lib.mc_blasen2 = function(mode,startPosition,loop) {
                this.initialize(mode,startPosition,loop,{});

                // Ebene 1
                this.instance = new lib.Fisch7();
                this.instance.setTransform(-78,-55);

                this.timeline.addTween(cjs.Tween.get(this.instance).wait(1));

            }).prototype = p = new cjs.MovieClip();
            p.nominalBounds = new cjs.Rectangle(-78,-55,156,110);

            (lib.mc_anim_fisch = function(mode,startPosition,loop) {
                this.initialize(mode,startPosition,loop,{});

                // Ebene 1
                this.instance = new lib.Fisch1();
                this.instance.setTransform(-78,-55);

                this.instance_1 = new lib.Fisch3();
                this.instance_1.setTransform(-78,-55);

                this.instance_2 = new lib.Fisch2();
                this.instance_2.setTransform(-78,-55);

                this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.instance}]}).to({state:[{t:this.instance_1}]},9).to({state:[{t:this.instance}]},10).to({state:[{t:this.instance_1}]},10).to({state:[{t:this.instance}]},10).to({state:[{t:this.instance_2}]},10).to({state:[{t:this.instance}]},10).wait(1));

            }).prototype = p = new cjs.MovieClip();
            p.nominalBounds = new cjs.Rectangle(-78,-55,156,110);

// stage content:
            (lib.mainAnimation = function(mode,startPosition,loop, finished, playSound = null) {
                if (loop == null) { loop = false; } this.initialize(mode,startPosition,loop,{});

                // Ebene 1
                this.instance = new lib.mc_blasen3();
                this.instance.setTransform(841,419);
                this.instance._off = true;

                this.timeline.addTween(cjs.Tween.get(this.instance).wait(29).to({_off:false},0).to({y:-45.9},75).wait(55).to({x:441,y:419},0).to({y:-45.9},75).wait(45).to({x:41,y:419},0).to({y:-45.9},75).to({_off:true},1).wait(1));

                // Ebene 2
                this.instance_1 = new lib.mc_blasen2();
                this.instance_1.setTransform(845,431);
                this.instance_1._off = true;

                this.timeline.addTween(cjs.Tween.get(this.instance_1).wait(9).to({_off:false},0).to({y:-45.9},75).wait(15).to({x:645,y:431},0).to({y:-45.9},75).wait(45).to({x:245,y:431},0).to({y:-45.9},75).to({_off:true},61).wait(1));

                // Ebene 4
                this.instance_2 = new lib.Fisch1();
                this.instance_2.setTransform(816,400);

                this.instance_3 = new lib.Fisch2();
                this.instance_3.setTransform(816,400);

                this.instance_4 = new lib.mc_anim_fisch();
                this.instance_4.setTransform(894,455);
                this.instance_4._off = true;

                this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.instance_2}]}).to({state:[{t:this.instance_2}]},4).to({state:[{t:this.instance_3}]},5).to({state:[{t:this.instance_2}]},10).to({state:[{t:this.instance_3}]},10).to({state:[{t:this.instance_2}]},10).to({state:[{t:this.instance_4}]},10).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[{t:this.instance_4}]},1).to({state:[]},1).wait(16).call(() => { finished(events); }));
  this.timeline.addTween(cjs.Tween.get(this.instance_4).wait(49).to({_off:false},0).wait(1).to({x:890.6,y:451.8},0).wait(1).to({x:887.2,y:448.6},0).wait(1).to({x:883.8,y:445.5},0).wait(1).to({x:880.3,y:442.4},0).wait(1).to({x:876.8,y:439.5},0).wait(1).to({x:873.2,y:436.5},0).wait(1).to({x:869.5,y:433.7},0).wait(1).to({x:865.8,y:430.9},0).wait(1).to({x:862,y:428.2},0).wait(1).to({x:858.2,y:425.6},0).wait(1).to({x:854.3,y:423.1},0).wait(1).to({x:850.3,y:420.8},0).wait(1).to({x:846.3,y:418.5},0).wait(1).to({x:842.2,y:416.3},0).wait(1).to({x:838,y:414.3},0).wait(1).to({x:833.8,y:412.4},0).wait(1).to({x:829.5,y:410.6},0).wait(1).to({x:825.2,y:409.1},0).wait(1).to({x:820.8,y:407.6},0).wait(1).to({x:816.3,y:406.4},0).wait(1).to({x:811.8,y:405.3},0).wait(1).to({x:807.3,y:404.5},0).wait(1).to({x:802.7,y:403.8},0).wait(1).to({x:798.1,y:403.4},0).wait(1).to({x:793.4,y:403.2},0).wait(1).to({x:788.8},0).wait(1).to({x:784.2,y:403.4},0).wait(1).to({x:779.6,y:403.8},0).wait(1).to({x:775,y:404.5},0).wait(1).to({x:770.4,y:405.4},0).wait(1).to({x:765.9,y:406.5},0).wait(1).to({x:761.5,y:407.8},0).wait(1).to({x:757.1,y:409.2},0).wait(1).to({x:752.8,y:410.9},0).wait(1).to({x:748.5,y:412.8},0).wait(1).to({x:744.4,y:414.8},0).wait(1).to({x:740.3,y:416.9},0).wait(1).to({x:736.2,y:419.2},0).wait(1).to({x:732.3,y:421.7},0).wait(1).to({x:728.5,y:424.2},0).wait(1).to({x:724.7,y:426.9},0).wait(1).to({x:721,y:429.7},0).wait(1).to({x:717.4,y:432.6},0).wait(1).to({x:713.8,y:435.6},0).wait(1).to({x:710.3,y:438.6},0).wait(1).to({x:706.9,y:441.8},0).wait(1).to({x:703.6,y:445},0).wait(1).to({x:700.3,y:448.2},0).wait(1).to({x:697.1,y:451.6},0).wait(1).to({x:694,y:455},0).wait(11).to({x:690.6,y:451.6},0).wait(1).to({x:687.2,y:448.2},0).wait(1).to({x:683.7,y:444.8},0).wait(1).to({x:680.2,y:441.5},0).wait(1).to({x:676.6,y:438.3},0).wait(1).to({x:673,y:435.1},0).wait(1).to({x:669.3,y:432},0).wait(1).to({x:665.6,y:429},0).wait(1).to({x:661.8,y:426},0).wait(1).to({x:658,y:423.1},0).wait(1).to({x:654.1,y:420.3},0).wait(1).to({x:650.1,y:417.6},0).wait(1).to({x:646.1,y:415},0).wait(1).to({x:642,y:412.5},0).wait(1).to({x:637.8,y:410.1},0).wait(1).to({x:633.5,y:407.9},0).wait(1).to({x:629.2,y:405.8},0).wait(1).to({x:624.8,y:403.8},0).wait(1).to({x:620.3,y:402},0).wait(1).to({x:615.8,y:400.4},0).wait(1).to({x:611.2,y:399},0).wait(1).to({x:606.5,y:397.9},0).wait(1).to({x:601.8,y:396.9},0).wait(1).to({x:597.1,y:396.2},0).wait(1).to({x:592.3,y:395.7},0).wait(1).to({x:587.5,y:395.5},0).wait(1).to({x:582.7,y:395.6},0).wait(1).to({x:577.9,y:395.9},0).wait(1).to({x:573.1,y:396.5},0).wait(1).to({x:568.4,y:397.5},0).wait(1).to({x:563.7,y:398.6},0).wait(1).to({x:559.1,y:400.1},0).wait(1).to({x:554.6,y:401.8},0).wait(1).to({x:550.2,y:403.7},0).wait(1).to({x:545.9,y:405.8},0).wait(1).to({x:541.7,y:408.2},0).wait(1).to({x:537.6,y:410.7},0).wait(1).to({x:533.7,y:413.4},0).wait(1).to({x:529.8,y:416.3},0).wait(1).to({x:526.1,y:419.3},0).wait(1).to({x:522.4,y:422.5},0).wait(1).to({x:518.9,y:425.7},0).wait(1).to({x:515.4,y:429.1},0).wait(1).to({x:512.1,y:432.6},0).wait(1).to({x:508.9,y:436.1},0).wait(1).to({x:505.7,y:439.8},0).wait(1).to({x:502.7,y:443.5},0).wait(1).to({x:499.7,y:447.3},0).wait(1).to({x:496.8,y:451.1},0).wait(1).to({x:494,y:455},0).wait(11).to({x:490.6,y:451.7},0).wait(1).to({x:487.2,y:448.4},0).wait(1).to({x:483.8,y:445.2},0).wait(1).to({x:480.3,y:442},0).wait(1).to({x:476.8,y:438.9},0).wait(1).to({x:473.2,y:435.9},0).wait(1).to({x:469.5,y:432.9},0).wait(1).to({x:465.8,y:430},0).wait(1).to({x:462,y:427.2},0).wait(1).to({x:458.2,y:424.5},0).wait(1).to({x:454.3,y:421.9},0).wait(1).to({x:450.3,y:419.3},0).wait(1).to({x:446.3,y:416.9},0).wait(1).to({x:442.2,y:414.6},0).wait(1).to({x:438.1,y:412.4},0).wait(1).to({x:433.8,y:410.4},0).wait(1).to({x:429.5,y:408.5},0).wait(1).to({x:425.1,y:406.7},0).wait(1).to({x:420.7,y:405.2},0).wait(1).to({x:416.2,y:403.8},0).wait(1).to({x:411.6,y:402.6},0).wait(1).to({x:407.1,y:401.6},0).wait(1).to({x:402.4,y:400.8},0).wait(1).to({x:397.7,y:400.3},0).wait(1).to({x:393.1,y:400},0).wait(1).to({x:388.3,y:399.9},0).wait(1).to({x:383.6,y:400.1},0).wait(1).to({x:379,y:400.5},0).wait(1).to({x:374.3,y:401.2},0).wait(1).to({x:369.7,y:402.1},0).wait(1).to({x:365.1,y:403.2},0).wait(1).to({x:360.6,y:404.6},0).wait(1).to({x:356.2,y:406.2},0).wait(1).to({x:351.8,y:407.9},0).wait(1).to({x:347.6,y:409.9},0).wait(1).to({x:343.4,y:412.1},0).wait(1).to({x:339.3,y:414.4},0).wait(1).to({x:335.3,y:416.9},0).wait(1).to({x:331.4,y:419.5},0).wait(1).to({x:327.6,y:422.2},0).wait(1).to({x:323.8,y:425.1},0).wait(1).to({x:320.2,y:428.1},0).wait(1).to({x:316.6,y:431.2},0).wait(1).to({x:313.2,y:434.3},0).wait(1).to({x:309.8,y:437.6},0).wait(1).to({x:306.5,y:440.9},0).wait(1).to({x:303.2,y:444.4},0).wait(1).to({x:300.1,y:447.8},0).wait(1).to({x:297,y:451.4},0).wait(1).to({x:294,y:455},0).wait(11).to({x:290.7,y:451.7},0).wait(1).to({x:287.4,y:448.4},0).wait(1).to({x:284.1,y:445.2},0).wait(1).to({x:280.7,y:442.1},0).wait(1).to({x:277.2,y:439.1},0).wait(1).to({x:273.7,y:436.1},0).wait(1).to({x:270.1,y:433.2},0).wait(1).to({x:266.4,y:430.4},0).wait(1).to({x:262.7,y:427.7},0).wait(1).to({x:258.9,y:425},0).wait(1).to({x:255,y:422.5},0).wait(1).to({x:251,y:420.1},0).wait(1).to({x:247,y:417.8},0).wait(1).to({x:242.9,y:415.7},0).wait(1).to({x:238.8,y:413.7},0).wait(1).to({x:234.5,y:411.8},0).wait(1).to({x:230.2,y:410.1},0).wait(1).to({x:225.9,y:408.6},0).wait(1).to({x:221.4,y:407.3},0).wait(1).to({x:217,y:406.2},0).wait(1).to({x:212.4,y:405.2},0).wait(1).to({x:207.9,y:404.5},0).wait(1).to({x:203.3,y:403.9},0).wait(1).to({x:198.7,y:403.6},0).wait(1).to({x:194},0).wait(1).to({x:189.4,y:403.7},0).wait(1).to({x:184.8,y:404},0).wait(1).to({x:180.2,y:404.6},0).wait(1).to({x:175.7,y:405.4},0).wait(1).to({x:171.2,y:406.3},0).wait(1).to({x:166.7,y:407.5},0).wait(1).to({x:162.3,y:408.9},0).wait(1).to({x:157.9,y:410.4},0).wait(1).to({x:153.6,y:412.1},0).wait(1).to({x:149.4,y:414},0).wait(1).to({x:145.2,y:416},0).wait(1).to({x:141.1,y:418.1},0).wait(1).to({x:137.1,y:420.4},0).wait(1).to({x:133.2,y:422.8},0).wait(1).to({x:129.3,y:425.3},0).wait(1).to({x:125.4,y:427.9},0).wait(1).to({x:121.7,y:430.6},0).wait(1).to({x:118,y:433.4},0).wait(1).to({x:114.4,y:436.3},0).wait(1).to({x:110.8,y:439.2},0).wait(1).to({x:107.4,y:442.3},0).wait(1).to({x:103.9,y:445.3},0).wait(1).to({x:100.5,y:448.5},0).wait(1).to({x:97.2,y:451.7},0).wait(1).to({x:94,y:455},0).wait(11).to({x:90.6,y:451.9},0).wait(1).to({x:87.2,y:448.8},0).wait(1).to({x:83.8,y:445.9},0).wait(1).to({x:80.3,y:442.9},0).wait(1).to({x:76.8,y:440.1},0).wait(1).to({x:73.2,y:437.3},0).wait(1).to({x:69.5,y:434.6},0).wait(1).to({x:65.8,y:432},0).wait(1).to({x:62,y:429.4},0).wait(1).to({x:58.1,y:427},0).wait(1).to({x:54.2,y:424.6},0).wait(1).to({x:50.3,y:422.4},0).wait(1).to({x:46.2,y:420.3},0).wait(1).to({x:42.1,y:418.3},0).wait(1).to({x:38,y:416.4},0).wait(1).to({x:33.8,y:414.7},0).wait(1).to({x:29.5,y:413.1},0).wait(1).to({x:25.2,y:411.7},0).wait(1).to({x:20.8,y:410.5},0).wait(1).to({x:16.4,y:409.4},0).wait(1).to({x:11.9,y:408.5},0).wait(1).to({x:7.4,y:407.7},0).wait(1).to({x:2.9,y:407.2},0).wait(1).to({x:-1.7,y:406.9},0).wait(1).to({x:-6.2,y:406.7},0).wait(1).to({x:-10.8,y:406.8},0).wait(1).to({x:-15.3,y:407.1},0).wait(1).to({x:-19.8,y:407.5},0).wait(1).to({x:-24.3,y:408.2},0).wait(1).to({x:-28.8,y:409},0).wait(1).to({x:-33.3,y:410.1},0).wait(1).to({x:-37.6,y:411.3},0).wait(1).to({x:-42,y:412.7},0).wait(1).to({x:-46.3,y:414.2},0).wait(1).to({x:-50.5,y:415.9},0).wait(1).to({x:-54.6,y:417.8},0).wait(1).to({x:-58.7,y:419.8},0).wait(1).to({x:-62.8,y:421.9},0).wait(1).to({x:-66.7,y:424.1},0).wait(1).to({x:-70.6,y:426.5},0).wait(1).to({x:-74.5,y:429},0).wait(1).to({x:-78.2,y:431.5},0).wait(1).to({x:-81.9,y:434.2},0).wait(1).to({x:-85.5,y:436.9},0).wait(1).to({x:-89.1,y:439.8},0).wait(1).to({x:-92.6,y:442.7},0).wait(1).to({x:-96.1,y:445.7},0).wait(1).to({x:-99.4,y:448.7},0).wait(1).to({x:-102.8,y:451.8},0).wait(1).to({x:-106,y:455},0).to({_off:true},1).wait(16).call(() => { finished(events); }));

            }).prototype = p = new cjs.MovieClip();
            p.nominalBounds = new cjs.Rectangle(1316,725,156,110);

        })(lib = lib||{}, images = images||{}, createjs = createjs||{}, ss = ss||{}, this.events);

        this.animationInit = this.setupAnimations(ss, images, lib, createjs);

    }

}

This code is mostly generated. I had to add some code to integrate it into Angular 5 and add some events.

The Error appears when I compile with the --prod flag in Ionic. Or When I compile the file via the tsc command. ionic cordova build without --prod flag works fine.

Body:
try to install this version of zone

npm install --save zone.js@0.8.16

the problems is related to old version of zone


来源: stackexchange

问:
Python- writing json file as list of dictionaries
I am writing a json file from information extracted from a url. How do I print each element of the dictionary on a separate line?

This is my current code:

```<code>dct=[{"name": name,
        "cuisine": cuisine,
        "price-range": price,
        "address": address,
        "rating": rating,
        "reviews": score,
        "district": district,
        "url": link
        }]

    with open('openrice_data.json', 'a') as file:
        file.write(json.dumps(dct))
</code>```

For example, it currently prints like this:

```<code>[{"cuisine": ["Japanese", "Hot Pot", "Buffet"], "rating": [3.5], "address": [22.3825, 114.1901], "url": ["https://www.openrice.com/en/hongkong/r-wagyu-more-sha-tin-japanese-hot-pot-r172321"], "reviews": [35, 17, 8], "name": "Wagyu More", "price-range": ["$101-200"], "district": ["Sha Tin"]}]
</code>```

I would like it to print like this:

```<code>[
{"name": "Chan Kun Kee",
"cuisine": ["Guang Dong", "Dai Pai Dong"],
"price-range": "$51-100",
"address": [22.3884, 114.1958],
"rating": 3.5,
"reviews": [216, 95, 38],
"district": "Shatin",
"url": "www.openrice.com/en/hongkong/r-chan-kun-kee-sha-tin-guangdong-r7918"
}
]
</code>```

答:
Use prettyprinter:

```<code>import pprint
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(dct)
</code>```

Also: you are currently putting the dict in a list. [] is a list {} is a dict in python.
By putting [{}] you are putting the dict into a list. Just remove the [].

ContentLicense: CC BY-SA 3.0

Body:
I am writing a json file from information extracted from a url. How do I print each element of the dictionary on a separate line?

This is my current code:

dct=[{"name": name,
        "cuisine": cuisine,
        "price-range": price,
        "address": address,
        "rating": rating,
        "reviews": score,
        "district": district,
        "url": link
        }]

    with open('openrice_data.json', 'a') as file:
        file.write(json.dumps(dct))

For example, it currently prints like this:

[{"cuisine": ["Japanese", "Hot Pot", "Buffet"], "rating": [3.5], "address": [22.3825, 114.1901], "url": ["https://www.openrice.com/en/hongkong/r-wagyu-more-sha-tin-japanese-hot-pot-r172321"], "reviews": [35, 17, 8], "name": "Wagyu More", "price-range": ["$101-200"], "district": ["Sha Tin"]}]

I would like it to print like this:

[
{"name": "Chan Kun Kee",
"cuisine": ["Guang Dong", "Dai Pai Dong"],
"price-range": "$51-100",
"address": [22.3884, 114.1958],
"rating": 3.5,
"reviews": [216, 95, 38],
"district": "Shatin",
"url": "www.openrice.com/en/hongkong/r-chan-kun-kee-sha-tin-guangdong-r7918"
}
]

Body:
Use prettyprinter:

import pprint
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(dct)

Also: you are currently putting the dict in a list. [] is a list {} is a dict in python.
By putting [{}] you are putting the dict into a list. Just remove the [].


问:
yii2 render after post-request
I have a view with a gridview with checkboxcolumn and a google-map (2amigos). The user selects the machines to display in the map by selecting the corresponding items in the gridview. A html-button submitts the selected keys to the controller. Following the controler code (dataProvider gets updated by post-request):

```<code>//some code before render
$dataProvider = new ActiveDataProvider(['query'=>$query, 'pagination'=>false]);
return $this->render('locating', [
    'model' => $model,
    'searchModel' => $searchModel,
    'dataProvider1' => $dataProvider1,
    'dataProvider' => $dataProvider,
    ]);
}
</code>```

And this is the js-script for the html-button:

```<code>$('#showButton').click(function(){
    var keys = $('#w0').yiiGridView('getSelectedRows');
    $.post("http://localhost:8080/eddb1/frontend/web/index.php?r=tracking/locating",
    {'keylist': keys},
    function(data){
        console.log(data);
    });
});
</code>```

The problem is, that with the post request the result of php-render command gets writen as a html-string to the post-response but the view doesn't get re-rendered. If I do the same with an activeForm instead of a gridview (to select the machines) and a submit-button the page gets re-rendered as it should (but this way doesn't work for me because I need the gridview with filter and sorting). What can I do that the map (or the view) gets re-rendered with the post-request?

答:
you can create some function on your base controller to make sure it was rendered as an ajax or not, the code seems like this.

```<code>protected function renderIsAjax($view, $params = [])
{
    if (Yii::$app->request->isAjax) {
        return $this->renderAjax($view, $params);
    } else {
        return $this->render($view, $params);
}
</code>```

then in your controller just call that method

```<code>return $this->renderIsAjax('locating', [
    'model' => $model,
    'searchModel' => $searchModel,
    'dataProvider1' => $dataProvider1,
    'dataProvider' => $dataProvider,
]);
</code>```

Title: yii2 render after post-request

Body:
I have a view with a gridview with checkboxcolumn and a google-map (2amigos). The user selects the machines to display in the map by selecting the corresponding items in the gridview. A html-button submitts the selected keys to the controller. Following the controler code (dataProvider gets updated by post-request):

//some code before render
$dataProvider = new ActiveDataProvider(['query'=>$query, 'pagination'=>false]);
return $this->render('locating', [
    'model' => $model,
    'searchModel' => $searchModel,
    'dataProvider1' => $dataProvider1,
    'dataProvider' => $dataProvider,
    ]);
}

And this is the js-script for the html-button:

$('#showButton').click(function(){
    var keys = $('#w0').yiiGridView('getSelectedRows');
    $.post("http://localhost:8080/eddb1/frontend/web/index.php?r=tracking/locating",
    {'keylist': keys},
    function(data){
        console.log(data);
    });
});

The problem is, that with the post request the result of php-render command gets writen as a html-string to the post-response but the view doesn't get re-rendered. If I do the same with an activeForm instead of a gridview (to select the machines) and a submit-button the page gets re-rendered as it should (but this way doesn't work for me because I need the gridview with filter and sorting). What can I do that the map (or the view) gets re-rendered with the post-request?

Body:
you can create some function on your base controller to make sure it was rendered as an ajax or not, the code seems like this.

protected function renderIsAjax($view, $params = [])
{
    if (Yii::$app->request->isAjax) {
        return $this->renderAjax($view, $params);
    } else {
        return $this->render($view, $params);
}

then in your controller just call that method

return $this->renderIsAjax('locating', [
    'model' => $model,
    'searchModel' => $searchModel,
    'dataProvider1' => $dataProvider1,
    'dataProvider' => $dataProvider,
]);


问:
Core Data primary key ID for a row in the database
Suppose I have a list of books stored in Core Data. I want to search for a book by it's primary key ID.

I know the sqlite file created by Core Data has an ID column in each table, but this doesn't seem to be exposed to me in anyway.

Does anyone have any recommendations?

答:
-[NSManagedObject objectID] is the unique ID for an object instance in Core Data. It can be serialized via -[NSManagedObjectID URIRepresentation]. You can retrieve the objectID from a persistent store coordinator with -[NSPersistentStoreCoordinator managedObjectIDForURIRepresentation:] and then get the object from a managed object context with -[NSManagedObjectContext objectWithID:].

BUT

You should keep in mind that Core Data is not an ORM. It is an object graph management framework. That is uses SQLite (and unique row IDs) as a backend is purely an implementation detail. The sooner you can get yourself out of the SQL/RDBMS mindset, the faster you will be happy with Core Data. Instead of trying to find an object from a stored ID, consider why you need that object and what object needs it. If an instance of class Foo needs to be able to get to an instance of class Bar, why not just create an association from the Foo to the Bar and set the appropriate Bar instance as the target of the association on the appropriate Foo instance. Let Core Data keep track of object IDs.

ContentLicense: CC BY-SA 4.0

ContentLicense: CC BY-SA 2.5


问:
JMeter Groovy re execute a Sampler X times under condition
I want to re execute a Sampler for 5 times or until a certain variable has the value "true", Is there any method in Groovy or do I have to do something in JMeter?</p>

答:
Add JSR223 PostProcessor as Sampler's PostProcessor to retry Sampler in case variable condition is true

Also update and check retryCount:

```<code>if (vars.getObject("retryCount") < 5 && "true".equals(vars.get("condition"))) {
   retryCountNow = vars.getObject("retryCount") + 1;
   vars.putObject("retryCount", retryCountNow);
   ctx.getCurrentSampler().sample(null);
}
</code>```

retryCount can be insert in JSR223 PreProcessor of request:

```<code>vars.putObject("retryCount",0);
</code>```

Body:
Add JSR223 PostProcessor as Sampler's PostProcessor to retry Sampler in case variable condition is true

Also update and check retryCount:

if (vars.getObject("retryCount") < 5 && "true".equals(vars.get("condition"))) {
   retryCountNow = vars.getObject("retryCount") + 1;
   vars.putObject("retryCount", retryCountNow);
   ctx.getCurrentSampler().sample(null);
}

retryCount can be insert in JSR223 PreProcessor of request:

vars.putObject("retryCount",0);


问:
How to assign value in 4 X 4 array ruby?
I am creating an array @multi containing four elements, each of which is a 4-element array. In the example below, the class Test has a method assign_values is to be passed two arguments, an array of one or more two-element arrays, [i,j] ("locations") and a value v, meaning that @multi[i][j] should be set equal to v

The method result returns @multi after all unassigned elements have been set equal to '-'

The user input would be the array locations like below:

```<code>Alpha_array = [[0,1], [2,3], [3,2]]
Beta_array = [[0,3], [3,1], [1,0]]
</code>```

And my desired output is

```<code># => [["-", "A", "-", "B"], ["-B", "-", "-", "-"], ["-", "-", "-", "A"], ["-", "B", "A", "-"]]
</code>```

What I have tried so far

```<code>class Test
  def initialize
    @multi = 4.times.map { 4.times.map { '-' } }
  end

  def assign_values array, new_value
    array.each { |element|
      @multi[element[0]][element[1]] = new_value
    }
  end

  def result
    @multi
  end
end

Alpha_array = [[0,1], [2,3], [3,2]]
Beta_array = [[0,3], [3,1], [1,0]]

test = Test.new
test.assign_values(Alpha_array, 'A')
test.assign_values(Beta_array, 'B')

test.result
</code>```

Output:

```<code># => [["-", "A", "-", "B"], ["-B", "-", "-", "-"], ["-", "-", "-", "A"], ["-", "B", "A", "-"]]
</code>```

Is there an elegant and efficient way to get the outuput ?

答:
```<code>class Test
  attr_reader :result

  def initialize(dim1, dim2)
    @result = Array.new(dim1) { Array.new(dim2, '-') }
  end

  def assign_values(array, new_value)
    array.each { |i,j| @result[i][j] = new_value }
  end
end

test = Test.new(4,4)
test.assign_values([[0,1], [2,3], [3,2]], 'A')
test.assign_values([[0,3], [3,1], [1,0]], 'B')
test.result
  #=> [["-", "A", "-", "B"],
  #    ["B", "-", "-", "-"],
  #    ["-", "-", "-", "A"],
  #    ["-", "B", "A", "-"]]
</code>```

See Array::new.

Body:
I am creating an array @multi containing four elements, each of which is a 4-element array. In the example below, the class Test has a method assign_values is to be passed two arguments, an array of one or more two-element arrays, [i,j] ("locations") and a value v, meaning that @multi[i][j] should be set equal to v

The method result returns @multi after all unassigned elements have been set equal to '-'

The user input would be the array locations like below:

Alpha_array = [[0,1], [2,3], [3,2]]
Beta_array = [[0,3], [3,1], [1,0]]

And my desired output is

# => [["-", "A", "-", "B"], ["-B", "-", "-", "-"], ["-", "-", "-", "A"], ["-", "B", "A", "-"]]

What I have tried so far

class Test
  def initialize
    @multi = 4.times.map { 4.times.map { '-' } }
  end

  def assign_values array, new_value
    array.each { |element|
      @multi[element[0]][element[1]] = new_value
    }
  end

  def result
    @multi
  end
end

Alpha_array = [[0,1], [2,3], [3,2]]
Beta_array = [[0,3], [3,1], [1,0]]

test = Test.new
test.assign_values(Alpha_array, 'A')
test.assign_values(Beta_array, 'B')

test.result

Output:

# => [["-", "A", "-", "B"], ["-B", "-", "-", "-"], ["-", "-", "-", "A"], ["-", "B", "A", "-"]]

Is there an elegant and efficient way to get the outuput ?

Body:
class Test
  attr_reader :result

  def initialize(dim1, dim2)
    @result = Array.new(dim1) { Array.new(dim2, '-') }
  end

  def assign_values(array, new_value)
    array.each { |i,j| @result[i][j] = new_value }
  end
end

test = Test.new(4,4)
test.assign_values([[0,1], [2,3], [3,2]], 'A')
test.assign_values([[0,3], [3,1], [1,0]], 'B')
test.result
  #=> [["-", "A", "-", "B"],
  #    ["B", "-", "-", "-"],
  #    ["-", "-", "-", "A"],
  #    ["-", "B", "A", "-"]]

See Array::new.


问:
Is it possible to pass a JS callback through JSON?
I realise I can not pass a function object via JSON, is there another way to pass a callback function via JSON?

```<code>window.onpopstate = function(e) {
    var state = e.state;

    switch(state['method']) {
        case 'updateFields':
            updateFields(state);
        break;
    }
}
</code>```

Where state is structured something like this:

```<code>{'method':'updateFields', ...}
</code>```

And I wish to remove the switch case and instead directly call the function, similar to this:

```<code>window.onpopstate = function(e) {
    var state = e.state;

    state['method'](state);
}
</code>```

I do not know how to make it work though.

答:
You're on the right track; the main thing you need to change is to make all of your methods part of an object. Then you can use the method name to access the method directly from that object:</p>

```<code>var methods = {
    updateFields: function( state ) {
        // do something with state
    },
    anotherMethod: function( state ) {
        // etc.
    }
};

window.onpopstate = function( e ) {
    var state = e.state;
    var method = methods[state.method];
    if( method ) {
        method( state );
    } else {
        console.log( "Unknown method", state.method );
    }
};
</code>```

Body:
I realise I can not pass a function object via JSON, is there another way to pass a callback function via JSON?

window.onpopstate = function(e) {
    var state = e.state;

    switch(state['method']) {
        case 'updateFields':
            updateFields(state);
        break;
    }
}

Where state is structured something like this:

{'method':'updateFields', ...}

And I wish to remove the switch case and instead directly call the function, similar to this:

window.onpopstate = function(e) {
    var state = e.state;

    state['method'](state);
}

I do not know how to make it work though.

Body:
You're on the right track; the main thing you need to change is to make all of your methods part of an object. Then you can use the method name to access the method directly from that object:

var methods = {
    updateFields: function( state ) {
        // do something with state
    },
    anotherMethod: function( state ) {
        // etc.
    }
};

window.onpopstate = function( e ) {
    var state = e.state;
    var method = methods[state.method];
    if( method ) {
        method( state );
    } else {
        console.log( "Unknown method", state.method );
    }
};


问:
angular animation not working on production build (skips to final state without actually animating)
I have an animation, which works fine on stackblizt (https://stackblitz.com/edit/burger?file=app%2Fburger%2Fburger.component.ts) as well as locally with ng serve --aot, but it seems to be skipping straight to the final state on production build (ng build --prod) http://burger.fxck.cz/

Can you stop something in the code that might be causing it?

```<code>import {
  trigger,
  state,
  style,
  animate,
  transition
} from '@angular/animations';

export const EASING = 'cubic-bezier(0.5, 0.5, 0.76, 0.76)';

export function burgerLineAnimation(name: string, translateY = '15px', rotateFinal = '45deg', rotateOver = '65deg') {
  return trigger(name, [
    // opened state, in center, rotated, expanded
    state('true', style({
      transform: `translateY(${translateY}) translateX(17.5px) rotate(${rotateFinal})`,
      width: '40px'
    })),

    transition('false => true', [
      // move to center
      animate(`100ms ${EASING}`, style({
        transform: `translateY(${translateY})`
      })),
      // expand from dot to line
      animate(`100ms ${EASING}`, style({
        width: '40px',
        transform: `translateY(${translateY}) translateX(17.5px)`
      })),
      // rotate over
      animate(`80ms ${EASING}`, style({
        transform: `translateY(${translateY}) translateX(17.5px) rotate(${rotateOver})`
      })),
      // rotate final
      animate(`150ms ${EASING}`, style({
        transform: `translateY(${translateY}) translateX(17.5px) rotate(${rotateFinal})`
      }))
    ]),

    transition('true => false', [
      // level and shrink
      animate(`100ms ${EASING}`, style({
        transform: `translateY(${translateY}) translateX(0) rotate(0deg)`,
        width: '5px'
      })),
      // move to proper position
      animate(`100ms ${EASING}`, style({
        transform: 'translateY(0)'
      }))
    ])
  ]);
}
</code>```

used like this in the component decorator

```<code>  animations: [
    burgerLineAnimation('firstLine'),
    burgerLineAnimation('thirdLine', '-15px', '-45deg', '-60deg')
  ]
</code>```

答:
So the problem is certainly not with me using a function to return the trigger, nor with params being passed down by the function. The problem is with using booleans for states, if I use string instead (ie. open, closed instead of true and false). It will work fine. And let me repeat one more time, this only happens in production build, so something is perhaps being removed / stripped while it shouldn't.

I have reported the issue here and will update the answer once it gets resolved.

Body:
I have an animation, which works fine on stackblizt (https://stackblitz.com/edit/burger?file=app%2Fburger%2Fburger.component.ts) as well as locally with ng serve --aot, but it seems to be skipping straight to the final state on production build (ng build --prod) http://burger.fxck.cz/

Can you stop something in the code that might be causing it?

import {
  trigger,
  state,
  style,
  animate,
  transition
} from '@angular/animations';

export const EASING = 'cubic-bezier(0.5, 0.5, 0.76, 0.76)';

export function burgerLineAnimation(name: string, translateY = '15px', rotateFinal = '45deg', rotateOver = '65deg') {
  return trigger(name, [
    // opened state, in center, rotated, expanded
    state('true', style({
      transform: `translateY(${translateY}) translateX(17.5px) rotate(${rotateFinal})`,
      width: '40px'
    })),

    transition('false => true', [
      // move to center
      animate(`100ms ${EASING}`, style({
        transform: `translateY(${translateY})`
      })),
      // expand from dot to line
      animate(`100ms ${EASING}`, style({
        width: '40px',
        transform: `translateY(${translateY}) translateX(17.5px)`
      })),
      // rotate over
      animate(`80ms ${EASING}`, style({
        transform: `translateY(${translateY}) translateX(17.5px) rotate(${rotateOver})`
      })),
      // rotate final
      animate(`150ms ${EASING}`, style({
        transform: `translateY(${translateY}) translateX(17.5px) rotate(${rotateFinal})`
      }))
    ]),

    transition('true => false', [
      // level and shrink
      animate(`100ms ${EASING}`, style({
        transform: `translateY(${translateY}) translateX(0) rotate(0deg)`,
        width: '5px'
      })),
      // move to proper position
      animate(`100ms ${EASING}`, style({
        transform: 'translateY(0)'
      }))
    ])
  ]);
}

used like this in the component decorator

  animations: [
    burgerLineAnimation('firstLine'),
    burgerLineAnimation('thirdLine', '-15px', '-45deg', '-60deg')
  ]


问:
Print size of type :C
I want to print

"Size of (type) is (size of type) Byte"

 for example

"Size of int is 4Byte"

 by the code below.But it says that

"Size of int is 8Byte"

I think this code showed the size of string(int) but the type int.
How can I solve this problem?

code

```<code>#include <stdio.h>
char *variabletype[] = {"char", "unsigned char", "signed char", "int", "unsigned int", "short", "unsigned short", "long", "unsigned long", "long long", "unsigned long long"};

int main() {
    for (int i = 0; i < 11;++i) {
        printf("Size of %s is %u\n",variabletype[i], (unsigned int)(sizeof(variabletype[i])));
    }
    return 0;
}
</code>```

return

```<code>Size of char is 8Byte
Size of unsigned char is 8Byte
Size of signed char is 8Byte
Size of int is 8Byte
Size of unsigned int is 8Byte
Size of short is 8Byte
Size of unsigned short is 8Byte
Size of long is 8Byte
Size of unsigned long is 8Byte
Size of long long is 8Byte
Size of unsigned long long is 8Byte
</code>```

答:
I tried your code and found out that if you are using a 64-bit system it shows 8 byte and on a 32-bit system it will show 4 Byte

If you use Visual studios just change the debug settings(i think?) from x64 to x86(32-bit)
that should give you your result.

NOTE: i am a really bloody beginner on C and thought this could help... although i don't really know why it is double the size on a 64-bit system^^".

Title: Print size of type :C

Body:
I want to print

"Size of (type) is (size of type) Byte"

 for example

"Size of int is 4Byte"

 by the code below.But it says that

"Size of int is 8Byte"

I think this code showed the size of string(int) but the type int.
How can I solve this problem?

code

#include <stdio.h>
char *variabletype[] = {"char", "unsigned char", "signed char", "int", "unsigned int", "short", "unsigned short", "long", "unsigned long", "long long", "unsigned long long"};

int main() {
    for (int i = 0; i < 11;++i) {
        printf("Size of %s is %u\n",variabletype[i], (unsigned int)(sizeof(variabletype[i])));
    }
    return 0;
}

return

Size of char is 8Byte
Size of unsigned char is 8Byte
Size of signed char is 8Byte
Size of int is 8Byte
Size of unsigned int is 8Byte
Size of short is 8Byte
Size of unsigned short is 8Byte
Size of long is 8Byte
Size of unsigned long is 8Byte
Size of long long is 8Byte
Size of unsigned long long is 8Byte


问:
C++ STL map/vector of vectors and thread safety
I was wondering whether following code would be considered thread-safe. I think it should be, but am not too familiar with what goes on under the hood.

Basically, I have this function in class Foo that will be called on the main thread and takes a vector as an anrgument, ie,

```<code>void Foo::func( vector<int> v)
</code>```

In Foo, I also have a private member,

```<code>vector< vector<int> > vecOfVec;
</code>```

Within func, I'll simply push back any new v onto vecOfVec and check for v 's size. If v is smaller than its expected size, I'd like to kick off another thread that fills up v with some known, predetermined values, like so

```<code>void Foo::func( vector<int> v)
{
    int size = v.size();
    int index = vecOfVec.size();

    vecOfVec.push_back(v);

    if (size < 1000)
    {
        boost::thread t( boost::bind( &Foo::PushBackZeros, this, vecOfVec, index) );
    }
}
</code>```

Foo::PushBackZeros would, as its name suggests simply fill up the vector at 'vecOfVec[index]' with zeros until its size grows to 1000;

Now, I don't see any concurrent read or write operations here on any of the elements of vecOfVec. Obviously, there is a chance of concurrent operations on the entire object, but there will never be concurrencies on a particular element of vecOfVec.

Could someone explain as to whether the above would be considered thread-safe? Would the same extent to STL maps also? If not, please explain. Cheers!

答:
vecOfVec is being passed by value because boost::bind requires you to put a boost::ref around a reference parameter.

So likely thread-safe but not doing what you think it is.

I am not sure why you need to pass that parameter in, as it is already in "this".

To answer the original question though for what you want to do:

If vecOfVecs may be resized then any of its members could be invalidated so it would not be thread-safe.

Pushing members into one of the inner vectors will not invalidate any other member vectors, so you could have different threads populating different vector members at the same time as long as they are all already there.

If you "reserve" ahead then you can push_back more members into your vector until that capacity is reached and it won't invalidate existing members.

Body:
I was wondering whether following code would be considered thread-safe. I think it should be, but am not too familiar with what goes on under the hood.

Basically, I have this function in class Foo that will be called on the main thread and takes a vector as an anrgument, ie,

void Foo::func( vector<int> v)

In Foo, I also have a private member,

vector< vector<int> > vecOfVec;

Within func, I'll simply push back any new v onto vecOfVec and check for v 's size. If v is smaller than its expected size, I'd like to kick off another thread that fills up v with some known, predetermined values, like so

void Foo::func( vector<int> v)
{
    int size = v.size();
    int index = vecOfVec.size();

    vecOfVec.push_back(v);

    if (size < 1000)
    {
        boost::thread t( boost::bind( &Foo::PushBackZeros, this, vecOfVec, index) );
    }
}

Foo::PushBackZeros would, as its name suggests simply fill up the vector at 'vecOfVec[index]' with zeros until its size grows to 1000;

Now, I don't see any concurrent read or write operations here on any of the elements of vecOfVec. Obviously, there is a chance of concurrent operations on the entire object, but there will never be concurrencies on a particular element of vecOfVec.

Could someone explain as to whether the above would be considered thread-safe? Would the same extent to STL maps also? If not, please explain. Cheers!


问:
Is there a way of detecting whether or not the softkeyboard is open in Android?
My app is meant to collect data. But it is only necessary for it to collect the data while the keyboard is visible.
It is not sufficient to only collect data while the user is typing, so I definitely need to know if the keyboard is visible or not.

I know, similar questions were posted before
  (How to check visibility of software keyboard in Android?),
  but the last answer with a serious number of upvotes is from 2012, and
  I guess a lot of things happened with Android since then.

So, can I detect if the keyboard is open/visible?

答: I faced the same problem earlier. After a lot of trial and error and following other people suggestion, I came up with my implementation that works well for me. Here is the link.</p>


问:
How can I open a external App from my React-Native App in IOS?
I am trying to open for example, What'sApp from my own React-Native App. I have reach to do this in Android with react-native-send-intent (SendIntentAndroid) but it only works in Android. I would like to do the same in IOS. Linking does not work for me and I don't know why. </p>

答: Finally, in IOS is Linking.openUR("whatsapp://app") The word APP was what I was looking for.</p>


问:
I want to use bool on button, if i click on button image of imageview changed and if again click on button then image reverse using Swift
my code is:
func PickUpCarCost() {

```<code>        imgCheck.image = UIImage(named: "uncheck.png")
        imgUnCheck.image = UIImage(named: "uncheck.png")
        if CarPickUpButton?.tag == 1 {
            imgCheck.image = UIImage(named: "check.png")
           self.pickupChargelabel.text=self.PickUpFare.text!
        }
        else {
            imgUnCheck.image = UIImage(named: "uncheck.png")

        }

}
</code>```

in this i wants take bool like if button selectes image view image will be check.png if unselect image view image will be uncheck.png how to code for this in swift.

答:
Add UITapGestureRecognizer on your button like this. or you can use UIButton own property isSelected ?

```<code>@IBOutlet weak var myBtn: UIButton!
</code>```

In your Viewdidload method add these line

```<code>let tapGesture = UITapGestureRecognizer(target: self, action: "handleTap")

myBtn.addGestureRecognizer(tapGesture)

func handleTap(sender: UITapGestureRecognizer) {

  if sender.state == .ended {
      // handling code
  }
  else if sender.state == .began {

  }
}
</code>```

Add gesture according to your needs.I used long tap and tap gesture

Body:
my code is:
func PickUpCarCost() {

        imgCheck.image = UIImage(named: "uncheck.png")
        imgUnCheck.image = UIImage(named: "uncheck.png")
        if CarPickUpButton?.tag == 1 {
            imgCheck.image = UIImage(named: "check.png")
           self.pickupChargelabel.text=self.PickUpFare.text!
        }
        else {
            imgUnCheck.image = UIImage(named: "uncheck.png")

        }

}

in this i wants take bool like if button selectes image view image will be check.png if unselect image view image will be uncheck.png how to code for this in swift.

Body:
Add UITapGestureRecognizer on your button like this. or you can use UIButton own property isSelected ?

@IBOutlet weak var myBtn: UIButton!

In your Viewdidload method add these line

let tapGesture = UITapGestureRecognizer(target: self, action: "handleTap")

myBtn.addGestureRecognizer(tapGesture)

func handleTap(sender: UITapGestureRecognizer) {

  if sender.state == .ended {
      // handling code
  }
  else if sender.state == .began {

  }
}

Add gesture according to your needs.I used long tap and tap gesture


问:
Google Api Key doesn't work
I took an api key from Google for to use Google Maps for my android app. Yesterday it was working like charm but today i got an error when trying to load map. I opened logcat and it said

Failed to find provider info for com.google.settings

Can anyone tell me how to fix this problem?

EDIT: My real issue is not because of that. That's because i got nullpointer exception error.

```<code>01-18 17:38:18.174: ERROR/AndroidRuntime(1348): Caused by: java.lang.NullPointerException
01-18 17:38:18.174: ERROR/AndroidRuntime(1348):     at com.android.listxml.MyMap.onCreate(Map.java:69)
</code>```

At this 69th line i have this code:

```<code>View zoomView = mapView.getZoomControls();
</code>```

答:
Can you please post the error you're getting, as the "Failed to find provider info..." is not related to this issue. Also, what changes were done recently that made it stopped working ?

Are you seening a stacktrace in logcat, or are you just seeing an empty map (no tiles being loaded) ?

You should double-check the following requirements for displaying maps in your Activity :

A MapView component needs to be added
to the layout that you're inflating in your Activity, and it should contain a valid
Google Maps API key

The Google Maps API key is linked to your SDK keystore. If you change the keystore, your API key will no longer be valid.

The Activity that
will be responsible for showing the
map needs to extend from MapActivity

The application manifest needs to be
setup with the
android.permission.INTERNET
permission

The application manifest
needs to be setup with the
com.google.android.maps library

The application needs to run on an emulator with a target that includes the Google APIs

Some basic info is available in the android sdk docs.

The nullpointer exception can only be caused by the fact that mapView is null.
Assuming your code contains something like this :

```<code>setContentView(R.layout.main);
mapView = (MapView) findViewById(R.id.mapview1);
</code>```

Double check that the layout you're inflating (main.xml in this case), contains a MapView component with id mapview1, like the snippet below :

```<code><com.google.android.maps.MapView
    android:id="@+id/mapview1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:enabled="true"
    android:clickable="true"
    android:apiKey="your api key here" />
</code>```

Title: Google Api Key doesn't work

Body:
I took an api key from Google for to use Google Maps for my android app. Yesterday it was working like charm but today i got an error when trying to load map. I opened logcat and it said

Failed to find provider info for com.google.settings

Can anyone tell me how to fix this problem?

EDIT: My real issue is not because of that. That's because i got nullpointer exception error.

01-18 17:38:18.174: ERROR/AndroidRuntime(1348): Caused by: java.lang.NullPointerException
01-18 17:38:18.174: ERROR/AndroidRuntime(1348):     at com.android.listxml.MyMap.onCreate(Map.java:69)

At this 69th line i have this code:

View zoomView = mapView.getZoomControls();

Body:
Can you please post the error you're getting, as the "Failed to find provider info..." is not related to this issue. Also, what changes were done recently that made it stopped working ?

Are you seening a stacktrace in logcat, or are you just seeing an empty map (no tiles being loaded) ?

You should double-check the following requirements for displaying maps in your Activity :

A MapView component needs to be added
to the layout that you're inflating in your Activity, and it should contain a valid
Google Maps API key

The Google Maps API key is linked to your SDK keystore. If you change the keystore, your API key will no longer be valid.

The Activity that
will be responsible for showing the
map needs to extend from MapActivity

The application manifest needs to be
setup with the
android.permission.INTERNET
permission

The application manifest
needs to be setup with the
com.google.android.maps library

The application needs to run on an emulator with a target that includes the Google APIs

Some basic info is available in the android sdk docs.

The nullpointer exception can only be caused by the fact that mapView is null.
Assuming your code contains something like this :

setContentView(R.layout.main);
mapView = (MapView) findViewById(R.id.mapview1);

Double check that the layout you're inflating (main.xml in this case), contains a MapView component with id mapview1, like the snippet below :

<com.google.android.maps.MapView
    android:id="@+id/mapview1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:enabled="true"
    android:clickable="true"
    android:apiKey="your api key here" />


问:
How to retrieve the lastest file stored on local disk in UWP
I am trying to retrieve the latest file that is stored in my picture library in my UWP application. I know how to retrieve the file by name... however, I would like the retrieve it by the date/time, which is the latest file.

How can I change the following codes?

```<code>StorageFolder picturesFolder = KnownFolders.PicturesLibrary;
string name = "Photo.jpg";
var manifestFile = await picturesFolder.GetFileAsync(name);
</code>```

答:
You need to access GetBasicPropertiesAsync method for different properties

In your case, DateModified

```<code>var files = await folder.GetFilesAsync();
StorageFile lastModifiedFile = null;
DateTimeOffset lastDate = DateTimeOffset.MinValue;
foreach(var file in files)
{
    var basicProperties = await file.GetBasicPropertiesAsync();
    var date = basicProperties.DateModified;
    if(date > lastDate)
    {
      lastDate = date;
      lastModifiedFile = file;
    }
}
</code>```

lastModifiedFile is one you need now.

Body:
I am trying to retrieve the latest file that is stored in my picture library in my UWP application. I know how to retrieve the file by name... however, I would like the retrieve it by the date/time, which is the latest file.

How can I change the following codes?

StorageFolder picturesFolder = KnownFolders.PicturesLibrary;
string name = "Photo.jpg";
var manifestFile = await picturesFolder.GetFileAsync(name);

Body:
You need to access GetBasicPropertiesAsync method for different properties

In your case, DateModified

var files = await folder.GetFilesAsync();
StorageFile lastModifiedFile = null;
DateTimeOffset lastDate = DateTimeOffset.MinValue;
foreach(var file in files)
{
    var basicProperties = await file.GetBasicPropertiesAsync();
    var date = basicProperties.DateModified;
    if(date > lastDate)
    {
      lastDate = date;
      lastModifiedFile = file;
    }
}

lastModifiedFile is one you need now.


问:
Smallest range of substring in string
I have a string S (with words indexed from 0) and a substring Q. I wish to find the smallest range [L, R] in S which contains all words in Q. There are no duplicate words in Q. How do I approach this ?

For example,

Input:
S: what about the lazy brown fox that jumped over the other brown one which lazy dog ate the food of the fox
Q: lazy brown dog

Output: [11,15]

My code:

```<code>S = raw_input().strip().split(' ')
Q = raw_input().strip().split(' ')

count = [0 for x in range(len(Q))]
smallest_index = [0 for x in range(len(Q))]
largest_index = [0 for x in range(len(Q))]

for i in range(len(S)):
    for j in range(len(Q)):
        if S[i] == Q[j]:
            count[j] += 1
            if count[j] <= 1:
                smallest_index[j] = i
                largest_index[j] = i
            if count[j] > 1:
                largest_index[j] = i

largest_index.sort()
print "[%d," % largest_index[0],
print "%d]" % largest_index[len(Q)-1]
</code>```

答:
Here is another approach based on @PM 2Ring answer:

```<code>S ='what about the lazy brown fox that jumped over the other brown one which lazy dog ate the food of the fox'
Q ='lazy brown dog'

import itertools
track={}

for index,value in enumerate(S.split()):

    if value in Q:
        if value not in track:
            track[value]=[index]
        else:
            track[value].append(index)

combination = [(min(item),max(item)) for item in itertools.product(*track.values())]

result=min([(i[1]-i[0],(i[0],i[1])) for i in combination if set(Q.split()).issubset(S.split()[i[0]:i[1]+1])])
print(result[1])
</code>```

output:

```<code>(11, 15)
</code>```

Title: Smallest range of substring in string

Body:
I have a string S (with words indexed from 0) and a substring Q. I wish to find the smallest range [L, R] in S which contains all words in Q. There are no duplicate words in Q. How do I approach this ?

For example,

Input:
S: what about the lazy brown fox that jumped over the other brown one which lazy dog ate the food of the fox
Q: lazy brown dog

Output: [11,15]

My code:

S = raw_input().strip().split(' ')
Q = raw_input().strip().split(' ')

count = [0 for x in range(len(Q))]
smallest_index = [0 for x in range(len(Q))]
largest_index = [0 for x in range(len(Q))]

for i in range(len(S)):
    for j in range(len(Q)):
        if S[i] == Q[j]:
            count[j] += 1
            if count[j] <= 1:
                smallest_index[j] = i
                largest_index[j] = i
            if count[j] > 1:
                largest_index[j] = i

largest_index.sort()
print "[%d," % largest_index[0],
print "%d]" % largest_index[len(Q)-1]

Body:
Here is another approach based on @PM 2Ring answer:

S ='what about the lazy brown fox that jumped over the other brown one which lazy dog ate the food of the fox'
Q ='lazy brown dog'

import itertools
track={}

for index,value in enumerate(S.split()):

    if value in Q:
        if value not in track:
            track[value]=[index]
        else:
            track[value].append(index)

combination = [(min(item),max(item)) for item in itertools.product(*track.values())]

result=min([(i[1]-i[0],(i[0],i[1])) for i in combination if set(Q.split()).issubset(S.split()[i[0]:i[1]+1])])
print(result[1])

output:

(11, 15)


问:
get assembly code generated by JavaScript compiler
I am using v8 / Node 8.8 with Ignition and Turbofan and tried to get the assembly code that is generated by my JavaScript but so far the asm and code outputs are same in the size independent of actual code differences.

So node --trace-hydrogen --trace_phase=Z --trace_deopt --code_comments --hydroge
n_track_positions --redirect_code_traces --trace_hydrogen_file=test.js --print_
code test.js seems to only output the code of the compiler itself, not the code behind the processed JS code.

What are the needed flags for Ignition / Turbofan?

答:
Ignition, being an interpreter, does not produce assembly code.

For Turbofan, the flag is --print-opt-code.


问:
iconv() – how to detect offending character?
I use iconv() to convert CSV data from UTF-8 to Windows-1252.

```<code>$converted = iconv("UTF-8", "Windows-1252", $csvData);
</code>```

In some cases, iconv() failed quietly, returning false.

I also tried using //TRANSLIT but `iconv()´ returns false here as well.

When i add the //IGNORE statement to the target charset, the conversion succeeds, but that means one or more character(s) got lost.

I can stick to //IGNORE but i would like to find out which character(s) are causing the problem.

How can i do this?

答:
It was bad idea to work with string as char array (see question comments) because php string type

Internally, PHP strings are byte arrays. As a result, accessing or modifying a string using array brackets is not multi-byte safe, and should only be done with strings that are in a single-byte encoding such as ISO-8859-1.

So we can use mb_substr for utf-8 and work with symbols not bytes

```<code>error_reporting('E_ALL & !E_NOTICE');
$yourString = "test bad ☺ string";
$convertString = '';
$badChars = [];

if (iconv("UTF-8", "Windows-1252", $yourString) === false) {
    for($i = 0, $stringLength = mb_strlen($yourString); $i < $stringLength; $i++) {
        $char = mb_substr($yourString, $i, 1);
        $convertChar = iconv("UTF-8", "Windows-1252", $char);

        if ($convertChar === false) {
            $badChars[$i] = $char;
        } else {
            $convertString .= $convertChar;
        }
    }
} else {
    $convertString = iconv("UTF-8", "Windows-1252", $yourString);
}

var_dump($badChars, $convertString);
</code>```

Result array(1) { [9]=> string(3) "☺" } string(16) "test bad string"

P.S. The next time I will give a more detailed answer with the code. My mistake

Body:
I use iconv() to convert CSV data from UTF-8 to Windows-1252.

$converted = iconv("UTF-8", "Windows-1252", $csvData);

In some cases, iconv() failed quietly, returning false.

I also tried using //TRANSLIT but `iconv()´ returns false here as well.

When i add the //IGNORE statement to the target charset, the conversion succeeds, but that means one or more character(s) got lost.

I can stick to //IGNORE but i would like to find out which character(s) are causing the problem.

How can i do this?

Body:
It was bad idea to work with string as char array (see question comments) because php string type

Internally, PHP strings are byte arrays. As a result, accessing or modifying a string using array brackets is not multi-byte safe, and should only be done with strings that are in a single-byte encoding such as ISO-8859-1.

So we can use mb_substr for utf-8 and work with symbols not bytes

error_reporting('E_ALL & !E_NOTICE');
$yourString = "test bad ☺ string";
$convertString = '';
$badChars = [];

if (iconv("UTF-8", "Windows-1252", $yourString) === false) {
    for($i = 0, $stringLength = mb_strlen($yourString); $i < $stringLength; $i++) {
        $char = mb_substr($yourString, $i, 1);
        $convertChar = iconv("UTF-8", "Windows-1252", $char);

        if ($convertChar === false) {
            $badChars[$i] = $char;
        } else {
            $convertString .= $convertChar;
        }
    }
} else {
    $convertString = iconv("UTF-8", "Windows-1252", $yourString);
}

var_dump($badChars, $convertString);

Result array(1) { [9]=> string(3) "☺" } string(16) "test bad string"

P.S. The next time I will give a more detailed answer with the code. My mistake


问:
Sending data of input text and hidden field to controller name dosavenews in spring jsp
I need to send the data of input text to my controller with other data, I don't know how to get the text from input text and send to controller, help me

```<code><!-- Modal content-->
<div class="modal-content">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">×</button>
        <h4 class="modal-title">Save news</h4>
    </div>
    <div class="modal-body">

        <%
            String link = request.getParameter("link");
         %>

        <input type="text" placeholder="Please enter news heading" name="NewsName" id="a1"/>
        <input type="hidden" value="<%=link %>" name="link"/>
        <input type="hidden" value="1" name="id"/>
        <label><%=link %></label>
    </div>
    <div class="modal-footer">
        <form method="post" action="doSaveNews?NewsName1=<%=NewsName %>">
            <button type="submit" class="btn btn-default" data-dismiss="modal">Save</button>
            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </form>
    </div>
</div>
</code>```

error:

NewsName cannot be resolved to a variable.

答:
```<code><form method="post" action="doSaveNews?NewsName1=<%=NewsName %>">
</code>```

<%=NewsName %>

you are trying to submit the url using a variable called "NewsName" it is supposed to be a Java object because it is inside the scriptlet tag.

What you need to do is.

Get the value of the input element in javascript.

Write a "onSubmit"
method in javascript, serialize the form & then form your url in
javascript, submit the form.

This link might help serializing and submitting a form with jQuery POST and php

Body:
I need to send the data of input text to my controller with other data, I don't know how to get the text from input text and send to controller, help me

        <button type="button" class="close" data-dismiss="modal">×</button>

Save news

        <%
            String link = request.getParameter("link");
         %>

        <input type="text" placeholder="Please enter news heading" name="NewsName" id="a1"/>
        <input type="hidden" value="<%=link %>" name="link"/>
        <input type="hidden" value="1" name="id"/>
        <%=link %>

        <form method="post" action="doSaveNews?NewsName1=<%=NewsName %>">
            <button type="submit" class="btn btn-default" data-dismiss="modal">Save</button>
            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </form>

error:

NewsName cannot be resolved to a variable.

Body:
<form method="post" action="doSaveNews?NewsName1=<%=NewsName %>">

<%=NewsName %>

you are trying to submit the url using a variable called "NewsName" it is supposed to be a Java object because it is inside the scriptlet tag.

What you need to do is.

Get the value of the input element in javascript.

Write a "onSubmit"
method in javascript, serialize the form & then form your url in
javascript, submit the form.

This link might help serializing and submitting a form with jQuery POST and php


问:
Execute code just before onComplete() in RxJava 2?
I need to close socket connection in my observable before RxLifecycle dispose it. How can I do that?

答:
if you want to do an action after all, just before the subscriber unsubscribe from the observable you can use operator doOnUnsubscribe

```<code>@Test
public void testDoOnUnsubscribe() {
    Integer[] numbers = {0, 1, 2, 3, 4};
    Observable.from(numbers)
            .doOnUnsubscribe(() -> System.out.println("Last action must be done here"))
            .subscribe(number -> System.out.println("number:" + number),
                    System.out::println,
                    () -> System.out.println("End of pipeline"));
}
</code>```

It should print in this order

```<code>number:0
number:1
number:2
number:3
number:4
End of pipeline
Last action must be done here
</code>```

Body:
if you want to do an action after all, just before the subscriber unsubscribe from the observable you can use operator doOnUnsubscribe

@Test
public void testDoOnUnsubscribe() {
    Integer[] numbers = {0, 1, 2, 3, 4};
    Observable.from(numbers)
            .doOnUnsubscribe(() -> System.out.println("Last action must be done here"))
            .subscribe(number -> System.out.println("number:" + number),
                    System.out::println,
                    () -> System.out.println("End of pipeline"));
}

It should print in this order

number:0
number:1
number:2
number:3
number:4
End of pipeline
Last action must be done here