Example #1
0
        private void Delete()
        {
            CCHelper cookie = new CCHelper("user");

            cookie.RemoveCookie();

            var cook = Request.Cookies[MD5Str("user")];
        }
        public async Task AddNewList()
        {
            try {
                var link = await _dialogs.ShowPrompt("Enter a conflict chamber list");

                if (string.IsNullOrEmpty(link))
                {
                    return;
                }

                var name = await _dialogs.ShowPrompt("Enter a name for this list");

                if (string.IsNullOrEmpty(name))
                {
                    return;
                }

                string ccId = null;
                Uri    uri  = default(Uri);
                try
                {
                    uri  = new Uri(link);
                    ccId = CCHelper.GetListId(uri);
                }
                catch (Exception)
                {
                    await _dialogs.ShowAlert("Link entered was invalid.");

                    return;
                }

                // new index is whatever the "count" of the list is, from 0 based indexing
                var created = await _dataService.CreateList(name, ccId, this.ConflictChamberLists.Count);

                this.ConflictChamberLists.Add(created);
                RaisePropertyChanged(nameof(ConflictChamberLists));
            }
            catch (ValidationException ex)
            {
                Console.WriteLine(ex.Message);
                await this._dialogs.ShowAlert(ex.Message);
            }
        }
Example #3
0
        public ActionResult DownloadAndIndexWat(
            string accessToken,
            string commonCrawlId,
            string collectionName,
            int skip,
            int take
            )
        {
            if (!IsValidToken(accessToken))
            {
                return(StatusCode((int)HttpStatusCode.MethodNotAllowed));
            }

            CCHelper.DownloadAndIndexWat(
                commonCrawlId,
                _config.Get("data_dir"),
                collectionName,
                skip,
                take,
                SessionFactory.Model,
                _logger);

            return(View());
        }
Example #4
0
        private void Update()
        {
            CCHelper cookie = new CCHelper("user");

            cookie.SetCookie("huage", "真是帅");
        }
Example #5
0
        private void Select()
        {
            CCHelper cookie = new CCHelper("user");

            cookie.GetCookie("huage");
        }
Example #6
0
        private void Add()
        {
            CCHelper cookie = new CCHelper("user", E_Time.一天);

            cookie.SetCookie("huage", "wudi");
        }
Example #7
0
        static void Main(string[] args)
        {
            var loggerFactory = LoggerFactory.Create(builder =>
            {
                builder
                .AddFilter("Microsoft", LogLevel.Warning)
                .AddFilter("System", LogLevel.Warning)
                .AddFilter("Sir.DbUtil.Program", LogLevel.Debug)
                .AddConsole().AddDebug();
            });

            var logger = loggerFactory.CreateLogger("dbutil");

            logger.LogInformation($"processing command: {string.Join(" ", args)}");

            var model   = new BocModel();
            var command = args[0].ToLower();

            if (command == "submit")
            {
                var fullTime = Stopwatch.StartNew();

                Submit(args);

                logger.LogInformation("submit took {0}", fullTime.Elapsed);
            }
            else if (command == "write_wp")
            {
                var fullTime = Stopwatch.StartNew();

                WriteWP(args, model, loggerFactory);

                logger.LogInformation("write operation took {0}", fullTime.Elapsed);
            }
            else if ((command == "slice"))
            {
                Slice(args);
            }
            else if (command == "download_wat")
            {
                // Ex: download_wat CC-MAIN-2019-51 d:\ cc_wat 0 1

                CCHelper.DownloadAndIndexWat(
                    commonCrawlId: args[1],
                    workingDirectory: args[2],
                    collectionName: args[3],
                    skip: int.Parse(args[4]),
                    take: int.Parse(args[5]),
                    model,
                    logger);
            }
            else if (command == "download_embedd_wat")
            {
                // Ex: download_embedd_wat CC-MAIN-2019-51 d:\ cc_wat 0 1

                CCHelper.DownloadAndCreateWatEmbeddings(
                    commonCrawlId: args[1],
                    workingDirectory: args[2],
                    collectionName: args[3],
                    skip: int.Parse(args[4]),
                    take: int.Parse(args[5]),
                    model,
                    logger);
            }
            else if (command == "write_wet")
            {
                // Ex: D:\CC-MAIN-2019-43\segments\1570986647517.11\wet\CC-MAIN-20191013195541-20191013222541-00000.warc.wet.gz
                WriteWet(args, model, logger);
            }
            else if (command == "truncate")
            {
                Truncate(args, model, logger);
            }
            else if (command == "truncate-index")
            {
                TruncateIndex(args, model, logger);
            }
            else if (command == "optimize")
            {
                Optimize(args, model, logger);
            }
            else
            {
                logger.LogInformation("unknown command: {0}", command);
            }

            logger.LogInformation($"executed {command}");
        }