private async void Run_Click(object sender, EventArgs e) { maximumChildsTextBox.Text = ""; ExcutedTimeTextBox.Text = "0"; if (Validation()) { MessageBox.Show("تمامی آیتم های ورودی رو وارد کنید", "", MessageBoxButtons.OK); return; } gettingStarted = new GettingStarted( int.Parse(CapacityTextBox.Text), int.Parse(EarlyPopulationTextBox.Text), int.Parse(NumberOfParentsTextBox.Text), int.Parse(NumberOfGenerationRepetitionsTextBox.Text), ItemsTextBox1.Text.ConvertToItemList() ); var evaluationTrain = new EvaluationTrain(gettingStarted); evaluationTrain.MaximumChildChanged += EvaluationTrain_MaximumChildChanged; evaluationTrain.TryChanged += EvaluationTrain_TryChanged; evaluationTrain.ParentChanged += EvaluationTrain_ParentChanged; _timer.Start(); Run.Enabled = false; await evaluationTrain.DoTrain(gettingStarted); _timer.Stop(); MessageBox.Show($"Fitness: {evaluationTrain.ExcetedFitness}\nTime: {_timeCount/100}s"); Run.Enabled = true; }
public async Task <ActionResult> QueueMessage() { GettingStarted getStarted = new GettingStarted(); await getStarted.RunQueueStorageOperationsAsync(); return(View("Index")); }
static async Task <List <Service> > ConsumeOwlAsync(string url) { string content = string.Empty; string jObject = "query= PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>PREFIX : <http://www.semanticweb.org/ca.mendoza968/ontologies/services#>SELECT ?URI ?methodValue (group_concat(?bodyLabel) as ?bodyLabels) (group_concat(?dataTypeLabel) as ?dataTypes)WHERE { ?service a :Service; :aboutProperty ?property . ?service :hasAPIURL ?URL; :hasMethod ?method . ?URL :hasStringValue ?URI . ?method a :Read; :hasStringValue ?methodValue; :hasBodyField ?bodyField . ?bodyField rdfs:label ?bodyLabel; :hasDataType ?dataType . ?dataType rdfs:label ?dataTypeLabel .}GROUP BY ?URI ?methodValue"; var stringContent = new StringContent(jObject, Encoding.UTF8, "application/x-www-form-urlencoded"); HttpResponseMessage response = await client.PostAsync(url, stringContent); if (response.EnsureSuccessStatusCode().IsSuccessStatusCode) { content = await response.Content.ReadAsStringAsync(); } List <Service> listServices = new List <Service>(); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(content); GettingStarted data = GettingStarted.FromJson(JsonConvert.SerializeXmlNode(xmlDoc)); foreach (Result item in data.Sparql.Results.Result) { Service itemService = new Service(); foreach (Binding detail in item.Binding) { if (detail.Name.Equals("URI")) { itemService.url = detail.Literal; } if (detail.Name.Equals("methodValue")) { itemService.methodValue = detail.Literal; } if (detail.Name.Equals("dataTypes")) { itemService.dataTypes = detail.Literal; } if (detail.Name.Equals("bodyLabels")) { itemService.bodyLabels = detail.Literal; } itemService.method = "GET"; } listServices.Add(itemService); } return(listServices); }
public async Task <IActionResult> Get() { try { var gettingStarted = new GettingStarted(); gettingStarted.ApplicationName = "check_yo_self_api"; return(await Task.FromResult(Ok(gettingStarted))); } catch (Exception ex) { _logger.LogError(1, ex, "Unable to get status"); return(BadRequest()); } }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IDispatcher dispatcher, IOptions <DomainDbConfiguration> settings) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.Run(async(context) => { // Create a sample product loading data from domain events. var product = await GettingStarted.CreateProduct(dispatcher); // Display product title. await context.Response.WriteAsync($"Product title: {product.Title}"); }); }
// ************************************************************************************************************************* // Instructions: This sample can be run using either the Azure Storage Emulator that installs as part of this SDK - or by // updating the App.Config file with your AccountName and Key. // // To run the sample using the Storage Emulator (default option) // 1. Start the Azure Storage Emulator (once only) by pressing the Start button or the Windows key and searching for it // by typing "Azure Storage Emulator". Select it from the list of applications to start it. // 2. Set breakpoints and run the project using F10. // // To run the sample using the Storage Service // 1. Open the app.config file and comment out the connection string for the emulator (UseDevelopmentStorage=True) and // uncomment the connection string for the storage service (AccountName=[]...) // 2. Create a Storage Account through the Azure Portal and provide your [AccountName] and [AccountKey] in // the App.Config file. See http://go.microsoft.com/fwlink/?LinkId=325277 for more information // 3. Set breakpoints and run the project using F10. // // ************************************************************************************************************************* public static void Main(string[] args) { Console.WriteLine("Azure Storage Queue Sample\n"); // Create queue, insert message, peek message, read message, change contents of queued message, // queue 20 messages, get queue length, read 20 messages, delete queue. GettingStarted getStarted = new GettingStarted(); getStarted.RunQueueStorageOperationsAsync().Wait(); // Get list of queues in storage account. Advanced advMethods = new Advanced(); advMethods.RunQueueStorageAdvancedOpsAsync().Wait(); Console.WriteLine("Press any key to exit."); Console.Read(); }
public override void Dispose() { base.Dispose(); DisposeTextBlock(TextBlock1); TextBlock1 = null; DisposeTextBlock(TextBlock2); TextBlock2 = null; DisposeTextBlock(saveas); saveas = null; DisposeTextBlock(TextBlock4); TextBlock4 = null; DisposeTextBlock(TextBlock5); TextBlock5 = null; DisposeTextBlock(TextBlock6); TextBlock6 = null; DisposeTextBlock(WinRTText1); WinRTText1 = null; DisposeTextBlock(WinRTText2); WinRTText2 = null; DisposeTextBlock(text1); text1 = null; DisposeTextBlock(text2); text2 = null; Button1.Click -= Button_Click_1; DisposeButton(Button1); Button1 = null; DisposeRadioButton(rdDoc); rdDoc = null; DisposeRadioButton(rdDocx); rdDocx = null; stackPnlOptions.ClearValue(StackPanel.OrientationProperty); stackPnlOptions.ClearValue(StackPanel.HorizontalAlignmentProperty); stackPnlOptions = null; GettingStarted.ClearValue(Grid.BackgroundProperty); GettingStarted.ClearValue(Grid.PaddingProperty); GettingStarted.Children.Clear(); GettingStarted.ColumnDefinitions.Clear(); GettingStarted.RowDefinitions.Clear(); GettingStarted = null; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IDispatcher dispatcher, EventStoreDbContext eventStoreDbContext) { // Ensure Weapsy.Cqrs database is installed. eventStoreDbContext.Database.Migrate(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.Run(async context => { // Create a sample product loading data from domain events. var product = await GettingStarted.CreateProduct(dispatcher); // Display product title. await context.Response.WriteAsync($"Product title: {product.Title}"); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IDispatcher dispatcher) { // Ensure Kledex database is installed. app.UseKledex().EnsureDomainDbCreated(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } // Create a sample product loading data from domain events. var product = GettingStarted.CreateProduct(dispatcher).GetAwaiter().GetResult(); app.Run(async context => { // Display product title. await context.Response.WriteAsync($"Product title: {product.Title}"); }); }
public override Task <List <ArticleModel> > EvaluateFeed(FeedModel feedModel) { return(ExecuteSafe(async() => { //find customer key first if (CustomerKey == null) { await GetCustomerKey(); } var articlelist = new List <ArticleModel>(); var json = await DownloadAsync(new Uri(feedModel.Source.LogicBaseUrl + feedModel.Url.Replace("CUSTOMERKEY", CustomerKey))); if (json == null) { return articlelist; } var feed = GettingStarted.FromJson(json); if (feed == null) { LogHelper.Instance.Log(LogLevel.Error, "ZwanzigMinHelper.EvaluateFeed 20 min channel is null after deserialisation", this); } else { foreach (var item in feed.Content.Items.Item) { var model = FeedToArticleModel(item, feedModel); if (model != null) { articlelist.Add(model); } } } return articlelist; })); }
public void initialize() { driver = new ChromeDriver(); gettingStarted = new GettingStarted(driver); home = new Home(driver); }
public void TearDown() { _examples = null; }
public void Setup() { _examples = new GettingStarted(); }
static async Task <bool> ConsumeOwlAsync(string url, string method, Int32 maxSelected, string service) { string finalMethod = string.Empty; string filter = string.Empty; switch (method.ToUpper().Trim()) { case "GET": finalMethod = "Read"; break; default: finalMethod = "Read"; break; } if (!string.IsNullOrEmpty(service) || !service.Contains("*")) { filter = string.Format("FILTER (?methodValue = \"{0}\") .", service); } string jObject = "query= PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX : <http://www.semanticweb.org/ca.mendoza968/ontologies/services#> SELECT ?URI ?methodValue (group_concat(?bodyLabel) as ?bodyLabels) (group_concat(?dataTypeLabel) as ?dataTypes) WHERE { ?service a :Service; :aboutProperty ?property. ?service :hasAPIURL ?URL; :hasMethod ?method . ?URL :hasStringValue ?URI.?method a :" + finalMethod + "; :hasStringValue ?methodValue; :hasBodyField ?bodyField . ?bodyField rdfs:label ?bodyLabel; :hasDataType ?dataType . ?dataType rdfs:label ?dataTypeLabel . " + filter + "} GROUP BY ?URI ?methodValue"; var stringContent = new StringContent(jObject, Encoding.UTF8, "application/x-www-form-urlencoded"); HttpResponseMessage response = await client.PostAsync(url, stringContent); if (response.EnsureSuccessStatusCode().IsSuccessStatusCode) { string content = await response.Content.ReadAsStringAsync(); List <Service> listServices = new List <Service>(); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(content); GettingStarted data = GettingStarted.FromJson(JsonConvert.SerializeXmlNode(xmlDoc)); foreach (Result item in data.Sparql.Results.Result) { Service itemService = new Service(); foreach (Binding detail in item.Binding) { if (detail.Name.Equals("URI")) { itemService.url = detail.Literal; } if (detail.Name.Equals("methodValue")) { itemService.methodValue = detail.Literal; } if (detail.Name.Equals("dataTypes")) { itemService.dataTypes = detail.Literal; } if (detail.Name.Equals("bodyLabels")) { itemService.bodyLabels = detail.Literal; } } listServices.Add(itemService); } List <Service> distinctValues = new List <Service>(); if (maxSelected == 1) { distinctValues = listServices.GroupBy(c => c.methodValue, (key, c) => c.FirstOrDefault()).ToList(); } else { var finalTrans = listServices.GroupBy(c => c.methodValue, (key, c) => c.Take(maxSelected)); ////Convertir de Ienumerable a List. foreach (var item in finalTrans) { foreach (var serviceItem in item) { distinctValues.Add(serviceItem); } } } try { JavaScriptSerializer jsonSerialiser = new JavaScriptSerializer(); string json = jsonSerialiser.Serialize(distinctValues); File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"\" + "config.txt", json); } catch (Exception) { return(false); } return(true); } return(false); }
private async Task EvaluateSources(ConcurrentStack <SourceEntity> input) { try { while (input.TryPop(out var source)) { if ((int)source.Source >= 20 && (int)source.Source <= 40) { //tamedia sources var resp = await _httpService.DownloadAsync(new Uri(source.LogicBaseUrl + "navigations?client=webapp")); var json = await resp.GetResponseAsStringAsync(); var model = TamediaNavigation.FromJson(json); var existing = source.Feeds.ToList(); var newList = new List <FeedEntity>(); foreach (var navigation in model.Navigations) { if (navigation.CategoryPreview != null) { var found = FindAndRemove(existing, navigation.CategoryPreview.Name) ?? new FeedEntity() { Guid = Guid.NewGuid(), Name = navigation.CategoryPreview.Name }; //correct category found.Url = "categories/" + navigation.CategoryPreview.Id; newList.Add(found); } } //skip adding of front because currently it cannot be processed if (false) { //add / correct special front navigation var front = FindAndRemove(existing, "Front") ?? new FeedEntity() { Guid = Guid.NewGuid(), Name = "Front" }; //correct category front.Url = "fronts/mobile"; newList.Insert(0, front); } //to output source.Feeds.Clear(); foreach (var feedEntity in newList) { source.Feeds.Add(feedEntity); } } else if (source.Source == Sources.ZwanzigMin) { var resp = await _httpService.DownloadAsync(new Uri("http://api.20min.ch/feed/sitemap?&key=" + TwentyMinCustomerKey + "&json&host=m.20min.ch&lang=de")); var json = await resp.GetResponseAsStringAsync(); var feedDic = new Dictionary <string, FeedEntity>(); foreach (var sourceFeed in source.Feeds) { feedDic.Add(sourceFeed.Name, sourceFeed); } source.Feeds.Clear(); source.LogicBaseUrl = "http://api.20min.ch/feed"; var logicLength = source.LogicBaseUrl.Length; var model = GettingStarted.FromJson(json); foreach (var contentItem in model.Content.Items.Item.Where(c => !string.IsNullOrEmpty(c.Category) && c.Type == "view")) { FeedEntity item = null; if (feedDic.ContainsKey(contentItem.Category)) { item = feedDic[contentItem.Category]; } else { item = new FeedEntity { Name = contentItem.Category, Guid = Guid.NewGuid() }; } item.Url = contentItem.FeedFullContentUrl.Substring(logicLength).Replace(TwentyMinCustomerKey, "CUSTOMERKEY"); source.Feeds.Add(item); } } } } catch (Exception e) { Console.WriteLine(e); } }