Mongo是一种文本型数据库,有c++编写。特点什么的,可以参考http://baike.baidu.com/view/3385614.htm

MongoDB的存储是基于JSON的键值对的存储的。所以,它存储的格式可以随意。

如:

{"Name" : "zheng","age":"22Year","Love":[“坏妞”,"翠花","啊蓝"]}
{"Name" : "zheng","CreateTime":"xxxx-xxx--xxx","Love":[“坏妞”,"翠花","啊蓝"]}

同一个Collection,即同一个表。可以字段不同,可以里面存储数组。

其方便灵活型,是其他数据库都无法比的。。

从接触到现在。用了几个月。感触很大。自从用了Mongo。就再也不想用其他数据库了。本机连sql都没装。上瘾了。

(2)Documents .每个Document都有一个特殊的键,“_id”是唯一索引。

   存储类似JSON。但是它的顺序不是太重要。。

(3)Collections  类似表名称

(4)MongoDB Shell。它能运行任意的javascript的东西。全功能javascript的解释器。。

So。

这次是运行函数。。

(未完,待续!)

posted @ 2011-05-20 21:47 [↑起↑] Views(104) Comments(0) Edit

qq本地会员。省内存。去插件。没广告。居家必备。。

http://bbs.hookqq.com 首先去下载最新版。然后去腾讯下载最新版qq。然后解压到qq安装目录里面的bin目录里面。就可以了。

然后可以自己设置插件开启。省内存效果明显。。。。完毕!

posted @ 2011-03-06 00:08 [↑起↑] Views(71) Comments(0) Edit

昨天没事。用了用秋天的那个Cyq.Data 。发现挺好用的。以前写代码就是代码生成。几层几层的。现在。一层,然后引用下dll.然后增删改查。

也就几句话。

View Code
MAction action = new MAction("BaseInfo_TeacherInfo");
Rep_TeacherNews.DataSource
= action.Select();
Rep_TeacherNews.DataBind();
action.Close();
View Code
1 MAction maction = new MAction("BaseInfo_TeacherInfo");
2 maction.Delete("TeacherID=" + ClassID);
3 maction.Close();

使用很简单。。呃。写个博客。留个纪念

使用过程中。发现一个问题。就是我的sql写错了

   MDataTable tabme = action.Select(1, 10, string.Format("{0}='{1}'", Drp_SerachKey.SelectedItem.Value, Txt_KeyWord.Text), out count);
            Rep_TeacherNews.DataSource = tabme;
            action.Close();

"{0}='{1}'如果sql查询。。字符串要加''这个符号的。我忘了加了。所以一直出错。。哎。。留个纪念

posted @ 2011-03-04 10:06 [↑起↑] Views(169) Comments(0) Edit

为了应付一天一个博文。所以就继续贴以前的代码。

网上有很多这样的裁剪图片,只是都不完善 。我里面有个demo。js---裁剪---c#生成图片---存放。最后想加个压缩图片的。但是

发现不太明显。就送一个压缩图片的利器。

View Code
1 <title></title>
2 <script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
3 <script src="js/jquery.Jcrop.min.js" type="text/javascript"></script>
4 <script src="js/jquery.Jcrop-0.9.8/Jcrop/js/jquery.Jcrop.js" type="text/javascript"></script>
5 <link href="css/jquery.Jcrop.css" rel="stylesheet" type="text/css" />
6 <link href="../css/demos.css" rel="stylesheet" type="text/css" />
7
8 <script type="text/javascript" language="Javascript">
9 jQuery(document).ready(function () {
10 jQuery('#cropbox').Jcrop({
11 //onChange: showCoords,
12   onSelect: showCoords
13 });
14 });
15
16 function showCoords(c) {
17 jQuery('#x').val(c.x);
18 jQuery('#y').val(c.y);
19 //jQuery('#x2').val(c.x2);
20 //jQuery('#y2').val(c.y2);
21 jQuery('#w').val(c.w);
22 jQuery('#h').val(c.h);
23 };
24 </script>
25 </head>
26 <body>
27 <form id="form1" runat="server">
28 <div>
29 <img runat="server" src="b.jpg" id="cropbox" />
30 <asp:Button ID="btnCrop" Text="Crop Image" runat="server" OnClick="tesst" />
31 <div id="disp">
32 </div>
33 <label>
34 <input size="4" id="x" name="x" /></label>
35 <label>
36 <input size="4" id="y" name="y" /></label>
37 <label>
38 <input size="4" id="x2" name="x2" /></label>
39 <label>
40 <input size="4" id="y2" name="y2" /></label>
41 <label>
42 <input size="4" id="w" name="w" /></label>
43 <label>
44 <input size="4" id="h" name="h" /></label>
45 </div>
46 </form>
47 </body>
48 </html>

然后下面的代码是

View Code
1 using System;
2 using System.Web;
3 using System.Web.Services;
4 using System.IO;
5 using System.Drawing;
6 using System.Drawing.Drawing2D;
7 using System.Drawing.Imaging;
8 using System.Linq;
9 //using System.Text;
10
11
12 namespace WebApplication1
13 {
14 public partial class test : System.Web.UI.Page
15 {
16 public static int pPartStartPointX;
17 public static int pPartStartPointY;
18 public static int pPartWidth;
19 public static int pPartHeight;
20
21 protected void Page_Load(object sender, EventArgs e)
22 {
23
24 }
25
26 public void tesst(object sender, EventArgs e)
27 {
28 pPartStartPointX = int.Parse(Request.Form["x"]);
29 pPartStartPointY = int.Parse(Request.Form["y"].ToString());
30 pPartWidth = int.Parse(Request.Form["w"].ToString());
31 pPartHeight = int.Parse(Request.Form["h"].ToString());
32
33 string originalPath = "b.jpg";
34 string savePath = HttpContext.Current.Server.MapPath("~/Images/CropImg/");
35 string filename = CropImage(originalPath, savePath, pPartWidth, pPartHeight, pPartStartPointX, pPartStartPointY);
36 string fullpath = "../Images/CropImg/" + filename;
37 }
38
39 public static string CropImage(string originamImgPath, string imgPath, int width, int height, int x, int y)
40 {
41 string filename = DateTime.Now.ToString("yyyyMMddHHmmss") + ".jpg";
42 byte[] CropImage = Crop(originamImgPath, width, height, x, y);
43 using (MemoryStream ms = new MemoryStream(CropImage, 0, CropImage.Length))
44 {
45 ms.Write(CropImage, 0, CropImage.Length);
46 using (System.Drawing.Image CroppedImage = System.Drawing.Image.FromStream(ms, true))
47 {
48 string SaveTo = imgPath + filename;
49 CroppedImage.Save(SaveTo, CroppedImage.RawFormat);
50 }
51 }
52 // MakeThumbnail("Images/CropImg/20110112153907.jpg", "Images/CropImg/00000.jpg", 387, 326, "Cut");
53 return filename;
54 }
55
56 private static byte[] Crop(string Img, int Width, int Height, int X, int Y)
57 {
58 try
59 {
60 using (Image OriginalImage = Image.FromFile(System.Web.HttpContext.Current.Server.MapPath(Img)))
61 {
62 using (Bitmap bmp = new Bitmap(Width, Height, OriginalImage.PixelFormat))
63 {
64 bmp.SetResolution(OriginalImage.HorizontalResolution, OriginalImage.VerticalResolution);
65 using (Graphics Graphic = Graphics.FromImage(bmp))
66 {
67 Graphic.SmoothingMode = SmoothingMode.AntiAlias;
68 Graphic.InterpolationMode = InterpolationMode.HighQualityBicubic;
69 Graphic.PixelOffsetMode = PixelOffsetMode.HighQuality;
70 Graphic.DrawImage(OriginalImage, new Rectangle(0, 0, Width, Height), X, Y, Width, Height, GraphicsUnit.Pixel);
71 MemoryStream ms = new MemoryStream();
72 bmp.Save(ms, OriginalImage.RawFormat);
73 return ms.GetBuffer();
74 }
75 }
76 }
77 }
78 catch (Exception Ex)
79 {
80 throw (Ex);
81 }
82 }
83 }
84 }

原理就是或者js得到的坐标。长宽高一类的东西。然后用c#的画图类、操作。裁剪图片。生成一个新图片。存放到一个新地方。里面的js的jquery.Jcrop.min自己搜着下载吧。。

这个,demo。还没发现咋上传呢。有空上传上去

还有个压缩工具ImageOptimizer510 。。很完美。我的压缩图片。一直压缩质量不完美。。有空改善下吧。这个工具很强

posted @ 2011-03-03 13:37 [↑起↑] Views(201) Comments(1) Edit
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Net;using System.IO;using System.Text;using Fizzler;using Fizzler.Systems.HtmlAgilityPack;using System.Text.RegularExpressions;以前。闲着没事。自己做了个采集美女图片的网站httRead More
posted @ 2011-03-02 15:50 [↑起↑] Views(459) Comments(6) Edit

上午写模糊匹配。 like '%@ssss%' 出来没结果。后来查了下。发现改成这样。    

 select * where Remark like +'%'+@Remark+'%' 

posted @ 2011-03-02 15:19 [↑起↑] Views(142) Comments(1) Edit
待续Read More
posted @ 2010-03-21 02:05 [↑起↑] Views(13) Comments(0) Edit
Use the OLE DB .NET data provider[代码]Read More
posted @ 2010-03-21 02:03 [↑起↑] Views(69) Comments(0) Edit
Solution:Connecting to a Password-Protected Microsoft Access DatabaseSolution:代码A Microsoft Access database password does not provide strong security and should only be used as a simple deterrent.Conn...Read More
posted @ 2010-03-21 01:48 [↑起↑] Views(44) Comments(0) Edit
How do it :(1)创建一个解决方案(2)在Web.config配置文件里面的<system.web>节点里面添加[代码](3)添加连接字符串:[代码]实例代码下面讨论两种验证。windows验证和sql验证(SQL Server Authentication)connecting_to_sql_server_using_integrate.htmlIntegrated sec...Read More
posted @ 2010-02-28 04:17 [↑起↑] Views(138) Comments(0) Edit