先说说我为什么写这些吧
- 当程序猿太苦逼了,真的,时间久了,真没有搬砖的成就感高,好歹人家能盖栋楼(身材也能练得不错),咱们指不定哪天来个熊孩子把硬盘格了就啥也没了。
- 这学期明显没把心放在前端上……汗啊,将来还想吃着口饭呢,但是这学期绝对没休息,只是忙了很多可能很多人认为无聊的事。
- 因为这学期无聊事太多了,耽误了很多,也让导师很失望,自己也很自卑,整理一下调调心态。
- 因为很多是针对作业的奇葩想法,所以,作业嘛,不糊弄就不是作业了,还希望大家多多批评。
- 兴许因为哪篇文章能解决工作呢。
- 我想试试Markdown。
上靓照
代码(部分)
工作记录的处理
protected ListStore CreateModel(string name){ ListStore store = new ListStore (typeof(string)); try{ string reg = con.events [name]; string re = "<li>(.*?)</li>"; MatchCollection matches = Regex.Matches(reg,re); foreach(Match m in matches){ string a = m.Groups [1].Value.ToString(); store.AppendValues (a); Console.WriteLine (a); } }catch{} return store; }
例会签到信息的处理
protected void OnCalendarDaySelectedDoubleClick (object sender, EventArgs e){ Console.WriteLine (calendar.Date); foreach (string time in con.Time(telEntry.Text)) { if (time == calendar.Date.ToString()) { statusbar.Push (0, "checked"); } else { statusbar.Push (0,"unchecked"); } } }
添加成员的处理
protected void OnNameTreeCellEdited(object sender,EditedArgs args){ TreeIter iter; treestore.GetIter (out iter,new TreePath(args.Path)); if (treestore.GetValue(iter,0).ToString() == "new") { treestore.SetValue (iter,0,args.NewText); if (treestore.GetValue (iter, 0).ToString () == "new") { treestore.AppendValues (OfficeIter,"new"); } } }
网络抓取
public string GetContent(string strUrl,Encoding e){ string strMsg = string.Empty; try{ WebRequest request = WebRequest.Create(strUrl); WebResponse response = request.GetResponse(); StreamReader reader = new StreamReader(response.GetResponseStream(),e); strMsg = reader.ReadToEnd(); reader.Close(); reader.Dispose(); response.Close(); }catch{} return strMsg; } public void initializer(){ string html = new User().GetContent ("http://jwc.sut.edu.cn/ACTIONQUERYCLASSSCHEDULE.APPPROCESS",Encoding.GetEncoding("GB2312")); string reg = @"(<option value=""(¥d{7})"">¥d{7}¥[(.*)¥]</option>)"; MatchCollection matches = Regex.Matches(html,reg); foreach(Match m in matches){ string a = m.Groups [2].Value.ToString (); string b = m.Groups [3].Value.ToString (); school.Add (a, b); Console.WriteLine (m.Groups[2].Value); Console.WriteLine (m.Groups[3].Value); } string content = new User().GetContent ("http://sutnmc.sinaapp.com/nws/first.php",Encoding.Default); string re = @"(<h2>(.*?)<¥/h2>(<ul>.*?<¥/ul>))"; matches = Regex.Matches(content,re); foreach(Match m in matches){ string a = m.Groups [2].Value.ToString (); string b = m.Groups [3].Value.ToString (); student.Add (a, b); Console.WriteLine (m.Groups[2].Value); Console.WriteLine (m.Groups[3].Value); } }
数据库链接
TreeViewColumn languages = new TreeViewColumn(); //Console.WriteLine("ok"); List<string> list = new List<string> (); string connectionString = "Server=localhost;"+"Database=youth;" +"User ID=root;"+"Password=192120;"+"Pooling=false;Connection Timeout=10;Protocol=socket;Port=3306;"; Console.WriteLine(connectionString); IDbConnection dbcon = new MySqlConnection (connectionString); dbcon.Open (); IDbCommand dbcmd = dbcon.CreateCommand (); dbcmd.CommandText = "select * from `check` where tel like ‘"+tel+"‘"; Console.WriteLine (dbcmd.CommandText); IDataReader reader = dbcmd.ExecuteReader (); while (reader.Read ()) { list.Add(reader["time"].ToString()); Console.WriteLine (reader["time"].ToString()); } reader.Close (); reader = null; dbcmd.Dispose (); dbcon.Close (); dbcon = null; return list; } public void score(string tel,List<string> list){ string connectionString ="Server=localhost;"+"Database=youth;" +"User ID=root;"+"Password=********;"+"Pooling=false;Connection Timeout=10;Protocol=socket;Port=3306;"; Console.WriteLine(connectionString); IDbConnection dbcon = new MySqlConnection (connectionString); dbcon.Open (); IDbCommand dbcmd = dbcon.CreateCommand (); dbcmd.CommandText = "INSERT INTO score (tel, social, school, nws, web, tech, pic, video, news, act, lianson, media, manage, id) VALUES (‘"+ tel+"‘,‘"+list[0]+"‘,‘"+list[1]+"‘,‘"+list[2]+"‘,‘"+list[3]+"‘,‘"+list[4]+"‘,‘"+list[5]+"‘,‘"+list[6]+"‘,‘"+list[7]+"‘,‘"+list[8]+"‘,‘"+list[9]+"‘,‘"+list[10]+"‘,‘"+list[11]+"‘,‘"+list[12]+"‘);"; IDataReader reader = dbcmd.ExecuteReader (); reader.Close (); reader = null; dbcmd.Dispose (); dbcon.Close (); dbcon = null; } protected void db(){ //Console.WriteLine("ok"); string connectionString = "Server=localhost;"+"Database=youth;" +"User ID=root;"+"Password=192120;"+"Pooling=false;Connection Timeout=10;Protocol=socket;Port=3306;"; Console.WriteLine(connectionString); IDbConnection dbcon = new MySqlConnection (connectionString); dbcon.Open (); IDbCommand dbcmd = dbcon.CreateCommand (); dbcmd.CommandText = queryMember; IDataReader reader = dbcmd.ExecuteReader (); while (reader.Read ()) { string a = (string)reader["name"]; string b = (string)reader["tel"]; resMember.Add (a,b); Console.WriteLine(a+"|"+b); } reader.Close (); reader = null; dbcmd.Dispose (); dbcon.Close (); dbcon = null; u.initializer (); student = u.Student; school = u.School; } TreeViewColumn languages = new TreeViewColumn(); languages.Title = "Names"; CellRendererText cell = new CellRendererText(); cell.Editable = true; cell.Edited += OnNameTreeCellEdited; languages.PackStart(cell, true); languages.AddAttribute(cell, "text", 0); DirectIter = treestore.AppendValues("Director"); OfficeIter = treestore.AppendValues("Officer"); foreach (string key in con.dict.Keys) { treestore.AppendValues (DirectIter, key); } treestore.AppendValues (OfficeIter,"new"); nameTree.AppendColumn(languages); nameTree.Model = treestore; nameTree.Selection.Changed += OnNameTreeSelectionChanged;
最近github突然不好使了,等好了上传一下
用mono写的小玩意儿
时间: 2024-11-04 22:56:26