static points arraytotree(String[] answer, points root, int pos) { //Terminate recursion is all elements of array have been visited if (pos >= answer.Length) { return(null); } //Create the tree node from array element. root = new points(Convert.ToInt32(answer[pos])); if (root.data == 999) { return(root = null); } //Go down recursively adding in all left child elements root.lside = arraytotree(answer, root.lside, 2 * pos + 1); //Go down recursively adding in all the right child elements root.rside = arraytotree(answer, root.rside, 2 * pos + 2); return(root); }
void setPointInfo(points a, GameObject parent, float r, Color color, Vector3 pos) { a.setParent(parent); a.setSize(r); a.setColor(color); a.setPosition(pos); }
public void OnDrawGizmosSelected() { Gizmos.color = Color.green; for (int j = 0; j < curveCount; j++) { for (int i = 1; i < 50; i++) { float t = (i - 1f) / 49f; float t1 = i / 49f; int indexLeft = j * 3; points p0 = (points)pointsList[indexLeft]; points p1 = (points)pointsList[indexLeft + 1]; points p2 = (points)pointsList[indexLeft + 2]; points p3 = (points)pointsList[indexLeft + 3]; Gizmos.DrawLine(CalculateCubicBezierPoint(t, ConvertToVector3(p0.point), ConvertToVector3(p1.point), ConvertToVector3(p2.point), ConvertToVector3(p3.point)), CalculateCubicBezierPoint(t1, ConvertToVector3(p0.point), ConvertToVector3(p1.point), ConvertToVector3(p2.point), ConvertToVector3(p3.point))); } } if (curveCount > 0) { Gizmos.color = Color.red; for (int i = 1; i < 50; i++) { float t = (i - 1f) / 49f; float t1 = i / 49f; points p0 = (points)pointsList [selectButton]; points p1 = (points)pointsList [selectButton + 1]; points p2 = (points)pointsList [selectButton + 2]; points p3 = (points)pointsList [selectButton + 3]; Gizmos.DrawLine(CalculateCubicBezierPoint(t, ConvertToVector3(p0.point), ConvertToVector3(p1.point), ConvertToVector3(p2.point), ConvertToVector3(p3.point)), CalculateCubicBezierPoint(t1, ConvertToVector3(p0.point), ConvertToVector3(p1.point), ConvertToVector3(p2.point), ConvertToVector3(p3.point))); } } }
static points deserializetotree(string ser, points root, int pos) { string[] answer = ser.Split(','); root = arraytotree(answer, root, 0); return(root); }
void OnTriggerEnter(Collider other) { points pp = GameObject.FindWithTag("Points").GetComponent <points> (); float oldPoints = pp.getPoints(); float newPoints = oldPoints + 150; pp.setPoints(newPoints); }
private void button1_Click(object sender, EventArgs e) { int rib = (int)Math.Sqrt(KSVD_Depth); if (rib * rib < KSVD_Depth) { rib = (int)Math.Sqrt(KSVD_Depth) + 1; } Bitmap InputBitmap = (Bitmap)Bitmap.FromFile("Kawasaki_Valencia_2007_09_320x240.bmp"); Bitmap SparseDicBitmap = new Bitmap((N + 1) * rib, (N + 1) * rib, System.Drawing.Imaging.PixelFormat.Format24bppRgb); int[,] memory = new int[InputBitmap.Width, InputBitmap.Height]; for (points A = new points(InputBitmap.Width, InputBitmap.Height); A.DoIt; A.Inc()) { memory[A.x, A.y] = (int)(InputBitmap.GetPixel(A.x, A.y).GetBrightness() * 255.0); } Matrix[] Dictionairy = new Matrix[N * N]; Matrix PatchOut = new Matrix(N, 0); double[,] pixels = new double[InputBitmap.Width, InputBitmap.Height]; for (int i = 0; i < N * N; i++) { Dictionairy[i] = new Matrix(N, 0); } for (int p = 0; p < KSVD_Depth; p++) { Dictionairy[p].Fill(0); for (points A = new points(InputBitmap.Width / N, InputBitmap.Height / N); A.DoIt; A.Inc()) { Matrix PatchIn = GetMemory(A, memory); if (p == 0) { PatchOut = PatchIn.Average(); setPatch(A, pixels, PatchOut); } else { getpatch(A, pixels, ref PatchOut); PatchOut += (Matrix.Dot(PatchIn - PatchOut, Dictionairy[p - 1]) * Dictionairy[p - 1]); setPatch(A, pixels, PatchOut); } Matrix d = (PatchIn - PatchOut); d.Normalize(); Dictionairy[p] = Dictionairy[p] + Matrix.Sign(d, Dictionairy[p]); DrawPatch(A, InputBitmap, PatchOut); } PicImage.Image = Helper.scaler(InputBitmap, 4, InterpolationMode.NearestNeighbor); PicImage.Refresh(); Dictionairy[p].Normalize(); } DrawCoefs(SparseDicBitmap, Dictionairy, rib, KSVD_Depth); }
private void Awake() { if (singleton == null) { singleton = this; return; } Destroy(this); }
private void getpatch(points A, double[,] fpixels, ref Matrix Outp) { for (int x = 0; x < N; x++) { for (int y = 0; y < N; y++) { Outp.Values[x + y * N] = fpixels[A.x * N + x, A.y *N + y]; } } }
private void setPatch(points A, double[,] fpixels, Matrix Outp) { for (int x = 0; x < N; x++) { for (int y = 0; y < N; y++) { fpixels[A.x * N + x, A.y *N + y] = Outp.Values[x + y * N]; } } }
public static void Main() { const int SIZE = 100000; points[] point = new points [SIZE]; byte option; uint totalpoints = 0; do { Console.WriteLine("1. Add data"); Console.WriteLine("2. Display entered points"); Console.WriteLine("3.Calculate average"); Console.WriteLine("0. Exit"); option = Convert.ToByte(Console.ReadLine()); Console.Clear(); switch (option) { case 0: break; case 1: Console.WriteLine("Enter the x"); point[totalpoints].x = Convert.ToSingle(Console.ReadLine()); Console.WriteLine("Enter the y"); point[totalpoints].y = Convert.ToSingle(Console.ReadLine()); totalpoints++; Console.WriteLine(); break; case 2: for (uint i = 0; i < totalpoints; i++) { Console.Write("Point {0} = ", i + 1); Console.WriteLine("({0} , {1})", point[i].x, point[i].y); } break; case 3: float sumX = 0; float sumY = 0; for (uint i = 0; i < totalpoints; i++) { sumX += point[i].x; sumY += point[i].y; } Console.WriteLine("Average x = {0}", sumX / totalpoints); Console.WriteLine("Average y = {0}", sumY / totalpoints); Console.WriteLine(); break; } } while (option != 0); }
//---------------------------------- private Matrix GetMemory(points A, int[,] dat) { Matrix M = new Matrix(N); for (int x = 0; x < N; x++) { for (int y = 0; y < N; y++) { M.Values[x + y * N] = dat[A.x * N + x, A.y *N + y]; } } return(M); }
void draw() { foreach (points a in pointsGroup) { a.destroy(); } foreach (Vector3 pos in pointsPos) { points a = new points(); pointsGroup.Add(a); setPointInfo(a, parent, 0.1f, pointsColor, pos); } }
public Vector3 CalculateCubicBezierPoint(float t, Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3) { float u = 1 - t; float tt = t * t; float uu = u * u; float uuu = uu * u; float ttt = tt * t; Vector3 p = uuu * p0; p += 3 * uu * t * p1; p += 3 * u * tt * p2; p += ttt * p3; return(p); }
void OnCollisionEnter(Collision collision) { if (!hasCollided) { if (collision.gameObject.name == "Bowling Ball" || collision.gameObject.tag == "Pin") { GameObject aa = GameObject.FindWithTag("Points"); points bb = aa.GetComponent <points> (); float cc = bb.getPoints(); cc = cc + 10; bb.setPoints(cc); hasCollided = true; } } }
public static int Weight(this points ps, int x, int y, int width, int height) { int weight = 0; for (int i = Math.Max(x - 1, 0); i < Math.Min(width, x + 1)) { for (int j = Math.Max(y - 1, 0), j < Math.Min(height, y + 1)) { if (ps.Any(a => a.X == i && a.Y == j)) { weight++; } } } return(weight); }
public ActionResult charts() { var sr = new StreamReader(Request.InputStream); var stream = sr.ReadToEnd(); JavaScriptSerializer js = new JavaScriptSerializer(); var list = js.Deserialize <DropDownList>(stream); DropDownList dd = list; string collectionName = "elasticity_v5"; string title1 = ""; string title2 = ""; string title3 = ""; switch (dd.t1) { case "All categories": title1 = "All categories"; break; default: title1 = dd.t1; title2 = dd.t2; title3 = dd.t3; break; } getAllData(collectionName, title1, title2, title3); int nid = 0; pl1 = pl.OrderBy(o => o.Category).ToList(); pl2 = pl1.OrderBy(o => o.Quintile).ToList(); for (int i = 0; i < pl.Count(); i++) { points temp = pl2.ElementAt(i); nid++; temp.number = nid; pl3.Add(temp); } if (dd != null) { return(Json(pl3.ToJson())); } else { return(Json("Error")); } }
//---------------------------------- private void DrawPatch(points A, Bitmap bmp, Matrix Outp) { for (int x = 0; x < N; x++) { for (int y = 0; y < N; y++) { int c = (int)(Outp.Values[x + y * N]); if (c < 0) { c = 0; } if (c > 255) { c = 255; } bmp.SetPixel(A.x * N + x, A.y * N + y, Color.FromArgb(255, c, c, c)); } } }
static points createTreeFromArray(int[] pdataarray, points root, int pos) { //Terminate recursion is all elements of array have been visited if (pos >= pdataarray.Length) { return(null); } //Create the tree node from array element. root = new points(pdataarray[pos]); //Go down recursively adding in all left child elements root.lside = createTreeFromArray(pdataarray, root.lside, 2 * pos + 1); //Go down recursively adding in all the right child elements root.rside = createTreeFromArray(pdataarray, root.rside, 2 * pos + 2); return(root); }
private int cluster(List <points> points, points pt, int numPoints, int id) { foreach (points point in points) { if (point == pt) { continue; } if (point.classId == 0) { if (Vector3.Distance(pt.position, point.position) < handRadius) { point.classId = id; cluster(points, point, numPoints, id); numPoints++; } } } return(numPoints); }
static string serializeTree(treeresult pt, string ser) { Queue <points> q = new Queue <points>(); q.Enqueue(pt.head); while (q.Count > 0) { points node = new points(); node = q.Dequeue(); ser += node.data.ToString() + ","; if (node.data == 999) { continue; } if (node.lside != null) { q.Enqueue(node.lside); } else { points p1 = new points(999); q.Enqueue(p1); } if (node.rside != null) { q.Enqueue(node.rside); } else { points p1 = new points(999); q.Enqueue(p1); } } return(ser); }
//参考ページhttps://cppx.hatenablog.com/entry/2017/12/25/231121#get_center pythonだけど・・・ private float getEyePoint(points,left = true) { int[] lefteye = new int[6] {points[36],points[37],points[38],points[39],points[40],points[41]}; int[] rigtheye = new int[6] {points[42],points[43],points[44],points[45],points[46],points[47]}; //画像から見えている座標を選定する。 int lefteye1 = lefteye[2](x => x.y)); //points[37] int lefteye2 = lefteye[3](x => x.y)); //points[38] int eyemin = Mathf.min(lefteye1,lefteye2); int lefteye3 = lefteye[4](x => x.y)); //points[37] int lefteye4 = lefteye[5](x => x.y)); //points[38] int eyemax = Mathf.max(lefteye3,lefteye4); //視点移動量は両目同じと想定(ばらばらに瞳動かせる特殊な人はそうそういませんよね) org_x = eyes[0].x //x軸 org_y = eyes[1].y //y軸 //目が閉じていたら処理完了 if is_close(org_y, eyes[2].y): return None //二値化はいらない?// }
static void BFS(treeresult pt) { Queue <points> q = new Queue <points>(); q.Enqueue(pt.head); while (q.Count > 0) { points node = new points(); node = q.Dequeue(); Console.Write(node.data); if (node.lside != null) { q.Enqueue(node.lside); } if (node.rside != null) { q.Enqueue(node.rside); } } }
CalculateFinalDifferences(points, step);
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { check ck = new check(); data_conn cn = new data_conn(); string sql = ""; sql = sql + "select * "; sql = sql + "from TB_User "; sql = sql + "where UserName = '******'"; DataSet ds = new DataSet(); ds = cn.mdb_ds(sql, "T_User"); if (ds.Tables["T_User"].Rows.Count > 0) { MessageBox("opfail", "用户名已有人使用"); return; } else if (UserPassword.Value.Length < 6 || UserPassword.Value.Length > 15) { MessageBox("opfail", "密码长度必须在6~15个字符之间"); return; } else if (Company.Value == "" || RealName.Value == "" || Phone.Value == "" || UserEmail.Value == "") { MessageBox("opfail", "必填项不能为空"); return; } else if (!isEmail(UserEmail.Value)) { MessageBox("opfail", "邮箱格式不正确"); return; } else if (UserPassword.Value != UserPassword2.Value) { MessageBox("opfail", "2次密码不一致"); return; } else if (!Checkbox1.Checked) { MessageBox("opfail", "请仔细阅读并同意服务条款"); return; } string recommendUserID; if (this.Request.Cookies["recommendUserID"] == null) { recommendUserID = "0"; } else { if (this.Request.Cookies["recommendUserID"].Value == "") { recommendUserID = "0"; } else { recommendUserID = Request.Cookies["recommendUserID"].Value; } } if (this.Request.Cookies["UID"] == null) { } else { if (Request.Cookies["UID"].Value == "") { } else { data_conn Uidcn = new data_conn(); DataSet Uidds = Uidcn.mdb_ds("select UserID from TB_User where UCenterHomeUid=" + Request.Cookies["UID"].Value, "uid"); if (Uidds.Tables["uid"].Rows.Count == 1) { recommendUserID = Uidds.Tables["uid"].Rows[0][0].ToString(); mysqldata_conn mycn = new mysqldata_conn(); mycn.mdb_exe("update uchome_space set credit=credit+10 where uid=" + Request.Cookies["UID"].Value); } } } sql = ""; sql += "INSERT INTO "; sql += "TB_User "; sql += "("; sql += "UserName, "; sql += "UserPassword, "; sql += "UserEmail, "; sql += "UserPoint, "; sql += "RealName, "; sql += "IfPass, "; sql += "ifvip, "; sql += "ifmanage, "; sql += "CompanyName, "; sql += "Phone, "; sql += "Regtime)"; sql += "VALUES "; sql += "("; sql += "'" + ck.CheckInput(UserName.Value.ToString()) + "', "; sql += "'" + ck.CheckInput(UserPassword.Value.ToString()) + "', "; sql += "'" + ck.CheckInput(UserEmail.Value.ToString()) + "', "; sql += "0, "; sql += "'" + ck.CheckInput(RealName.Value.ToString()) + "', "; sql += "1, "; sql += "1, "; sql += "0, "; sql += "'" + ck.CheckInput(Company.Value.ToString()) + "', "; sql += "'" + ck.CheckInput(Phone.Value.ToString()) + "', "; sql += "'" + ck.CheckInput(DateTime.Now.ToString()) + "' "; sql += ")"; cn.mdb_exe(sql); sql = "SELECT * FROM TB_User WHERE UserName = '******'"; ds = cn.mdb_ds(sql, "user"); string sql_account = "insert into TB_ORDER_ACCOUNT (userid) VALUES (" + ds.Tables["user"].Rows[0]["UserID"].ToString() + ")"; cn.mdb_exe(sql_account); //增加账户信息 AllinOrder AllinOrder1 = new AllinOrder(); AllinOrder1.SetOrderTry(ds.Tables["user"].Rows[0]["UserID"].ToString()); if (ds.Tables["user"].Rows.Count != 0) { try { points p = new points(); p.AddNewPoints(ds.Tables["user"].Rows[0]["UserID"].ToString()); } catch (Exception ex) { } string userid = ds.Tables["user"].Rows[0]["UserID"].ToString(); string usernm = ds.Tables["user"].Rows[0]["UserName"].ToString(); string ifvip = ds.Tables["user"].Rows[0]["ifvip"].ToString(); string ifmanage = ds.Tables["user"].Rows[0]["ifmanage"].ToString(); string realname = ds.Tables["user"].Rows[0]["realname"].ToString(); string useremail = ds.Tables["user"].Rows[0]["useremail"].ToString(); Response.Cookies["user_id"].Value = userid; Response.Cookies["user_name"].Value = Server.UrlEncode(usernm); Response.Cookies["ifvip"].Value = ifvip; Response.Cookies["ifmanage"].Value = ifmanage; Response.Cookies["user_id"].Expires = DateTime.Now.AddDays(365); Response.Cookies["user_name"].Expires = DateTime.Now.AddDays(365); Response.Cookies["ifvip"].Expires = DateTime.Now.AddDays(365); Response.Cookies["ifmanage"].Expires = DateTime.Now.AddDays(365); Response.Cookies["realname"].Value = Server.UrlEncode(realname); Response.Cookies["useremail"].Value = Server.UrlEncode(useremail); Response.Cookies["realname"].Expires = DateTime.Now.AddDays(365); Response.Cookies["useremail"].Expires = DateTime.Now.AddDays(365); if (recommendUserID != "0") { cn.mdb_exe("insert into T_FRIEND (UID,FID) values (" + userid + "," + recommendUserID + ")"); cn.mdb_exe("insert into T_FRIEND (UID,FID) values (" + recommendUserID + "," + userid + ")"); Mark mark = new Mark(); mark.MarkOperate(Convert.ToInt32(recommendUserID), 10, "推荐会员", Convert.ToInt32(userid)); } mysqldata_conn mysqlcn = new mysqldata_conn(); DataSet dscount = mysqlcn.mdb_ds("select * from uc_members where username='******'", "ucenter"); if (dscount.Tables["ucenter"].Rows.Count == 0) { Random r = new Random(); string salt = r.Next().ToString().Substring(0, 6); string username = usernm; string password = MD5(MD5(ds.Tables["user"].Rows[0]["UserPassword"].ToString()) + salt); string email = ds.Tables["user"].Rows[0]["UserEmail"].ToString(); string myid = ""; string myidkey = ""; string regip = Page.Request.UserHostAddress; string regdate = UnixTimestamp(); string lastloginip = "0"; string lastlogintime = "0"; string id = this.insert(username, "8fc24ae194289b94e36272a5f9882611", email, myid, myidkey, regip, regdate, lastloginip, lastlogintime, "594882"); if (id != "") { mysqlcn.mdb_exe("insert into uchome_member (uid,username,password) values (" + id + ",'','" + MD5(id + "|" + UnixTimestamp()) + "')"); mysqlcn.mdb_exe("insert into uc_memberfields (uid,blacklist) values (" + id + ",'')"); string myemail; string qq; string msn; if (ds.Tables["user"].Rows[0]["UserEmail"].ToString() != "") { myemail = ds.Tables["user"].Rows[0]["UserEmail"].ToString(); } else { myemail = ""; } qq = ""; msn = ""; mysqlcn.mdb_exe("insert into uchome_spacefield (uid,email,qq,msn,blood,birthprovince,birthcity,resideprovince,residecity,note,spacenote,authstr,theme,css,privacy,friend,feedfriend,sendmail) values (" + id + ",'" + myemail + "','" + qq + "','" + msn + "','','','','','','','','','','','','','','')"); //插入实名 string namestatus = "0"; //实名 mysqlcn.mdb_exe("insert into uchome_space (uid,groupid,username,name,namestatus,domain,dateline,ip) values (" + id + ",5,'" + username + "',''," + namestatus + ",''," + UnixTimestamp() + ",'" + Page.Request.UserHostAddress + "')"); cn.mdb_exe("update TB_User set UCenterHomeUid=" + id + " where UserId=" + userid); //在ucenter中添加推荐好友 if (Request.Cookies["UID"] == null) { } else { if (Request.Cookies["UID"].Value == "") { } else { string gid = "0"; if (this.Request.Cookies["g"] == null) { } else { if (Request.Cookies["g"].Value == "") { } else { gid = Request.Cookies["g"].Value; try { int g = Convert.ToInt32(gid); if (g > 0 && g < 8) { gid = g.ToString(); } else { gid = "0"; } } catch (Exception ex) { gid = "0"; } } } DataSet myUidds = mysqlcn.mdb_ds("select username from uc_members where uid=" + Request.Cookies["UID"].Value, "uid"); mysqlcn.mdb_exe("insert into uchome_friend (uid,fuid,fusername,status,gid,note,dateline) values (" + id + "," + Request.Cookies["UID"].Value + ",'" + myUidds.Tables["uid"].Rows[0][0].ToString() + "',1,0,''," + UnixTimestamp() + ")"); mysqlcn.mdb_exe("insert into uchome_friend (uid,fuid,fusername,status,gid,note,dateline) values (" + Request.Cookies["UID"].Value + "," + id + ",'" + username + "',1," + gid + ",''," + UnixTimestamp() + ")"); mysqlcn.mdb_exe("insert into uc_friends (uid,friendid,direction,comment) values (" + id + "," + Request.Cookies["UID"].Value + ",3,'')"); mysqlcn.mdb_exe("insert into uc_friends (uid,friendid,direction,comment) values (" + Request.Cookies["UID"].Value + "," + id + ",3,'')"); } } } } Response.Cookies["useremail"].Value = UserEmail.Value.ToString(); try { SendEmail(UserName.Value.ToString(), UserPassword.Value.ToString(), UserEmail.Value.ToString(), "GB"); } catch (Exception ex) { Response.Redirect("trysuccess.aspx"); } } }
public treeresult(points phead) { this.head = phead; }
public treeresult() { this.head = null; }
public points(int pdata) { this.data = pdata; this.rside = null; this.lside = null; }
public points() { this.rside = null; this.lside = null; }
// Build graph data structure in 'edges', 'centers', 'corners', // based on information in the Voronoi results: point.neighbors // will be a list of neighboring points of the same type (corner // or center); point.edges will be a list of edges that include // that point. Each edge connects to four points: the Voronoi edge // edge.{v0,v1} and its dual Delaunay triangle edge edge.{d0,d1}. // For boundary polygons, the Delaunay edge will have one null // point, and the Voronoi edge may be null. public function buildGraph(points:Vector.<Point>, voronoi:Voronoi):void {
protected void Button1_Click(object sender, EventArgs e) { check ck = new check(); data_conn cn = new data_conn(); string sql = ""; sql = sql + "select * "; sql = sql + "from TB_User "; sql = sql + "where UserName = '******'"; DataSet ds = new DataSet(); ds = cn.mdb_ds(sql, "T_User"); if (WordsIScn(UserName.Value) && WordsIScn(Text1.Value) && WordsIScn(Text2.Value) && WordsIScn(Text3.Value) && WordsIScn(Text4.Value) && WordsIScn(Text5.Value) && WordsIScn(Text6.Value) && WordsIScn(Text7.Value) && WordsIScn(Text8.Value) && WordsIScn(Text9.Value) && WordsIScn(Text10.Value) && WordsIScn(Text11.Value) && WordsIScn(Text12.Value) && WordsIScn(Text13.Value) && WordsIScn(Text14.Value) && WordsIScn(TEXTAREA1.Value)) { } else { MessageBox("opfail", "不能出现中文字符"); return; } if (ds.Tables["T_User"].Rows.Count > 0) { MessageBox("opfail", "该用户名已被使用"); return; } if (Text1.Value != Text2.Value) { MessageBox("opfail", "两遍输入的密码不相同"); return; } if (!Checkbox1.Checked) { MessageBox("opfail", "Please read the service terms and agree"); return; } if (UserName.Value == "" || Text1.Value == "" || Text2.Value == "" || Text3.Value == "" || Text5.Value == "" || DropDownList1.SelectedValue == "" || Text6.Value == "" || Text8.Value == "" || Text11.Value == "" || Text12.Value == "") { MessageBox("opfail", "*号为必填项"); return; } string recommendUserID; if (this.Request.Cookies["recommendUserID"] == null) { recommendUserID = "0"; } else { if (this.Request.Cookies["recommendUserID"].Value == "") { recommendUserID = "0"; } else { recommendUserID = Request.Cookies["recommendUserID"].Value; } } if (this.Request.Cookies["UID"] == null) { } else { if (Request.Cookies["UID"].Value == "") { } else { data_conn Uidcn = new data_conn(); DataSet Uidds = Uidcn.mdb_ds("select UserID from TB_User where UCenterHomeUid=" + Request.Cookies["UID"].Value, "uid"); if (Uidds.Tables["uid"].Rows.Count == 1) { recommendUserID = Uidds.Tables["uid"].Rows[0][0].ToString(); mysqldata_conn mycn = new mysqldata_conn(); mycn.mdb_exe("update uchome_space set credit=credit+10 where uid=" + Request.Cookies["UID"].Value); } } } sql = ""; sql += "INSERT INTO "; sql += "TB_User "; sql += "("; sql += "UserName, "; sql += "UserPassword, "; sql += "RealName, "; sql += "First_Name, "; sql += "Last_Name, "; sql += "EN_CompanyName, "; sql += "CompanyType, ";//int sql += "Phone, "; sql += "Fax, "; sql += "UserEmail, "; sql += "Usermsn, "; sql += "Website, "; sql += "EN_Country, "; sql += "EN_City, "; sql += "EN_Address, "; sql += "PostNumber, "; sql += "EN_Company_profile, "; sql += "UserPoint, "; sql += "IfPass, "; sql += "ifvip, "; sql += "ifmanage, "; sql += "ifEn, "; sql += "Regtime)"; sql += "VALUES "; sql += "("; sql += "'" + ck.CheckInput(UserName.Value.ToString()) + "', "; sql += "'" + ck.CheckInput(Text1.Value.ToString()) + "', "; sql += "'" + ck.CheckInput(Text3.Value.ToString()) + " " + ck.CheckInput(Text4.Value.ToString()) + "', "; sql += "'" + ck.CheckInput(Text3.Value.ToString()) + "', "; sql += "'" + ck.CheckInput(Text4.Value.ToString()) + "', "; sql += "'" + ck.CheckInput(Text5.Value.ToString()) + "', "; sql += "" + ck.CheckInput(DropDownList1.SelectedValue) + ", "; sql += "'" + ck.CheckInput(Text6.Value.ToString()) + "', "; sql += "'" + ck.CheckInput(Text7.Value.ToString()) + "', "; sql += "'" + ck.CheckInput(Text8.Value.ToString()) + "', "; sql += "'" + ck.CheckInput(Text9.Value.ToString()) + "', "; sql += "'" + ck.CheckInput(Text10.Value.ToString()) + "', "; sql += "'" + ck.CheckInput(Text11.Value.ToString()) + "', "; sql += "'" + ck.CheckInput(Text12.Value.ToString()) + "', "; sql += "'" + ck.CheckInput(Text13.Value.ToString()) + "', "; sql += "'" + ck.CheckInput(Text14.Value.ToString()) + "', "; sql += "'" + ck.CheckInput(TEXTAREA1.Value.ToString()) + "', "; sql += "0, "; sql += "1, "; sql += "1, "; sql += "0, "; sql += "1, "; sql += "'" + ck.CheckInput(DateTime.Now.ToString()) + "' "; sql += ")"; cn.mdb_exe(sql); sql = "SELECT * FROM TB_User WHERE UserName = '******'"; ds = cn.mdb_ds(sql, "user"); string sql_account = "insert into TB_ORDER_ACCOUNT (userid) VALUES (" + ds.Tables["user"].Rows[0]["UserID"].ToString() + ")"; cn.mdb_exe(sql_account); //增加账户信息 if (ds.Tables["user"].Rows.Count != 0) { try { points p = new points(); p.AddNewPoints(ds.Tables["user"].Rows[0]["UserID"].ToString()); } catch (Exception ex) { } string userid = ds.Tables["user"].Rows[0]["UserID"].ToString(); string usernm = ds.Tables["user"].Rows[0]["UserName"].ToString(); string ifvip = ds.Tables["user"].Rows[0]["ifvip"].ToString(); string ifmanage = ds.Tables["user"].Rows[0]["ifmanage"].ToString(); string realname = ds.Tables["user"].Rows[0]["realname"].ToString(); string useremail = ds.Tables["user"].Rows[0]["useremail"].ToString(); Response.Cookies["user_id"].Value = userid; Response.Cookies["user_name"].Value = Server.UrlEncode(usernm); Response.Cookies["ifvip"].Value = ifvip; Response.Cookies["ifmanage"].Value = ifmanage; Response.Cookies["user_id"].Expires = DateTime.Now.AddDays(365); Response.Cookies["user_name"].Expires = DateTime.Now.AddDays(365); Response.Cookies["ifvip"].Expires = DateTime.Now.AddDays(365); Response.Cookies["ifmanage"].Expires = DateTime.Now.AddDays(365); Response.Cookies["realname"].Value = Server.UrlEncode(realname); Response.Cookies["useremail"].Value = Server.UrlEncode(useremail); Response.Cookies["realname"].Expires = DateTime.Now.AddDays(365); Response.Cookies["useremail"].Expires = DateTime.Now.AddDays(365); if (recommendUserID != "0") { cn.mdb_exe("insert into T_FRIEND (UID,FID) values (" + userid + "," + recommendUserID + ")"); cn.mdb_exe("insert into T_FRIEND (UID,FID) values (" + recommendUserID + "," + userid + ")"); Mark mark = new Mark(); mark.MarkOperate(Convert.ToInt32(recommendUserID), 10, "推荐会员", Convert.ToInt32(userid)); } mysqldata_conn mysqlcn = new mysqldata_conn(); DataSet dscount = mysqlcn.mdb_ds("select * from uc_members where username='******'", "ucenter"); if (dscount.Tables["ucenter"].Rows.Count == 0) { Random r = new Random(); string salt = r.Next().ToString().Substring(0, 6); string username = usernm; string password = MD5(MD5(ds.Tables["user"].Rows[0]["UserPassword"].ToString()) + salt); string email = ds.Tables["user"].Rows[0]["UserEmail"].ToString(); string myid = ""; string myidkey = ""; string regip = Page.Request.UserHostAddress; string regdate = UnixTimestamp(); string lastloginip = "0"; string lastlogintime = "0"; string id = this.insert(username, "8fc24ae194289b94e36272a5f9882611", email, myid, myidkey, regip, regdate, lastloginip, lastlogintime, "594882"); if (id != "") { mysqlcn.mdb_exe("insert into uchome_member (uid,username,password) values (" + id + ",'','" + MD5(id + "|" + UnixTimestamp()) + "')"); mysqlcn.mdb_exe("insert into uc_memberfields (uid,blacklist) values (" + id + ",'')"); string myemail; string qq; string msn; if (ds.Tables["user"].Rows[0]["UserEmail"].ToString() != "") { myemail = ds.Tables["user"].Rows[0]["UserEmail"].ToString(); } else { myemail = ""; } qq = ""; msn = ""; mysqlcn.mdb_exe("insert into uchome_spacefield (uid,email,qq,msn,blood,birthprovince,birthcity,resideprovince,residecity,note,spacenote,authstr,theme,css,privacy,friend,feedfriend,sendmail) values (" + id + ",'" + myemail + "','" + qq + "','" + msn + "','','','','','','','','','','','','','','')"); //插入实名 string namestatus = "0"; //实名 mysqlcn.mdb_exe("insert into uchome_space (uid,groupid,username,name,namestatus,domain,dateline,ip) values (" + id + ",5,'" + username + "',''," + namestatus + ",''," + UnixTimestamp() + ",'" + Page.Request.UserHostAddress + "')"); cn.mdb_exe("update TB_User set UCenterHomeUid=" + id + " where UserId=" + userid); //在ucenter中添加推荐好友 if (Request.Cookies["UID"] == null) { } else { if (Request.Cookies["UID"].Value == "") { } else { string gid = "0"; if (this.Request.Cookies["g"] == null) { } else { if (Request.Cookies["g"].Value == "") { } else { gid = Request.Cookies["g"].Value; try { int g = Convert.ToInt32(gid); if (g > 0 && g < 8) { gid = g.ToString(); } else { gid = "0"; } } catch (Exception ex) { gid = "0"; } } } DataSet myUidds = mysqlcn.mdb_ds("select username from uc_members where uid=" + Request.Cookies["UID"].Value, "uid"); mysqlcn.mdb_exe("insert into uchome_friend (uid,fuid,fusername,status,gid,note,dateline) values (" + id + "," + Request.Cookies["UID"].Value + ",'" + myUidds.Tables["uid"].Rows[0][0].ToString() + "',1,0,''," + UnixTimestamp() + ")"); mysqlcn.mdb_exe("insert into uchome_friend (uid,fuid,fusername,status,gid,note,dateline) values (" + Request.Cookies["UID"].Value + "," + id + ",'" + username + "',1," + gid + ",''," + UnixTimestamp() + ")"); mysqlcn.mdb_exe("insert into uc_friends (uid,friendid,direction,comment) values (" + id + "," + Request.Cookies["UID"].Value + ",3,'')"); mysqlcn.mdb_exe("insert into uc_friends (uid,friendid,direction,comment) values (" + Request.Cookies["UID"].Value + "," + id + ",3,'')"); } } } else { Response.Write("safasdfasdf"); } } Response.Cookies["useremail"].Value = Text8.Value.ToString(); Response.Redirect("/en/login_2.aspx"); } }
//---------------------------------- private void ButtonStart_Click(object sender, EventArgs e) { KSVD_Depth = System.Convert.ToInt32(cbDepth.Text); int rib = (int)Math.Sqrt(CoefsN); if (rib * rib < CoefsN) { rib = (int)Math.Sqrt(CoefsN) + 1; } Bitmap InputBitmap = (Bitmap)Bitmap.FromFile("Kawasaki_Valencia_2007_09_320x240.bmp"); Bitmap SparseDicBitmap = new Bitmap((N + 1) * rib, (N + 1) * rib, System.Drawing.Imaging.PixelFormat.Format24bppRgb); PicImage.Image = Helper.scaler(InputBitmap, 2, InterpolationMode.NearestNeighbor); PicCoefs.Image = Helper.scaler(SparseDicBitmap, 256, 256, InterpolationMode.NearestNeighbor); int[,] memory = new int[InputBitmap.Width, InputBitmap.Height]; for (points A = new points(InputBitmap.Width, InputBitmap.Height); A.DoIt; A.Inc()) { memory[A.x, A.y] = (int)(InputBitmap.GetPixel(A.x, A.y).GetBrightness() * 255.0); } Random rnd = new Random(); Matrix[] CopyDictionairy = Matrix.GetMatrixArrayRandom(N, CoefsN, rnd); Matrix[] Dictionairy = Matrix.GetMatrixArrayRandom(N, CoefsN, rnd); Matrix PatchOut; Int32 index = 0; Int32[] Cnt = new Int32[CoefsN]; for (int i = 0; i < CoefsN; i++) { Cnt[i] = 0; } double quant = System.Convert.ToInt32(cbQuant.Text); for (int repeat = 0; repeat < 50; repeat++) { for (points A = new points(InputBitmap.Width / N, InputBitmap.Height / N); A.DoIt; A.Inc()) { Matrix PatchIn = GetMemory(A, memory); PatchOut = PatchIn.Average(); for (int p = 0; p < KSVD_Depth; p++) { Matrix Norm = PatchIn - PatchOut; Matrix Atom = Matrix.MaxDot(Norm, CopyDictionairy, ref index); double pickvalue = Math.Round(Matrix.Dot(PatchIn - PatchOut, Atom) / quant) * quant; PatchOut += (pickvalue * Atom); //FeedBack Norm.Normalize(); Dictionairy[index] = Dictionairy[index] + pickvalue * Norm; Cnt[index] += 1; } DrawPatch(A, InputBitmap, PatchOut); } PicImage.Image = Helper.scaler(InputBitmap, 4, InterpolationMode.NearestNeighbor); PicImage.Refresh(); for (int i = 0; i < CopyDictionairy.Length; i++) { if (Cnt[i] > 2) { Dictionairy[i].Normalize(); CopyDictionairy[i].CopyFrom(Dictionairy[i]); } else { Dictionairy[i].FillRnd(rnd, memory); Dictionairy[i].Normalize(); CopyDictionairy[i].CopyFrom(Dictionairy[i]); } } DrawCoefs(SparseDicBitmap, CopyDictionairy, rib, CoefsN); } }
_bitmap.DrawPolyline( points , _colorCache[gpoly.Color]