Esempio n. 1
0
        static void ShowCounterOrder(string cf, int limit)
        {
            Utility.Logging("ShowCounterOrder CF:" + cf + " limit:" + limit, Utility.DebugLevel.Info);
            var ar = new Dictionary <string, long>();
            var re = ThriftTool.GetAllFromCF(cf, limit);

            Utility.Logging("org count:" + re.Count, Utility.DebugLevel.Info);

            foreach (var ks in re)
            {
                foreach (var keySlice in ks.Columns)
                {
                    if (ThriftTool.ToString(keySlice.Counter_column.Name) != "sum")
                    {
                        continue;
                    }
                    var key = ThriftTool.ToString(ks.Key);
                    var val = keySlice.Counter_column.Value;
                    ar.Add(key, val);
                }
            }

            var res = from pair in ar orderby pair.Value descending select pair;

            foreach (var r in res.Take(500))
            {
                Console.WriteLine("key:" + r.Key + "\tvalue:" + r.Value);
            }
            Utility.Logging("end", Utility.DebugLevel.Info);
        }
Esempio n. 2
0
        static void PraseNnN()
        {
            var count = 0;
            //Utility.Logging("Calculating N vs N from: " + count, Utility.DebugLevel.Info);
            //var re = ThriftTool.GetAllFromCF("M01UserRelaction", 120000);
            var re = ThriftTool.GetAllFromCF("M01UserRelaction", 100);

            foreach (var node in re)
            {
                if (count % 1000 == 0)
                {
                    Utility.Logging("Calculating N vs N from: " + count, Utility.DebugLevel.Info);
                }
                var key = ThriftTool.ToString(node.Key);
                Utility.Logging("Key= " + key, Utility.DebugLevel.Info);

                foreach (var keySlice in node.Columns)
                {
                    var columnName = ThriftTool.ToString(keySlice.Counter_column.Name);
                    Utility.Logging("column.Name= " + columnName + " value=" + keySlice.Counter_column.Value, Utility.DebugLevel.Info);
                    if (key == columnName)
                    {
                        continue;
                    }
                    Utility.Logging("go check> " + key + "_" + columnName, Utility.DebugLevel.Info);
                    Check2NodeValue(key, columnName, keySlice.Counter_column.Value);
                }
                count++;
            }
            Utility.Logging("total count: " + count, Utility.DebugLevel.Info);
        }
Esempio n. 3
0
        public static MvcHtmlString GenDayList()
        {
            var result = ThriftTool.GetAllFromCF("BahamutDays", 30);

            ThriftTool.TransportClose();
            var sb = new StringBuilder();

            foreach (var ks in result)
            {
                foreach (var keySlice in ks.Columns)
                {
                    var key = ThriftTool.ToString(keySlice.Column.Name);
                    sb.Append("<option value='" + key + "'>" + key + "</option>");
                }
            }
            return(new MvcHtmlString(sb.ToString()));
        }
Esempio n. 4
0
        public static MvcHtmlString GenGameList()
        {
            var client = ThriftTool.GetClient("default", ref _transport);
            var result = ThriftTool.GetAllFromCF("GameList", 200, client);

            ThriftTool.TransportClose(ref _transport);
            var sb = new StringBuilder();

            foreach (var ks in result)
            {
                foreach (var keySlice in ks.Columns)
                {
                    var key = ThriftTool.ToString(keySlice.Column.Name);
                    sb.Append("<option value='" + key + "'>" + key + "</option>");
                }
            }
            return(new MvcHtmlString(sb.ToString()));
        }
Esempio n. 5
0
        static void PraseN3()
        {
            var count = 0;
            //Utility.Logging("Calculating N vs N from: " + count, Utility.DebugLevel.Info);
            var re = ThriftTool.GetAllFromCF("M01UserRelactionN2", 500000);

            foreach (var node in re)
            {
                //Utility.Logging("key="+ ThriftTool.ToString(node.Key), Utility.DebugLevel.Info);
                if (count % 1000 == 0)
                {
                    Utility.Logging("Calculating N vs N vs N from: " + count, Utility.DebugLevel.Info);
                }
                var ar = ThriftTool.ToString(node.Key).Split('_');
                //Utility.Logging("n1=" + ar[0] + " n2="+ar[1], Utility.DebugLevel.Info);
                ProcessN3(ar[0], ar[1]);

                count++;
            }
            Utility.Logging("total count: " + count, Utility.DebugLevel.Info);
        }
Esempio n. 6
0
        public ActionResult M01Test()
        {
            ViewBag.Message = "Mobile01 test";
            //Mobile01Tool.TempCounter=0;
            //Mobile01Tool.TempLog = string.Empty;
            //ViewBag.Result = Mobile01Tool.ProcessUrl("http://www.mobile01.com/topicdetail.php?f=566&t=2982467");
            //ViewBag.Result = Mobile01Tool.ProcessForum("http://www.mobile01.com/forumtopic.php?c=2");
            //Mobile01Tool.ProcessUrl("http://www.mobile01.com/topicdetail.php?f=18&t=2990078&m=f&r=9");
            //Mobile01Tool.ProcessForum("http://www.mobile01.com/forumtopic.php?c=2");
            //Mobile01Tool.ProcessQueue();
            //ViewBag.Result = Mobile01Tool.Testit();

            var re     = ThriftTool.GetAllFromCF("M01UserRelaction", 120000);
            var resulr = "org count:" + re.Count + "<br>";

            re      = re.Where(x => x.Columns.Count > 1).ToList();
            resulr += ">1 count:" + re.Count.ToString(CultureInfo.InvariantCulture) + "<br/>";
            //re.Sort((k1, k2) => Comparer<int>.Default.Compare(k2.Columns.Count, k1.Columns.Count));
            //foreach (var ks in re)
            //{
            //    resulr += "Columns.Count:" + ks.Columns.Count.ToString(CultureInfo.InvariantCulture) + "<br/>";

            //        foreach (var keySlice in ks.Columns)
            //        {
            //            //if (keySlice.Counter_column.Value <= 1) continue;
            //            var key = ThriftTool.ToString(keySlice.Counter_column.Name);
            //            var val = keySlice.Counter_column.Value;
            //            resulr += ("key=" + ThriftTool.ToString(ks.Key) + " name=" + key + " value=" + val + "<br/>");
            //        }
            //}
            ViewBag.Result = MvcHtmlString.Create(resulr);

            //MvcHtmlString br = new MvcHtmlString("<br>");
            //ThriftTool.CounterAdd("65535", "M01UserRelaction", "65533", 1);
            //ViewBag.Result = WebTool.GetHtmlAsyncUtf8("http://www.died.tw");
            return(View());
        }