private void pictureBox2_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBox1.Text)) { textBox1.Clear(); MessageBox.Show("Nama harus diisi", "WARNING!!!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { data dat = new data(textBox1.Text); db.OpenConn(); try { string sql = string.Concat("INSERT INTO Users " + "([nama]) VALUES " + "('"+textBox1.Text+"')"); db.execQuery(sql); //MessageBox.Show("Nama Add Sukses"); Test tst = new Test(); this.Close(); tst.Show(); data.cektestbuttonabout = false; data.cektestbuttoninfo = false; } catch (Exception) { //MessageBox.Show("Data tidak dimasukkan"); } db.CloseConn(); } }
protected virtual void EstimateAdvice(application.analysis.workData data, application.analysis.analysisResult advices, decimal initCapAmt, decimal priceWeight, decimal feePerc, byte buy2SellInterval, data.tmpDS.tradeEstimateDataTable toTbl) { application.analysis.EstimateAdvice(data,advices, initCapAmt, priceWeight, feePerc, buy2SellInterval, toTbl); }
public static double calcHamma(data raw) { double angleGrad = 0; double buf = (Math.Pow(raw.c, 2) + Math.Pow(raw.a, 2) - Math.Pow(raw.b, 2)) / (2 * raw.a * raw.c); angleGrad = ToGrad(Math.Acos(buf)); return angleGrad; }
private int SendToPhp() { try { data DataObj = new data(); DataObj.df_text1 = sendText1; DataObj.df_text2 = sendText2; string JSONString = JsonConvert.SerializeObject(DataObj, Formatting.None); string url = "http://pj3100.somee.com/cryptLogin.php"; HttpWebRequest newRequest = (HttpWebRequest)WebRequest.Create(url); newRequest.Method = "POST"; string postData = JSONString; byte[] pdata = Encoding.UTF8.GetBytes(postData); newRequest.ContentType = "application/x-www-form-urlencoded"; newRequest.ContentLength = pdata.Length; Stream myStream = newRequest.GetRequestStream(); myStream.Write(pdata, 0, pdata.Length); WebResponse myResponse = newRequest.GetResponse(); Stream responseStream = myResponse.GetResponseStream(); StreamReader streamReader = new StreamReader(responseStream); string result = streamReader.ReadToEnd(); streamReader.Close(); responseStream.Close(); myStream.Close(); if (result.Equals("1")) { return 1; } else if(result.Equals("2")) { return 2; } else { return 0; } } catch (WebException ex) { string _exception = ex.ToString(); Toast error = Toast.MakeText(this, _exception, ToastLength.Long); error.Show(); Console.WriteLine("--->" + _exception); return 0; } }
public Node(Node parent, Node left, Node right, data) { this.parent = parent; this.left = left; this.right = right; this.data = data }
/* IEnumerator WaitForRequest(WWW www){ yield return www; if (www.error == null) { Debug.Log(www.text); } else { Debug.Log("WWW Error: "+ www.error); } } */ public IEnumerator GetDataList() { if (_GameItems == null) { _GameItems = new List<data> (); } if (_GameItems.Count > 0) { _GameItems.Clear (); } WWW getScore = new WWW (display); yield return getScore; dataList.AddRange (Regex.Split (getScore.text, ";")); if (getScore.error != null) { Debug.Log ("There was an error getting the Leaderboard..."); } else { for (int i=0; i <= (dataList.Count-1)-3; i+=3) { data itm = new data(); itm.id = dataList[i].ToString(); itm.name = dataList[i+1].ToString(); itm.score = int.Parse(dataList[i+2].ToString()); _GameItems.Add (itm); Debug.Log(itm.id + "; " + itm.name + "; " + itm.score); } } }
public static void end() { // smaller circle if (state == 2) { Debug.Log("virk"); state++; timestampEnd = getMillis(); countEnd = PathTracer.countPixels(Color.white); // slow function creates a delay! Easy solution DONE: calls function when mouse moves out of each inner circle. dataList[stage] = new data(); dataList[stage].millis = timestampEnd - timestampBeg; dataList[stage].accuracy = (countStart - countEnd) * 100.0f / countStart ; dataList[stage].count = countEnd; Debug.Log("Ending"); Debug.Log("Time: " + (dataList[stage].millis / 1000.0f)); Debug.Log("Accuracy: " + dataList[stage].accuracy); timeDisplay = dataList[stage].millis / 1000.0f; PathTracer.displayScore(); Infotoggle.showInfoButton(); Timer.timerFrozen = true; if(GradiantLamp.lampIsOn==false) GradiantLamp.skammekrog = true; } }
protected virtual void EstimateAdvice(Data data, Analysis.AnalysisResult advices, Analysis.EstimateOptions options, data.tmpDS.tradeEstimateDataTable toTbl) { Analysis.EstimateAdvice(data,advices, options, toTbl); }
protected override void LoadData(data.tmpDS.stockCodeDataTable toTbl, string[] portfolioCodes) { DateTime startTime = DateTime.Now; LoadStockList(toTbl,portfolioCodes); UpdateRealTime(toTbl, portfolioCodes); this.ShowMessage(common.dateTimeLibs.TimeSpan2String(DateTime.Now.Subtract(startTime))); }
//Add to database private void ImportICB_AddToDb(data.importDS.icbCodeDataTable tbl, string fldName, bool haveDefitionFld, data.baseDS.sysCodeDataTable sysCodeTbl,string category,string codeGroupFldName) { data.baseDS.sysCodeRow sysCodeRow; common.myKeyValueItem item; for (int idx = 0; idx < tbl.Count; idx++) { if (tbl[idx].RowState == DataRowState.Deleted) continue; item = libs.SplitKeyValue(tbl[idx][fldName].ToString()," "); if (item == null) { common.fileFuncs.WriteLog(tbl[idx][fldName].ToString() + " not found."); continue; } if (sysCodeTbl.FindBycategorycode(category, item.Key) == null) { sysCodeRow = sysCodeTbl.NewsysCodeRow(); commonClass.AppLibs.InitData(sysCodeRow); sysCodeRow.category = category; sysCodeRow.code = item.Key; sysCodeRow.description1 = item.Value; sysCodeRow.tag1 = fldName; if (codeGroupFldName != null) sysCodeRow.inGroup = tbl[idx][codeGroupFldName].ToString(); if (haveDefitionFld && !tbl[idx].IsdefinitionNull()) sysCodeRow.notes = tbl[idx].definition; sysCodeTbl.AddsysCodeRow(sysCodeRow); } tbl[idx][fldName] = item.Key; } }
private bool SendToPhp() { try { data DataObj = new data(); DataObj.navn = sendText; string JSONString = JsonConvert.SerializeObject(DataObj, Formatting.None); string url = "http://pj3100.somee.com/getUserInfo.php"; HttpWebRequest newRequest = (HttpWebRequest)WebRequest.Create(url); newRequest.Method = "POST"; string postData = JSONString; byte[] pdata = Encoding.UTF8.GetBytes(postData); newRequest.ContentType = "application/x-www-form-urlencoded"; newRequest.ContentLength = pdata.Length; Stream myStream = newRequest.GetRequestStream(); myStream.Write(pdata, 0, pdata.Length); WebResponse myResponse = newRequest.GetResponse(); Stream responseStream = myResponse.GetResponseStream(); StreamReader streamReader = new StreamReader(responseStream); string result = streamReader.ReadToEnd(); user = JsonConvert.DeserializeObject<List<User>>(result); streamReader.Close(); responseStream.Close(); myStream.Close(); if(user != null) { return true; } else { return false; } } catch (WebException ex) { string _exception = ex.ToString(); Toast error = Toast.MakeText(this, _exception, ToastLength.Long); error.Show(); Console.WriteLine("--->" + _exception); return false; } }
private void DeletePortfolioData(data.baseDS.portfolioDetailDataTable dataTbl, string portfolioCode,string code) { for (int idx = 0; idx < dataTbl.Count; idx++) { if (dataTbl[idx].RowState== DataRowState.Deleted) continue; if ( (dataTbl[idx].portfolio==portfolioCode) && (dataTbl[idx].code==code) ) dataTbl[idx].Delete(); } }
private data CreateResponse(List<Sentiment> data) { data r = new data(); foreach (Sentiment s in data) { r.score.Add(s.score.ToString()); r.date.Add(FromUnixTime(s.timestamp).ToString("dd-MM-yyyy")); } return r; }
public static bool ImportOHLCV_CSV(string csvFileName,string stockExchangeForNewCode, data.baseDS.priceDataDataTable priceDataTbl, libs.OnUpdatePriceData onUpdateDataFunc) { return libs.ImportOHLCV_CSV(csvFileName, ',', common.dateTimeLibs.DateTimeFormats.YYMMDD, stockExchangeForNewCode,libs.CultureInfoVN, priceDataTbl, DoImportRow, onUpdateDataFunc, null); }
public void SetKoma(data data) { //(long)koma["posx"],(long)koma["posy"],koma["owner"].ToString(),num,(bool)koma["promote"] Debug.Log ("koma"+data.koma["owner"]); this.Posx = (long)data.koma["posx"]; this.Posy = (long)data.koma["posy"]; this.num = data.num.ToString(); this.owner = data.koma["owner"].ToString(); this.nari = (bool)data.koma["promote"]; }
public Etiqueta(data.Externo.EtiquetasUsuario et, SolidColorBrush color, VentanaDocumentos _parent) { InitializeComponent(); Parent = _parent; lblEtiqueta.Content = et.Etiqueta; Fondo.Fill = color; datosEtiqueta = et; this.Loaded += new RoutedEventHandler(Etiqueta_Loaded); }
//------------------------------------------------------------------- //------------------------------------------------------------------- // メソッド //------------------------------------------------------------------- /// @brief コンストラクタ public PreviewControl(int bound_width, int bound_height, int index_in_layout_parameter_binding_source, data.LayoutParameter layout_parameter) { InitializeComponent(); // メンバの設定 layout_parameter_ = layout_parameter; IndexInLayoutParameterBindingSource = index_in_layout_parameter_binding_source; movable_and_resizable_ = new MovableAndResizable(this, bound_width, bound_height); }
private byte[] _getBytes(data _data) { int size = Marshal.SizeOf(_data); byte[] arr = new byte[size]; IntPtr ptr = Marshal.AllocHGlobal(size); Marshal.StructureToPtr(_data, ptr, true); Marshal.Copy(ptr, arr, 0, size); Marshal.FreeHGlobal(ptr); return arr; }
public bool ShowNew(data.baseDS.tradeAlertRow alertRow) { this.Refresh(); qtyEd.Value = 0; subTotalEd.Value = 0; feeAmtEd.Value = 0; totalAmtEd.Value = 0; portfolioCb.myValue = alertRow.portfolio; codeEd.Text = alertRow.stockCode.Trim(); transTypeCb.myValue = (AppTypes.TradeActions)alertRow.tradeAction; statusCb.myValue = AppTypes.CommonStatus.New; SetFocus(); ShowDialog(); return true; }
public data.ReservationState CreateReservationState(data.ReservationState newReservationState) { var isAlreadyPresent = _ReservationTypes.Collection.FindOne(Query.EQ("name", newReservationState.Name)); if (isAlreadyPresent != null) return isAlreadyPresent; var result = _ReservationTypes.Collection.Insert(newReservationState); if (result.Ok) return newReservationState; return null; }
data fromBytes(byte[] arr) { data str = new data(); int size = Marshal.SizeOf(str); IntPtr ptr = Marshal.AllocHGlobal(size); Marshal.Copy(arr, 0, ptr, size); str = (data)Marshal.PtrToStructure(ptr, str.GetType()); Marshal.FreeHGlobal(ptr); return str; }
private void OnUpdateData(data.baseDS.priceDataRow row, libs.importStat stat) { if (fCanceled) stat.cancel =true; this.ShowMessage(stat.updateCount.ToString("###,###,##0") + "/" + stat.errorCount.ToString("###,###,##0") + "/" + stat.dataCount.ToString("###,###,##0"), "Import"); //Do Aggregate and reset import to clear system resource if (myDataSet.priceData.Count > constNumberOfImportInBatch) { application.DbAccess.UpdateData(myDataSet.priceData); DoAggregate(myDataSet.priceData); myDataSet.priceData.Clear(); } }
protected void ShowTradeTransactions(data.tmpDS.stockCodeRow stockCodeRow, string strategyCode, AppTypes.TimeRanges timeRange,AppTypes.TimeScale timeScale) { string formName = stockCodeRow.code.Trim() + "," + timeRange.ToString() + "," + application.Strategy.Libs.GetMetaName(strategyCode) + "," + timeScale.Code; profitEstimate myForm = profitEstimate.GetForm(formName); myForm.myTimeRange = timeRange; myForm.myTimeScale = timeScale; myForm.myStockCode = stockCodeRow.code; myForm.myOptions = new EstimateOptions(); myForm.myStrategyCode = strategyCode; myForm.ReLoad(); myForm.Text = "(" + formName + ")"; if (this.myDockedPane != null) myForm.Show(this.myDockedPane); else myForm.ShowDialog(); }
public static void calcAll(data[] raw) { for (int i = 0; i < raw.Length; i++) { if (raw[i].norm) { raw[i].c = calcC(raw[i]); Console.Write(" A - {0} ", raw[i].a); Console.Write(" B - {0} ", raw[i].b); Console.Write(" C - {0} ", raw[i].c); Console.Write(" Alpha - {0} ", raw[i].alpha); Console.Write(" Beta - {0} ", calcBeta(raw[i])); Console.WriteLine(" Hamma - {0} ", calcHamma(raw[i])); toFile(raw[i]); } } }
private void button1_Click(object sender, EventArgs e) { Thread th; string tmp; StreamReader file = new StreamReader("D://file.txt"); while ((tmp = file.ReadLine()) != null) { data ps = new data(); ps.from = tmp.Split(':').First(); ps.pswd = tmp.Split(':').Last(); //Send(ps); th = new Thread(Send); th.Start(ps); } MessageBox.Show("Усё"); }
// public void prepData() { bodies = GameObject.FindGameObjectsWithTag("Savable"); _GameItems = new List<data>(); data itm; foreach (GameObject body in bodies) { itm = new data(); itm.ID = body.name + "_" + body.GetInstanceID(); itm.Name = body.name; itm.levelname = Application.loadedLevelName; itm.objectType = body.name.Replace("(Clone)", ""); itm.posx = body.transform.position.x; itm.posy = body.transform.position.y; itm.posz = body.transform.position.z; _GameItems.Add(itm); } Debug.Log("Items in collection: " + _GameItems.Count); }
public void KomaCreate(Dictionary<string,object> koma,string num) { GameObject spremtyPrefab = Resources.Load ("Prefab/koma") as GameObject; GameObject canvas = GameObject.Find ("Canvas") as GameObject; GameObject komaPrefab = Instantiate(spremtyPrefab,new Vector2(0f,0f), Quaternion.Euler(new Vector3( 0,0,EnemyOrAlly (koma,UserManager.Instance.GetplyerID ())))) as GameObject; komaPrefab.GetComponent<Image>().sprite = Resources.Load<Sprite>("Koma/"+(string)koma["name"]); komaPrefab.transform.SetParent (canvas.transform); komaPrefab.GetComponent<RectTransform>().anchoredPosition = new ScreentoboradChange().Screentoboard((long)koma["posx"],(long)koma["posy"],Board); Type ClassName = Type.GetType((string)koma["name"]); var component = komaPrefab.AddComponent(ClassName); Debug.Log ("Shougidata:"+koma["owner"].ToString()); //koma setting data komaData = new data (); komaData.koma = koma; komaData.num = num; komaPrefab.SendMessage ("SetKoma",komaData); }
static void Main(string[] args) { //You can fetch your data from weather API or any Device. Fetching Data is not the key concern here. //This is just a fake Data. The Weather API donot return data every minute or second. So we can not get relative large variety and //and volume in the data. So I have tried to randomize the weather. //While Randomizing the weather, I looked at hourly forcast at any weather forcast site and randomize values around that value, //by adding a slight fluctuation to the value by generating a random number. data mydata = new data(); while (true) { ManagementObjectSearcher searcher = new ManagementObjectSearcher(@"root\WMI", "SELECT * FROM MSAcpi_ThermalZoneTemperature"); foreach (ManagementObject obj in searcher.Get()) { Double temp = Convert.ToDouble(obj["CurrentTemperature"].ToString()); mydata.tempertature = (temp - 2732) / 10.0; mydata.location = obj["InstanceName"].ToString(); //float fluctuation = (rnd.Next(1, 10)); //fluctuation = fluctuation / 10; //float nowtemperature = weatherDictionary[Convert.ToInt16(DateTime.Now.Hour)] + fluctuation mydata.ID = Guid.NewGuid().ToString(); mydata.when = DateTime.Now; mydata.hour = DateTime.Now.Hour; var eventHub = EventHubClient.CreateFromConnectionString(connectionString, eventHubName); eventHub.SendAsync(new EventData(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(mydata)))); Console.WriteLine(JsonConvert.SerializeObject(mydata)); Thread.Sleep(300); } } }
private void AggregatePriceData(data.baseDS myDataSet) { application.importLibs.AggregatePriceData(myDataSet, "vi-VN", onAggregateData); this.ShowMessage(""); cancelBtn.Enabled = false; progressBar.Visible = true; progressBar.Maximum = myDataSet.priceData.Count + myDataSet.priceDataDay.Count + myDataSet.priceDataWeek.Count + myDataSet.priceDataMonth.Count + myDataSet.priceDataYear.Count; progressBar.Value = 0; for (int idx = 0; idx < myDataSet.priceData.Count; idx++) { application.dataLibs.UpdateData(myDataSet.priceData[idx]); progressBar.Value++; Application.DoEvents(); } for (int idx = 0; idx < myDataSet.priceDataDay.Count; idx++) { application.dataLibs.UpdateData(myDataSet.priceDataDay[idx]); progressBar.Value++; } for (int idx = 0; idx < myDataSet.priceDataWeek.Count; idx++) { application.dataLibs.UpdateData(myDataSet.priceDataWeek[idx]); progressBar.Value++; Application.DoEvents(); } for (int idx = 0; idx < myDataSet.priceDataMonth.Count; idx++) { application.dataLibs.UpdateData(myDataSet.priceDataMonth[idx]); progressBar.Value++; Application.DoEvents(); } for (int idx = 0; idx < myDataSet.priceDataYear.Count; idx++) { application.dataLibs.UpdateData(myDataSet.priceDataYear[idx]); progressBar.Value++; Application.DoEvents(); } }
private void MakeIndicatorData(common.myKeyValueItem[] indicatorCode, data.baseDS.priceDataDataTable priceDataTbl, data.baseDS.indicatorDataDataTable toTbl) { common.myKeyValueItem[] smaCodes = new common.myKeyValueItem[0]; common.myKeyValueItem[] macdCodes = new common.myKeyValueItem[0]; for (int idx = 0; idx < indicatorCode.Length; idx++) { if (indicatorCode[idx].Key.StartsWith("SMA")) { Array.Resize(ref smaCodes, smaCodes.Length + 1); smaCodes[smaCodes.Length - 1] = new common.myKeyValueItem(indicatorCode[idx].Key, indicatorCode[idx].Value); continue; } if (indicatorCode[idx].Key.StartsWith("MACD")) { Array.Resize(ref macdCodes, macdCodes.Length + 1); macdCodes[macdCodes.Length - 1] = new common.myKeyValueItem(indicatorCode[idx].Key, indicatorCode[idx].Value); continue; } } }
public ActionResult CodeAdd(RequestFormInfo formInfo, int bl, int kj, int qj, int mr, int jssx, int ff) { //遍历自定义变量并放入集合 List <definition> bianlianglist = new List <definition>(); for (int i = 1; i <= bl; i++) { string desc = Request.Form["bldesc" + i]; string content = Request.Form["bl" + i]; if (!string.IsNullOrWhiteSpace(desc) && !string.IsNullOrWhiteSpace(content)) { definition definition = new definition() { desc = desc, content = content }; bianlianglist.Add(definition); } } //遍历控件部件并放入集合 List <components> kongjianList = new List <components>(); for (int i = 1; i <= kj; i++) { string desc = Request.Form["kjdesc" + i]; string content = Request.Form["kj" + i]; if (!string.IsNullOrWhiteSpace(desc) && !string.IsNullOrWhiteSpace(content)) { components components = new components() { desc = desc, content = content }; kongjianList.Add(components); } } //遍历全局变量并放入集合 List <data> quanjuList = new List <data>(); for (int i = 1; i <= qj; i++) { string content = Request.Form["qjdesc" + i]; string desc = Request.Form["qj" + i]; if (!string.IsNullOrWhiteSpace(content) && !string.IsNullOrWhiteSpace(desc)) { data data = new data() { content = content, desc = desc }; quanjuList.Add(data); } } //遍历默认数据并放入集合 List <@default> morenList = new List <@default>(); for (int i = 1; i <= mr; i++) { string desc = Request.Form["mrdesc" + i]; string key = Request.Form["mrkey" + i]; string value = Request.Form["mrvalue" + i]; if (!string.IsNullOrWhiteSpace(desc) && !string.IsNullOrWhiteSpace(key) && !string.IsNullOrWhiteSpace(value)) { @default @default = new @default() { desc = desc, key = key, value = value }; morenList.Add(@default); } } //遍历计算属性并放入集合 List <computed> jssxList = new List <computed>(); for (int i = 1; i <= jssx; i++) { string jssxname = Request.Form["jssxname" + i]; string jssxdesc = Request.Form["jssxdesc" + i]; string jssxff = Request.Form["jssxff" + i]; if (!string.IsNullOrWhiteSpace(jssxname) && !string.IsNullOrWhiteSpace(jssxdesc) && !string.IsNullOrWhiteSpace(jssxff)) { computed computed = new computed() { desc = jssxdesc, name = jssxname, content = jssxff }; jssxList.Add(computed); } } //遍历控件方法并放入集合 List <rests> qtfangfaList = new List <rests>(); for (int i = 1; i <= ff; i++) { string qtffname = Request.Form["qtffname" + i]; string qtffdesc = Request.Form["qtffdesc" + i]; string qtffti = Request.Form["qtffti" + i]; if (!string.IsNullOrWhiteSpace(qtffname) && !string.IsNullOrWhiteSpace(qtffdesc) && !string.IsNullOrWhiteSpace(qtffti)) { rests rests = new rests() { name = qtffname, desc = qtffdesc, content = qtffti }; qtfangfaList.Add(rests); } } //遍历控件方法并放入集合 List <methods> fangfaList = new List <methods>(); for (int i = 1; i <= ff; i++) { string ffname = Request.Form["ffname" + i]; string ffdesc = Request.Form["ffdesc" + i]; string ffti = Request.Form["ffti" + i]; if (!string.IsNullOrWhiteSpace(ffname) && !string.IsNullOrWhiteSpace(ffdesc) && !string.IsNullOrWhiteSpace(ffti)) { methods methods = new methods() { name = ffname, desc = ffdesc, content = ffti }; fangfaList.Add(methods); } } //调用方法开始进行数据库存储 //实例化代码入库类 CodeDataBase codeInDataBase = new CodeDataBase(); int result = codeInDataBase.AddCodeInBase(formInfo, bianlianglist, kongjianList, quanjuList, morenList, jssxList, qtfangfaList, fangfaList); switch (result) { case 0: return(Json(new { code = 1, msg = "代码入库失败!" }, JsonRequestBehavior.AllowGet)); case 1: return(Json(new { code = 1, msg = "代码入库成功!" }, JsonRequestBehavior.AllowGet)); case 2: return(Json(new { code = 1, msg = "html代码入库失败!" }, JsonRequestBehavior.AllowGet)); case 3: return(Json(new { code = 1, msg = "Css样式入库失败!" }, JsonRequestBehavior.AllowGet)); case 4: return(Json(new { code = 1, msg = "自定义变量入库失败!" }, JsonRequestBehavior.AllowGet)); case 5: return(Json(new { code = 1, msg = "控件部件入库失败!" }, JsonRequestBehavior.AllowGet)); case 6: return(Json(new { code = 1, msg = "全局变量入库失败!" }, JsonRequestBehavior.AllowGet)); case 7: return(Json(new { code = 1, msg = "默认数据入库失败!" }, JsonRequestBehavior.AllowGet)); case 8: return(Json(new { code = 1, msg = "计算属性入库失败!" }, JsonRequestBehavior.AllowGet)); case 9: return(Json(new { code = 1, msg = "控件方法入库失败!" }, JsonRequestBehavior.AllowGet)); case 10: return(Json(new { code = 1, msg = "添加到PageShow页面失败!" }, JsonRequestBehavior.AllowGet)); } return(View()); }
static void Main(string[] args) { Stately stateMachine = new Stately(State.IsimKoku); Stack <data> stack = new Stack <data>(); string suffix = "lerindeki"; int i = 0, j = 1; initilizeMachine(stateMachine); while (true) { string s = suffix.Substring(i, j - i); Console.WriteLine("s: " + s); Console.ReadLine(); if (stateMachine.CanFire(s)) { data d = new data(); d.x = i; d.y = j; d.state = stateMachine.getState(); stateMachine.Fire(s); stack.Push(d); Console.WriteLine("Ek: " + s); Console.ReadLine(); i = j; j++; if (j == suffix.Length + 1) { if (stack.Count != 0) { data daTa = new data(); daTa = stack.Pop(); i = daTa.x; j = daTa.y + 1; stateMachine.setState(daTa.state); } else { break; } } } else { j++; if (j == suffix.Length + 1) { if (stack.Count != 0) { data daTa = new data(); daTa = stack.Pop(); i = daTa.x; j = daTa.y + 1; stateMachine.setState(daTa.state); } else { break; } } } } }
static void Duplicate(object userData) { data input = userData as data; input.list.DuplicateCurrentSnapshot(); }
static void SetAsStartupSnapshot(object userData) { data input = userData as data; input.list.SetAsStartupSnapshot(input.snapshot); }
get => (ushort)Get(data, ActiveVideoStartShift, ActiveVideoStartSize);
get => (ushort)Get(data, ActiveVideoEndShift, ActiveVideoEndSize);
static void Main() { data[] arr = new data[4000]; WebClient wc = new WebClient(); string answer = wc.DownloadString("https://api.meteostat.net/v1/history/daily?station=26666&start=2010-01-01&end=2019-12-31&key=HYvZ90Hg"); int length = answer.Length; int n = answer.Length; int j = 0; int k = 0; bool flag = false; string str = ""; for (int i = 0; i < n - 4; i++) { if (flag == false) { if (answer[i] == 'd' && answer[i + 1] == 'a' && answer[i + 2] == 't' && answer[i + 3] == 'e') { flag = true; i += 6; } if (answer[i] == 't' && answer[i + 1] == 'e' && answer[i + 2] == 'm' && answer[i + 3] == 'p' && answer[i + 4] == 'e' && answer[i + 5] == 'r' && answer[i + 6] == 'a' && answer[i + 7] == 't' && answer[i + 8] == 'u' && answer[i + 9] == 'r' && answer[i + 10] == 'e' && answer[i + 11] == '_') { flag = true; i += 16; if (answer[i] == '\"') { i++; } } else { if (answer[i] == 't' && answer[i + 1] == 'e' && answer[i + 2] == 'm' && answer[i + 3] == 'p' && answer[i + 4] == 'e' && answer[i + 5] == 'r' && answer[i + 6] == 'a' && answer[i + 7] == 't' && answer[i + 8] == 'u' && answer[i + 9] == 'r' && answer[i + 10] == 'e') { flag = true; i += 12; if (answer[i] == '\"') { i++; } } } } else { if ((answer[i] >= '0' && answer[i] <= '9') || (answer[i] >= '9' && answer[i] <= '0') || answer[i] == '-' || answer[i] == 'n' || answer[i] == 'u' || answer[i] == 'l' || answer[i] == '.') { if (answer[i] == '.') { str += ','; } else { str += answer[i]; } } else { flag = false; switch (k % 4) { case 0: { arr[j].date = str; Class1.transs[j] = str; break; } case 1: { arr[j].temp = str; break; } case 2: { arr[j].tempmi = str; break; } case 3: { arr[j].tempma = str; j++; break; } } k++; str = ""; } } } Class1.num = j; n = j; for (int i = 0; i < n; i++) { if (arr[i].temp == "null") { if (arr[i].tempmi != "null" && arr[i].tempma != "null") { double a1 = Convert.ToDouble(arr[i].tempmi); double a2 = Convert.ToDouble(arr[i].tempma); double a3 = (a1 + a2) / 2; arr[i].temp = Convert.ToString(a3); } else { if (arr[i].tempmi == "null" && arr[i].tempma == "null") { arr[i].temp = arr[i - 1].temp; } else { if (arr[i].tempmi != "null") { arr[i].temp = arr[i].tempmi; } else { arr[i].temp = arr[i].tempma; } } } } Class1.transi[i] = Convert.ToDouble(arr[i].temp); } Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); }
private void btSend_Click(object sender, EventArgs e) { Documento doc = CrearDocumentoEjemplo(); var ticketBai = TicketBaiFactory.GetTicketBai(doc); var xmlParser = new XmlParser(); var signer = new TicketBai.Xades.Signer.TicketBaiSigner(new CanonicalizationMethodDsigC14N(), new DigestMethodSHA512(), new SHA256Managed()); var xml = xmlParser.GetString(ticketBai, new Dictionary <string, string>() { { "T", "urn:ticketbai:emision" }, }); signer.Load(xml); var certificado = CargaCertificado(); signer.Sign(certificado); var peticion = new PeticionHttp(Url.UrlProduccionEnvio); var tBaiSigned = $"<?xml version=\"1.0\" encoding=\"UTF-8\"?>{signer.XmlSigned}"; File.WriteAllText(@"C:\Users\usuario\Downloads\TEST ALTA\TBAI.xml", tBaiSigned); LROEPF140IngresosConFacturaConSGAltaPeticion alta = new LROEPF140IngresosConFacturaConSGAltaPeticion() { Cabecera = new Cabecera() { Modelo = "140", Capitulo = "1", Subcapitulo = "1.1", Operacion = "A00", Version = "1.0", Ejercicio = "2021", ObligadoTributario = new ObligadoTributario() { NIF = "19006851L", ApellidosNombreRazonSocial = "DIAGO GARCIA MANUEL" } }, Ingresos = new List <Ingreso>() { new Ingreso() { TicketBai = Encoding.UTF8.GetBytes(tBaiSigned), Renta = new List <DetalleRenta>() { new DetalleRenta() { Epigrafe = "1845" } } } } }; XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); ns.Add("lrpficfcsgap", "https://www.batuz.eus/fitxategiak/batuz/LROE/esquemas/LROE_PF_140_1_1_Ingresos_ConfacturaConSG_AltaPeticion_V1_0_2.xsd"); XmlSerializer serializer = new XmlSerializer(alta.GetType()); //LROEPF140IngresosConFacturaConSGAltaPeticion ejemplo = null; //using (Stream reader = new FileStream(@"C:\Users\usuario\Downloads\TEST ALTA\EJEMPLO.xml", FileMode.Open)) // ejemplo = (LROEPF140IngresosConFacturaConSGAltaPeticion)serializer.Deserialize(reader); //File.WriteAllText(@"C:\Users\usuario\Downloads\TEST ALTA\EJEMPLO_TBAI.xml", Encoding.UTF8.GetString(ejemplo.Ingresos[0].TicketBai)); // Create an XmlTextWriter using a FileStream. MemoryStream ms = new MemoryStream(); XmlWriter writer = new XmlTextWriter(ms, Encoding.UTF8); // Serialize using the XmlTextWriter. serializer.Serialize(writer, alta, ns); writer.Close(); var bytesPeticion = ms.ToArray(); //var ticketBaiFirmado = $"<?xml version=\"1.0\" encoding=\"UTF-8\"?>{signer.XmlSigned}"; //var ticketBaiFirmado = File.ReadAllText(@"C:\Users\usuario\Downloads\Ejemplos\Ejemplo_TicketBAI_79732487C_A2022_0399.xml"); //var bytesPeticion = peticion.Encoding.GetBytes(ticketBaiFirmado); //bytesPeticion = Encoding.UTF8.GetBytes(File.ReadAllText(@"C:\Users\usuario\Downloads\Ejemplos\Ejemplo_1_LROE_PF_140_IngresosConFacturaConSG_79732487C.xml")); byte[] bytesPeticionComprimida; using (var outStream = new MemoryStream()) { using (var tinyStream = new GZipStream(outStream, CompressionMode.Compress)) using (var mStream = new MemoryStream(bytesPeticion)) mStream.CopyTo(tinyStream); bytesPeticionComprimida = outStream.ToArray(); } var dat = new data("1.1", new inte() { nif = "19006851L", nrs = "MANUEL", ap1 = "DIAGO", ap2 = "GARCIA" }, "140", "2021"); var json = $"{dat}"; peticion.Peticion.Headers["eus-bizkaia-n3-data"] = json; peticion.Peticion.ContentLength = bytesPeticionComprimida.Length; peticion.Peticion.ClientCertificates.Add(certificado); using (Stream stream = peticion.Peticion.GetRequestStream()) stream.Write(bytesPeticionComprimida, 0, bytesPeticionComprimida.Length); HttpWebResponse response = (HttpWebResponse)peticion.Peticion.GetResponse(); string statusDescription = response.StatusDescription; Stream dataStream = response.GetResponseStream(); string responseFromServer; using (StreamReader reader = new StreamReader(dataStream)) { responseFromServer = reader.ReadToEnd(); reader.Close(); dataStream.Close(); response.Close(); } }
public List <strAllTest> AllTasts(string userNumber) { try { string strUrl = ConstCommon.TestIPString + "?UserNumber=33" + userNumber + ""; Uri uri = new Uri(strUrl); System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(uri); request.Method = "GET"; request.ContentType = "application/x-www-form-urlencoded"; request.AllowAutoRedirect = false; request.Timeout = 5000; System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse(); Stream responseStream = response.GetResponseStream(); StreamReader readStream = new StreamReader(responseStream, System.Text.Encoding.UTF8); string retext = readStream.ReadToEnd().ToString(); readStream.Close(); test testModel = TF.CommonUtility.JsonConvert.JsonDeserialize <test>(retext); List <strAllTest> strAllTest = new List <strAllTest>(); if (Convert.ToInt32(testModel.result) == 1) { } else { data da = testModel.data; int n = 0; foreach (ArrayError a in da.ArrayError) { if (n >= 3) { break; } else { n++; } if (a.strTrueAnswer == "F") { a.strTrueAnswer = "错误"; } else if (a.strTrueAnswer == "T") { a.strTrueAnswer = "正确"; } else { } if (a.strSelectAnswer == "F") { a.strSelectAnswer = "错误"; } else if (a.strSelectAnswer == "T") { a.strSelectAnswer = "正确"; } else { } string strAnswers = ""; foreach (OPtion op in a.OPtion) { strAnswers += op.Name + " "; } strAllTest.Add(new strAllTest { strName = a.strTestName, strTrue = a.strTrueAnswer, strSelect = a.strSelectAnswer, Answers = strAnswers }); } } return(strAllTest); } catch { return(null); } //获取考试记录结束 }
public void insertList(data d, int index) { d.dataIsEmpty = false; dataList.Insert(index, d); }
public void editList(data d, int index) { d.dataIsEmpty = false; dataList[index] = d; }
internal void processToScreen() { toolTip1.RemoveAll(); Params.Items.Clear(); Params.Objects.ForEach(x => { Params.RemoveObject(x); }); Params.CellEditActivation = ObjectListView.CellEditActivateMode.SingleClick; Params.CanExpandGetter = delegate(object x) { var y = (data)x; if (y.children != null && y.children.Count > 0) { return(true); } return(false); }; Params.ChildrenGetter = delegate(object x) { var y = (data)x; return(new ArrayList(y.children)); }; //Params.Sort(Params.Columns[0], ListSortDirection.Ascending); var sorted = new List <string>(); foreach (string item in MainV2.comPort.MAV.param.Keys) { sorted.Add(item); } sorted.Sort(); var roots = new List <data>(); var lastroot = new data(); // process hashdefines and update display foreach (var value in sorted) { if (value == null || value == "") { continue; } //System.Diagnostics.Debug.WriteLine("Doing: " + value); var data = new data(); var split = value.Split('_'); data.root = split[0]; data.paramname = value; data.Value = ((float)MainV2.comPort.MAV.param[value]).ToString(); try { var metaDataDescription = ParameterMetaDataRepository.GetParameterMetaData(value, ParameterMetaDataConstants.Description, MainV2.comPort.MAV.cs.firmware.ToString()); if (!string.IsNullOrEmpty(metaDataDescription)) { var range = ParameterMetaDataRepository.GetParameterMetaData(value, ParameterMetaDataConstants.Range, MainV2.comPort.MAV.cs.firmware.ToString()); var options = ParameterMetaDataRepository.GetParameterMetaData(value, ParameterMetaDataConstants.Values, MainV2.comPort.MAV.cs.firmware.ToString()); var units = ParameterMetaDataRepository.GetParameterMetaData(value, ParameterMetaDataConstants.Units, MainV2.comPort.MAV.cs.firmware.ToString()); data.unit = (units); data.range = (range + options.Replace(",", " ")); data.desc = (metaDataDescription); } if (lastroot.root == split[0]) { lastroot.children.Add(data); } else { var newroot = new data { root = split[0], paramname = split[0] }; newroot.children.Add(data); roots.Add(newroot); lastroot = newroot; } } catch (Exception ex) { log.Error(ex); } } foreach (var item in roots) { // if the child has no children, we dont need the root. if (item.children.Count == 1) { Params.AddObject(item.children[0]); continue; } Params.AddObject(item); } }
public int peek(data dat) { return(dat.Stack.Peek()); }
public void setData(data ds) { }
/// <summary>根据数据区实例化</summary> /// <param name="data"></param> /// <param name="offset"></param> /// <param name="count"></param> public Packet(Byte[] data, Int32 offset = 0, Int32 count = -1) => Set(data, offset, count);
public void setData(data ds) { _ds = ds; }
set => Set(ref data, ActiveVideoEndShift, ActiveVideoEndSize, value);
string fn2(string sz, data d) { return(sz + "\r\nfn2"); }
set => Set(ref data, ActiveVideoStartShift, ActiveVideoStartSize, value);
string fn1(string sz, data d) { return(sz + "\r\nfn1"); }
static void Rename(object userData) { data input = userData as data; input.list.Rename(input.snapshot); }
=> new ValueTask <(int, int)?>(Read(data, position, dest, offset, count));
static void Delete(object userData) { data input = userData as data; input.list.DeleteSnapshot(input.snapshot); }
public void setFiltros(data data) { dataFiltros = data; }
Id = ExportObject(this, location, data, restart, port);
public IActionResult Requestapproval(data data) { CResutlWebMethod result = new CResutlWebMethod(); PTTGSP_DWSContext db = new PTTGSP_DWSContext(); result.sStatus = STFunction.process_Success(); try { ///-----------TB_Stock_Update TB_Stock_Update tb_stock_update = db.TB_Stock_Update.Where(w => w.nRequestID == data.oV_Stock_Update.nRequestID).FirstOrDefault(); if (tb_stock_update == null) { tb_stock_update = new TB_Stock_Update(); var countrunning = db.TB_Stock_Update.Where(w => w.dCreate.Month == DateTime.Now.Month && w.dCreate.Year == DateTime.Now.Year).ToList().Count(); var running = "AS-" + DateTime.Now.AddYears(543).Year.ToString().Substring(2) + String.Format("{0:D2}", DateTime.Now.Month) + String.Format("{0:D4}", countrunning); tb_stock_update.sRequestNo = running; tb_stock_update.dCreate = DateTime.Now; db.TB_Stock_Update.Add(tb_stock_update); } tb_stock_update.nStepID = data.oV_Stock_Update.nStepID ?? 0; tb_stock_update.dUpdateStockDate = Convert.ToDateTime(data.oV_Stock_Update.sUpdatekc); tb_stock_update.sReason = data.oV_Stock_Update.sReason; tb_stock_update.nTotalPrice_Minus = data.oV_Materials.Select(s => s.nTotalPrice_Minus ?? 0).Sum(); tb_stock_update.nTotalPrice_Plus = data.oV_Materials.Select(s => s.nTotalPrice_Plus ?? 0).Sum(); tb_stock_update.nStepID = 1; tb_stock_update.dUpdate = DateTime.Now; db.SaveChanges(); ///-----------TB_Stock_Update_Material List <TB_Stock_Update_Material> list_stock_update_material = db.TB_Stock_Update_Material.Where(w => w.nRequestID == tb_stock_update.nRequestID).ToList(); if (list_stock_update_material != null) { foreach (TB_Stock_Update_Material otb_stock_update_material in list_stock_update_material) { db.TB_Stock_Update_Material.Remove(otb_stock_update_material); } } foreach (V_Materials ov_materials in data.oV_Materials) { TB_Stock_Update_Material otb_stock_update_material = new TB_Stock_Update_Material(); otb_stock_update_material.nRequestID = tb_stock_update.nRequestID; otb_stock_update_material.nMaterialID = ov_materials.nMaterialID; otb_stock_update_material.nAmount = ov_materials.nAmount; otb_stock_update_material.sCause = ov_materials.sReason; db.TB_Stock_Update_Material.Add(otb_stock_update_material); db.SaveChanges(); } TB_Stock_Update_Approval otb_stock_update_approval = new TB_Stock_Update_Approval(); otb_stock_update_approval.nActionID = 1; otb_stock_update_approval.dCreate = DateTime.Now; otb_stock_update_approval.nRequestID = tb_stock_update.nRequestID; db.TB_Stock_Update_Approval.Add(otb_stock_update_approval); db.SaveChanges(); } catch (Exception e) { result.sStatus = SysFunc.process_Error; result.sMsg = e.Message; } return(Ok(result)); }
if (!TryEncrypt(data, output, padding, out int bytesWritten)) {
private void getData() { try { using (WebClient client = new WebClient()) { string btcJson = client.DownloadString("http://coincap.io/page/BTC/"); string ethJson = client.DownloadString("http://coincap.io/page/ETH/"); string ltcJson = client.DownloadString("http://coincap.io/page/LTC/"); string adaJson = client.DownloadString("http://coincap.io/page/ADA/"); string xmrJson = client.DownloadString("http://coincap.io/page/XMR/"); string vtcJson = client.DownloadString("http://coincap.io/page/VTC/"); string navJson = client.DownloadString("http://coincap.io/page/NAV/"); string grsJson = client.DownloadString("http://coincap.io/page/GRS/"); btcJson = format(btcJson); ethJson = format(ethJson); ltcJson = format(ltcJson); adaJson = format(adaJson); xmrJson = format(xmrJson); vtcJson = format(vtcJson); navJson = format(navJson); grsJson = format(grsJson); data bitcoin = JsonConvert.DeserializeObject <data>(btcJson); data ether = JsonConvert.DeserializeObject <data>(ethJson); data litecoin = JsonConvert.DeserializeObject <data>(ltcJson); data cardano = JsonConvert.DeserializeObject <data>(adaJson); data monero = JsonConvert.DeserializeObject <data>(xmrJson); data vertcoin = JsonConvert.DeserializeObject <data>(vtcJson); data nav = JsonConvert.DeserializeObject <data>(navJson); data groestl = JsonConvert.DeserializeObject <data>(grsJson); // Bitcoin btcPrice.Text = bitcoin.price.ToString("C"); btcMarketCap.Text = bitcoin.marketCap.ToString("C0"); btcVolume.Text = bitcoin.volume.ToString("C0"); btcSupply.Text = bitcoin.supply.ToString("N0"); btcChange.Text = bitcoin.percentChange.ToString() + "%"; // Ethereum ethPrice.Text = ether.price.ToString("C"); ethMarketCap.Text = ether.marketCap.ToString("C0"); ethVolume.Text = ether.volume.ToString("C0"); ethSupply.Text = ether.supply.ToString("N0"); ethChange.Text = ether.percentChange.ToString() + "%"; // Litecoin ltcPrice.Text = litecoin.price.ToString("C"); ltcMarketCap.Text = litecoin.marketCap.ToString("C0"); ltcVolume.Text = litecoin.volume.ToString("C0"); ltcSupply.Text = litecoin.supply.ToString("N0"); ltcChange.Text = litecoin.percentChange.ToString() + "%"; // Cardano adaPrice.Text = cardano.price.ToString("C"); adaMarketCap.Text = cardano.marketCap.ToString("C0"); adaVolume.Text = cardano.volume.ToString("C0"); adaSupply.Text = cardano.supply.ToString("N0"); adaChange.Text = cardano.percentChange.ToString() + "%"; // Monero xmrPrice.Text = monero.price.ToString("C"); xmrMarketCap.Text = monero.marketCap.ToString("C0"); xmrVolume.Text = monero.volume.ToString("C0"); xmrSupply.Text = monero.supply.ToString("N0"); xmrChange.Text = monero.percentChange.ToString() + "%"; // Vertcoin vtcPrice.Text = vertcoin.price.ToString("C"); vtcMarketCap.Text = vertcoin.marketCap.ToString("C0"); vtcVolume.Text = vertcoin.volume.ToString("C0"); vtcSupply.Text = vertcoin.supply.ToString("N0"); vtcChange.Text = vertcoin.percentChange.ToString() + "%"; // NAV navPrice.Text = nav.price.ToString("C"); navMarketCap.Text = nav.marketCap.ToString("C0"); navVolume.Text = nav.volume.ToString("C0"); navSupply.Text = nav.supply.ToString("N0"); navChange.Text = nav.percentChange.ToString() + "%"; // Groestl grsPrice.Text = groestl.price.ToString("C"); grsMarketCap.Text = groestl.marketCap.ToString("C0"); grsVolume.Text = groestl.volume.ToString("C0"); grsSupply.Text = groestl.supply.ToString("N0"); grsChange.Text = groestl.percentChange.ToString() + "%"; } } catch (Exception) { dataTimer.Stop(); } }
public void addList(data d) { d.dataIsEmpty = false; dataList.Add(d); }
string fn3(string sz, data d) { return(sz + "\r\nfn3"); }