public ListResults Browse(ListResultsRequest listResultsRequest) { HttpWebRequest request = CatalogRequestBuilder.ConstructListRequest(apiKey, listResultsRequest); ListResults listResults = ProcessBodylessRequest(request).ToObject <ListResults>(); return(listResults); }
IEnumerator UploadBestResultsGet() { string url = "https://www.neoblast-official.com/sportquiz/getBestRecord.php?hash=neo"; using (UnityWebRequest webRequest = UnityWebRequest.Get(url)) { yield return(webRequest.SendWebRequest()); if (webRequest.isNetworkError) { Debug.Log(": Error: " + webRequest.error); } else { string result = webRequest.downloadHandler.text; ListResults tmp_objects = JsonUtility.FromJson <ListResults>(result); string text = ""; for (int i = 0; i < tmp_objects.results.Length; i++) { text += tmp_objects.results[i].name + "\n"; } userNames.GetComponent <Text>().text = text; text = ""; for (int i = 0; i < tmp_objects.results.Length; i++) { text += tmp_objects.results[i].highscore + "\n"; } userScores.GetComponent <Text>().text = text; } } }
public void TestBrowse() { ListResultsRequest listResultsRequest = new ListResultsRequest(); listResultsRequest.Type = EnumTypes.ListType.DEFAULT; listResultsRequest.CategoryId = "3135"; listResultsRequest.IncludeAttributes = true; listResultsRequest.Offset = 10; listResultsRequest.Limit = 10; listResultsRequest.DataOutputs = new EnumTypes.DataOutputType[] { EnumTypes.DataOutputType.PRODUCTS, EnumTypes.DataOutputType.CATEGORIES, EnumTypes.DataOutputType.REFINEMENTS }; listResultsRequest.Offers = new EnumTypes.OfferType[] { EnumTypes.OfferType.ALL }; ListResults listResults = client.Browse(listResultsRequest); Assert.IsTrue(listResults.TotalResultSize > 0); Assert.IsNotNull(listResults.Categories); Assert.IsTrue(listResults.Categories.Count > 0); Assert.IsNotNull(listResults.Products); Assert.IsTrue(listResults.Products.Count > 0); Assert.IsNotNull(listResults.RefinementGroups); Assert.IsTrue(listResults.RefinementGroups.Count > 0); }
public double[] VoltageOf(String circuitName) { if (!ListResults[0].CircuitProperties.ContainsKey(circuitName)) { return(null); } return(ListResults.Select(l => l.CircuitProperties[circuitName].volts).ToArray()); }
private void ListResults_DoubleClick(object sender, MouseEventArgs e) { int index = ListResults.IndexFromPoint(e.Location); if (index != System.Windows.Forms.ListBox.NoMatches) { System.Diagnostics.Process.Start(ListResults.SelectedItem.ToString()); } }
public async Task <IActionResult> Get() { var forecasts = await this.temperaturesReadServices.GetCurrentTemperatures(); ListResults results = new ListResults(); results.Date = DateTime.UtcNow; results.Forecasts = forecasts; return(Ok(results)); }
//private static ListResults CreateDataOLE() //{ // string dir = Directory.GetCurrentDirectory(); //} private static ListResults CreateData() { //Create COM Objects. Create a COM object for everything that is referenced string dir = Directory.GetCurrentDirectory(); Excel.Application xlApp = new Excel.Application(); Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(Path.GetFullPath(Path.Combine(dir, @"..\..\Excel\EuroMillions.xlsx"))); Excel._Worksheet xlWorksheet = xlWorkbook.Sheets[1]; Excel.Range xlRange = xlWorksheet.UsedRange; int rowCount = xlRange.Rows.Count; int colCount = xlRange.Columns.Count; ListResults results = new ListResults(); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); for (int i = 2; i <= rowCount; i++) { List <int> numbers = new List <int>(); for (int j = 2; j <= colCount - 2; j++) { var cell = xlRange.Cells[i, j]; var number = Convert.ToInt32(cell.Value2); if (number >= 1) { numbers.Add(number); } } if (numbers.Count == 5) { results.Add(new Results ( numbers[0], numbers[1], numbers[2], numbers[3], numbers[4] )); } else { Console.Write("Something didnt get counted"); } } stopwatch.Stop(); return(results); }
private void SearchBox_PreviewKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter || e.Key == Key.Return) { Search_Click(this, null); } if (e.Key == Key.Tab && this.Model.SearchResults.Count > 0) { ListResults.Focus(); } }
private void Dev_DummyData_Click(object sender, MouseButtonEventArgs e) { ListResults.Clear(); var dummyData = new Dino[] { new Dino { Location = new Position { Lat = 10, Lon = 10 }, Type = "Testificate", Name = "10,10" }, new Dino { Location = new Position { Lat = 90, Lon = 10 }, Type = "Testificate", Name = "90,10" }, new Dino { Location = new Position { Lat = 10, Lon = 90 }, Type = "Testificate", Name = "10,90" }, new Dino { Location = new Position { Lat = 90, Lon = 90 }, Type = "Testificate", Name = "90,90" }, new Dino { Location = new Position { Lat = 50, Lon = 50 }, Type = "Testificate", Name = "50,50" }, }; var rnd = new Random(); foreach (var result in dummyData) { result.Id = (ulong)rnd.Next(); DinoViewModel vm = new DinoViewModel(result) { Color = Colors.Green }; ListResults.Add(vm); } var cv = (CollectionView)CollectionViewSource.GetDefaultView(ListResults); cv.Refresh(); }
private void UpdateSearchResults(IList <SearchCriteria> searches) { if (searches == null || searches.Count == 0) { ListResults.Clear(); } else { // Find dinos that match the given searches var found = new List <Dino>(); var sourceDinos = ShowTames ? arkReader.TamedDinos : arkReader.WildDinos; var total = 0; foreach (var search in searches) { if (String.IsNullOrWhiteSpace(search.Species)) { foreach (var speciesDinos in sourceDinos.Values) { found.AddRange(speciesDinos); total += speciesDinos.Count; } } else { if (sourceDinos.ContainsKey(search.Species)) { var dinoList = sourceDinos[search.Species]; found.AddRange(dinoList.Where(d => search.Matches(d))); total += dinoList.Count; } } } ListResults.Clear(); foreach (var result in found) { ListResults.Add(result); } ShowCounts = true; ResultTotalCount = ShowTames ? sourceDinos.Sum(species => species.Value.Count()) : total; ResultMatchingCount = ListResults.Count; } ((CollectionViewSource)Resources["OrderedResults"]).View.Refresh(); TriggerNameSearch(true); }
protected void GetSelectedRecords(object sender, EventArgs e) { DataTable dt = new DataTable(); dt.Columns.AddRange(new DataColumn[6] { new DataColumn("Name"), new DataColumn("ProductCode"), new DataColumn("OEM"), new DataColumn("Manufacturer"), new DataColumn("Price"), new DataColumn("Comment") }); foreach (GridViewRow row in GridView1.Rows) { if (row.RowType == DataControlRowType.DataRow) { CheckBox chkRow = (row.Cells[0].FindControl("chkRow") as CheckBox); if (chkRow.Checked) { string CarBrands = row.Cells[1].Text; SqlDataAdapter da = new SqlDataAdapter(@"select * from goods where comment in(N'" + CarBrands + "') ", con); DataTable tmp_dt = new DataTable(); da.Fill(tmp_dt); //con.Close(); for (int i = 0; i < tmp_dt.Rows.Count; i++) { string products_name = tmp_dt.Rows[i]["name"].ToString(); string products_code = tmp_dt.Rows[i]["product_code"].ToString(); string products_oem = tmp_dt.Rows[i]["OEM"].ToString(); string products_manufacturer = tmp_dt.Rows[i]["manufacturer"].ToString(); string products_price = tmp_dt.Rows[i]["price"].ToString(); string products_comment = tmp_dt.Rows[i]["comment"].ToString(); dt.Rows.Add(products_name, products_code, products_oem, products_manufacturer, products_price, products_comment); } //string country = (row.Cells[2].FindControl("lblCountry") as Label).Text; Response.Write("<script type='text/javascript'>alert('" + CarBrands + " - !!!')</script>"); dt.Rows.Add(CarBrands); } } } ListResults.DataSource = dt; ListResults.DataBind(); }
private void UpdateSearchResults(IList <SearchCriteria> searches) { if (searches == null || searches.Count == 0) { ListResults.Clear(); } else { // Find dinos that match the given searches var found = new List <Dino>(); var reader = ShowTames ? arkReaderTamed : arkReaderWild; foreach (var search in searches) { if (String.IsNullOrWhiteSpace(search.Species)) { foreach (var speciesDinos in reader.FoundDinos.Values) { found.AddRange(speciesDinos); } } else { if (reader.FoundDinos.ContainsKey(search.Species)) { var dinoList = reader.FoundDinos[search.Species]; found.AddRange(dinoList.Where(d => search.Matches(d))); } } } ListResults.Clear(); foreach (var result in found) { ListResults.Add(result); } } ((CollectionViewSource)Resources["OrderedResults"]).View.Refresh(); TriggerNameSearch(true); }
/* * make async */ private void CallToApi(string query) { try { string response = APICaller.Call("https://api.themoviedb.org/3/search/movie?api_key=1a9755b22a226ad22bb40fc91e9ed04a", "&query=" + query); _resultsModel = JsonConvert.DeserializeObject <ResultsModel>(response); Console.WriteLine("response here: " + response); Console.WriteLine("results model: " + _resultsModel.results.Count); ImageBackground = new BitmapImage(new Uri("https://image.tmdb.org/t/p/original/" + _resultsModel.results[0].backdrop_path)); _resultsModel.results.ForEach(delegate(Result s) { ListResults.Add(s); }); RaisePropertyChanged("ListResults"); } catch (JsonReaderException e) { Console.WriteLine(e.StackTrace); } }
public ListFilesHandler(string backend, Options options, ListResults result) { m_backendurl = backend; m_options = options; m_result = result; }
private async Task GenerateCalibrationPoints() { IsLoading = true; try { StatusDetailText = "...converting"; StatusText = "Processing saved ARK (for calibration)"; var boxes = await arkReader.PerformCalibrationRead(Properties.Settings.Default.SaveFile); if (boxes.Count == 0) { MessageBox.Show(@"Map calibration requires storage boxes named 'Calibration: XX.X, YY.Y', " + "where XX.X and YY.Y are read from the GPS when standing on top of the box. " + "At least 4 are required for a calculation but 16+ are recommended!", "Calibration Boxes", MessageBoxButton.OK, MessageBoxImage.Information); return; } var rnd = new Random(); foreach (var(pos, name) in boxes) { var dino = new Dino { Location = pos, Type = "Calibration", Name = name, Id = (ulong)rnd.Next() }; var vm = new DinoViewModel(dino) { Color = Colors.Blue }; ListResults.Add(vm); } ((CollectionViewSource)Resources["OrderedResults"]).View.Refresh(); StatusText = "ARK processing completed"; StatusDetailText = $"{boxes.Count} valid calibration boxes located"; if (boxes.Count >= 4) { var((xO, xD, xC), (yO, yD, yC)) = CalculateCalibration(boxes.Select(p => p.pos).ToArray()); var warning = (xC < 0.99 || yC < 0.99) ? "\nWARNING: Correlation is poor - add more boxes!\n" : ""; var result = MessageBox.Show("UE->LatLon conversion...\n" + "\n" + $"X: {xO:F2} + x / {xD:F3} (correlation {xC:F5})\n" + $"Y: {yO:F2} + y / {yD:F3} (correlation {yC:F5})\n" + warning + "\nOpen Calibration window with these presets?", "Calibration Box Results", MessageBoxButton.YesNo); if (MessageBoxResult.Yes == result) { var win = new CalibrationWindow(new Calibration { Bounds = new Bounds(), Filename = MapCalibration.Filename, LonOffset = xO, LonDivisor = xD, LatOffset = yO, LatDivisor = yD, }); Dispatcher.Invoke(() => win.ShowDialog()); } } } catch (Exception ex) { StatusText = "ARK processing failed"; StatusDetailText = ""; MessageBox.Show(ex.Message, "Savegame Read Error", MessageBoxButton.OK, MessageBoxImage.Exclamation); } finally { IsLoading = false; } }
//public int V1 { get; private set; } //public int V2 { get; private set; } //public int V3 { get; private set; } //public int V4 { get; private set; } //public int V5 { get; private set; } static void Main(string[] args) { //Create COM Objects. Create a COM object for everything that is referenced //ListResults results = CreateDataOLE(); ListResults results = CreateData(); var deep = 20; var network = new BasicNetwork(); network.AddLayer(new BasicLayer(null, true, 5 * deep)); network.AddLayer(new BasicLayer(new ActivationSigmoid(), true, 5 * 5 * deep)); network.AddLayer(new BasicLayer(new ActivationSigmoid(), true, 5 * 5 * deep)); network.AddLayer(new BasicLayer(new ActivationLinear(), true, 5)); network.Structure.FinalizeStructure(); var learningInput = new double[deep][]; for (int i = 0; i < deep; ++i) { learningInput[i] = new double[deep * 6]; for (int j = 0, k = 0; j < deep; ++j) { var idx = 2 * deep - i - j; var data = results[idx]; learningInput[i][k++] = data.V1; learningInput[i][k++] = data.V2; learningInput[i][k++] = data.V3; learningInput[i][k++] = data.V4; learningInput[i][k++] = data.V5; } } var learningOutput = new double[deep][]; for (int i = 0; i < deep; ++i) { var idx = deep - 1 - i; var data = results[idx]; learningOutput[i] = new double[5] { data.V1, data.V2, data.V3, data.V4, data.V5, }; } var trainingSet = new BasicMLDataSet(learningInput, learningOutput); var train = new ResilientPropagation(network, trainingSet); train.NumThreads = Environment.ProcessorCount; START : network.Reset(); RETRY: var step = 0; do { train.Iteration(); Console.WriteLine("Train Error: {0}", train.Error); ++step; }while (train.Error > 0.001 && step < 20); var passedCount = 0; for (var i = 0; i < deep; ++i) { var should = new Results(learningOutput[i]); var inputn = new BasicMLData(6 * deep); Array.Copy(learningInput[i], inputn.Data, inputn.Data.Length); var comput = new Results(((BasicMLData)network.Compute(inputn)).Data); var passed = should.ToString() == comput.ToString(); if (passed) { Console.ForegroundColor = ConsoleColor.Green; ++passedCount; } else { Console.ForegroundColor = ConsoleColor.Red; } Console.WriteLine("{0} {1} {2} {3}", should.ToString().PadLeft(17, ' '), passed ? "==" : "!=", comput.ToString().PadRight(17, ' '), passed ? "PASS" : "FAIL"); Console.ResetColor(); } var input = new BasicMLData(5 * deep); for (int i = 0, k = 0; i < deep; ++i) { var idx = deep - 1 - i; var data = results[idx]; input.Data[k++] = data.V1; input.Data[k++] = data.V2; input.Data[k++] = data.V3; input.Data[k++] = data.V4; input.Data[k++] = data.V5; } var perfect = results[0]; var predict = new Results(((BasicMLData)network.Compute(input)).Data); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Predict: {0}", predict); Console.ResetColor(); if (predict.IsOut()) { goto START; } if ((double)passedCount < (deep * (double)9 / (double)10) || !predict.IsValid()) { goto RETRY; } Console.WriteLine("Press any key for close..."); Console.ReadKey(true); }
public override IDictionary <string, object> BuildResultsForDisplay() { IDictionary <string, object> dict = base.BuildResultsForDisplay(); PM_MMAnalyser analyser = this.Analyser as PM_MMAnalyser; int pp = analyser.Motor.Rotor.p; // to open fem file dict.Add("OpenResults", analyser.Path_ToAnalysisVariant); dict.Add("psiD(Id)", new ListPointD(ListResults.Select(p => p.Idq.d).ToArray(), ListResults.Select(p => p.FluxLinkage_dq.d).ToArray())); dict.Add("psiQ(Iq)", new ListPointD(ListResults.Select(p => p.Idq.q).ToArray(), ListResults.Select(p => p.FluxLinkage_dq.q).ToArray())); dict.Add("Ld(I)", new ListPointD(ListResults.Where(p => p.Idq.d < 0).Select(p => p.Idq.Magnitude).ToArray(), ListResults.Where(p => p.Idq.d < 0).Select(p => p.Ldq.d).ToArray())); dict.Add("Lq(I)", new ListPointD(ListResults.Where(p => p.Idq.d < 0).Select(p => p.Idq.Magnitude).ToArray(), ListResults.Where(p => p.Idq.d < 0).Select(p => p.Ldq.q).ToArray())); dict.Add("psiM/Ld/Imax", new ListPointD(ListResults.Select(p => p.Idq.Magnitude).ToArray(), ListResults.Select(p => p.FluxLinkage_M / p.Ldq.d / p.Idq.Magnitude).ToArray())); dict.Add("FluxLinkage(M)-mm", FluxLinkageM); dict.Add("PhaseResistance", PhaseResistance); double[] psid_ = new double[Count]; double[] psiq_ = new double[Count]; for (int i = 1; i < Count; i++) { psid_[i] = (ListResults[i].FluxLinkage_dq.d - ListResults[i - 1].FluxLinkage_dq.d) / (ListResults[i].Idq.d - ListResults[i - 1].Idq.d); psiq_[i] = (ListResults[i].FluxLinkage_dq.q - ListResults[i - 1].FluxLinkage_dq.q) / (ListResults[i].Idq.q - ListResults[i - 1].Idq.q); } dict.Add("PsiD'(id)", new ListPointD(ListResults.Select(p => p.Idq.d).ToArray(), psid_)); dict.Add("PsiQ'(iq)", new ListPointD(ListResults.Select(p => p.Idq.q).ToArray(), psiq_)); //LinearSpline ls_psi_d = LinearSpline.Interpolate(ListResults.Select(p => p.Idq.d), ListResults.Select(p => p.FluxLinkage_dq.d)); //LinearSpline ls_psi_q = LinearSpline.Interpolate(ListResults.Select(p => p.Idq.q), ListResults.Select(p => p.FluxLinkage_dq.q)); // Build torque by angle for each for (int i = 0; i < ListResults.Length; i++) { var one_step_result = ListResults[i]; // only quarter where id<0,iq>0 if (one_step_result.Idq.d >= 0 || one_step_result.Idq.q <= 0) { continue; } double Ld = one_step_result.Ldq.d; double Lq = one_step_result.Ldq.q; double II = one_step_result.Idq.Magnitude; double Beta0 = one_step_result.Idq.Phase; double psiM = one_step_result.FluxLinkage_M; double d_wire = (Analyser.Motor.Stator as Stator3Phase).WireDiameter; double S_wire = d_wire * d_wire / 4 * Math.PI; String name = String.Format("Torque (Imax={0:F2}, J={1:F2})", II, II / S_wire / Math.Sqrt(2)); if (dict.ContainsKey(name)) { continue; } int n = 360; double[] x = Enumerable.Range(0, n).Select(kk => 1.0 * kk).ToArray(); double[] tt = new double[n]; for (int k = 0; k < n; k++) { double beta = 2.0 * Math.PI * k / n; double id = II * Math.Cos(beta); double iq = II * Math.Sin(beta); tt[k] = 1.5 * pp * (psiM * iq + (Ld - Lq) * id * iq); //double psid = ls_psi_d.Interpolate(id); //double psiq = ls_psi_q.Interpolate(iq); //tt[k] = 1.5 * pp * (psid * iq - psiq * id); } object value = new ListPointD(x, tt); dict.Add(name, value); } IEnumerable <int> seq = Enumerable.Range(0, Count); var arrI = ListResults.Where(p => p.Idq.d < 0).Select(p => p.Idq.Magnitude).ToArray(); var arrL1 = seq.Where(i => ListResults[i].Idq.d < 0).Select(i => (ListResults[i].Ldq.d + ListResults[i].Ldq.q) / 3).ToArray(); var arrL2 = seq.Where(i => ListResults[i].Idq.d < 0).Select(i => - (ListResults[i].Ldq.d - ListResults[i].Ldq.q) / 3).ToArray(); dict.Add("L1(I)", new ListPointD(arrI, arrL1)); dict.Add("L2(I)", new ListPointD(arrI, arrL2)); int Q = Analyser.Motor.Stator.Q; int q = Q / 3 / pp / 2; double kp = Math.Sin(Math.PI / (2 * 3)) / (q * Math.Sin(Math.PI / (2 * 3 * q))); var stator = Analyser.Motor.Stator as Stator3Phase; double ns = 4 / Math.PI * kp * stator.NStrands * q * pp; var Motor = Analyser.Motor; var rotor = Motor.Rotor as VPMRotor; double gm = rotor.gammaMerad; double[] arr_dmin = new double[Count]; double[] arr_dmax = new double[Count]; for (int i = 0; i < arrL1.Length; i++) { double mL1 = arrL1[i]; double mL2 = arrL2[i]; double a1 = mL1 / ((ns / 2 / pp) * (ns / 2 / pp) * Math.PI * Motor.Rotor.RGap * Motor.GeneralParams.MotorLength * 1e-6 * 4 * Math.PI * 1e-7); double a2 = mL2 / (0.5 * (ns / 2 / pp) * (ns / 2 / pp) * Math.PI * Motor.Rotor.RGap * Motor.GeneralParams.MotorLength * 1e-6 * 4 * Math.PI * 1e-7); arr_dmin[i] = 1 / (a1 + a2 * gm / (2 * Math.Sin(gm))); arr_dmax[i] = 1 / (a1 - a2 * (Math.PI - gm) / (2 * Math.Sin(gm))); } dict.Add("dmin(I)", new ListPointD(arrI, arr_dmin)); dict.Add("dmax(I)", new ListPointD(arrI, arr_dmax)); return(dict); }