예제 #1
0
        internal LambdaCallCounterCdkStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
        {
            var myLambdaFunc = new Function(this, "MyFuncHandler", new FunctionProps
            {
                Runtime = Runtime.NODEJS_10_X,
                Code = Code.FromAsset("lambda"),
                Handler = "hello.handler"
            });

            var myLambdaFuncWithCouner = new HitCounter(this, "MyFuncHandlerHitCounter", new HitCounterProps
            {
                Downstream = myLambdaFunc
            });

            new LambdaRestApi(this, "myLambdaRestApi", new LambdaRestApiProps
            {
                // Handler = myLambdaFunc
                Handler = myLambdaFuncWithCouner.Handler
            });
        }
예제 #2
0
파일: Home.aspx.cs 프로젝트: Near922/Main
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Cache.SetExpires(DateTime.Now.AddYears(1));
        HtmlGenericControl hlHome = Master.FindControl("hlHome") as HtmlGenericControl;

        hlHome.Style["display"] = "none";

        HtmlGenericControl hlContact = Master.FindControl("hlContact") as HtmlGenericControl;

        hlContact.Style["display"] = "block";

        HtmlGenericControl hlPortfolio = Master.FindControl("hlPortfolio") as HtmlGenericControl;

        hlPortfolio.Style["display"] = "block";

        HtmlGenericControl hlExperience = Master.FindControl("hlExperience") as HtmlGenericControl;

        hlExperience.Style["display"] = "block";

        HtmlGenericControl hlAbout = Master.FindControl("hlAbout") as HtmlGenericControl;

        hlAbout.Style["display"] = "block";

        HtmlGenericControl hlSkills = Master.FindControl("hlSkills") as HtmlGenericControl;

        hlSkills.Style["display"] = "block";

        if (!IsPostBack)
        {
            if (Session["Count"] == null)
            {
                HitCounter hc = new HitCounter();
                hc.IPAddress = Request.UserHostAddress;
                hc.VisitDate = DateTime.Now;
                hc.AddCount();
                Session["Count"] = hc.Count;
                hc = null;
            }
        }
    }
예제 #3
0
        public void TestHitCounter3()
        {
            var hitCounter = new HitCounter();

            // 1 - 100
            hitCounter.Hit(100);

            // 2 - 100, 282
            hitCounter.Hit(282);

            // 2 - 282, 411
            hitCounter.Hit(411);

            // 2 - 411, 609
            hitCounter.Hit(609);

            // 3 - 411, 609, 620
            hitCounter.Hit(620);

            // 3 - 609, 620, 744
            hitCounter.Hit(744);

            // count hits 609, 620, 744 with total = 3.
            Assert.Equal <int>(3, hitCounter.GetHits(879));

            // 2 - 744, 956
            hitCounter.Hit(956);

            // count hits 744, 956 with total = 2.
            Assert.Equal <int>(2, hitCounter.GetHits(976));

            // 3 - 744, 956, 998
            hitCounter.Hit(998);

            // count hits 956, 998, with total = 2
            Assert.Equal <int>(2, hitCounter.GetHits(1055));
        }
예제 #4
0
        public HitCounter GetHitCounter()
        {
            HitCounter hitcounter = null;

            using (SqlConnection connection = GetConnection())
            {
                SqlCommand command = new SqlCommand("_HitCounterGet", connection);
                command.CommandType = CommandType.StoredProcedure;
                connection.Open();
                using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    if (reader.Read())
                    {
                        hitcounter = HitCounterReader(reader);
                    }
                    else
                    {
                        throw new DataAccessException("khong tim thay gia tri hitcoutter nao");
                    }
                    command.Dispose();
                }
            }
            return(hitcounter);
        }
예제 #5
0
 public void BucketsAreCreatedWithDefaultCompactionTicks()
 {
     this.InitializeDataSet(null);
     var timeStamp = DateTime.Now;
     var hitCounter = new HitCounter(this.dataSet);
     hitCounter.Increment(3, this.dimensions, timeStamp);
     var bucket = this.dataSet.GetDataBucket(timeStamp.ToUniversalTime());
     Assert.AreEqual(bucket.EndTicks - bucket.StartTicks, this.customCompaction.DefaultBucketTicks);
 }
 private void WriteHitCount(HitCounter c, DateTime ts, DimensionSpecification spec, long value)
 {
     c.Increment(value, spec, ts);
 }
예제 #7
0
        public void WhenTotalCountIsZeroRatioReturnsZero()
        {
            HitCounter counter = new HitCounter();

            counter.HitRatio.Should().Be(0.0);
        }
예제 #8
0
 void Start()
 {
     //Creates a reference to the Ammo Object's HitCount script
     scriptLink1 = GameObject.FindGameObjectWithTag("Ammo").GetComponent <HitCounter>();
     scriptLink2 = GameObject.FindGameObjectWithTag("Ammo2").GetComponent <HitCounter3>();
 }
예제 #9
0
 public void HitsShouldBeCorrect()
 {
     var result = new HitCounter(@"D:\dev\Phillip Buttrose\Guitars\deploy\logs\svc17230_ex1403.log", 4, 3, ' ').Calculate().SiteHits;
 }