随笔分类 -  代码片段

摘要:<plugins> <!-- jetty插件 --> <plugin> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <!--<version>9.0.0.v20130308</ver 阅读全文
posted @ 2017-11-03 16:32 haiziguo 阅读(519) 评论(0) 推荐(0)
摘要:1 public class MailHelper 2 { 3 /// 发送邮件 4 /// 5 /// smtp地址 6 /// 用户名 7 /// ... 阅读全文
posted @ 2015-07-24 10:35 haiziguo 阅读(451) 评论(0) 推荐(1)
摘要:1 // 对称加密帮助类 2 public static class CryptoHelper 3 { 4 //详细参考http://www.cnblogs.com/JimmyZhang/archive/2008/10/02/Cryptograph.html 5... 阅读全文
posted @ 2015-07-23 15:45 haiziguo 阅读(292) 评论(0) 推荐(0)
摘要:public class DALHelper { public static List Search() where T : SH_SetBase { using (var db = new ShopContext()) ... 阅读全文
posted @ 2014-12-12 17:41 haiziguo 阅读(337) 评论(0) 推荐(0)
摘要:添加css 在body头文件中加上class=ng-cloak 阅读全文
posted @ 2014-11-21 13:56 haiziguo 阅读(443) 评论(0) 推荐(0)
摘要:public class BisController : Controller { // // GET: /Bis/ protected string GetJson(object obj) { IsoDat... 阅读全文
posted @ 2014-11-17 11:09 haiziguo 阅读(264) 评论(0) 推荐(0)
摘要:指令directive('bsPopup', function ($parse) { return { require: 'ngModel', restrict: 'A', link: function (scope, ... 阅读全文
posted @ 2014-08-08 15:44 haiziguo 阅读(21841) 评论(1) 推荐(2)
摘要:在制作网页的时候,常常会遇到一种情况,我们需要把一些未知尺寸的图片放在一个固定宽高的容器中,这时候我们需要考虑这样的问题:只给图片设置宽度或高度的其中一项可以实现图片等比缩放,但图片可能超出容器大小。给图片设置固定的宽高可能导致图片变形。而在不考虑IE6的情况下,可以直接使用CSS来实现,而且不需要... 阅读全文
posted @ 2014-08-04 17:01 haiziguo 阅读(299) 评论(0) 推荐(0)
摘要:例子,当遇到A1 A10 A2 order by 不起作用了需要自己写public class StringCompare : IComparer where T : T_TempActicle { //比较两个字符串,如果含用数字,则数字按数字的大小来比较。 in... 阅读全文
posted @ 2014-07-28 16:40 haiziguo 阅读(289) 评论(0) 推荐(0)
摘要:/*table-layout:fixed 会使表格均等分*/#TreeView1 table { width:290px; table-layout: fixed; }#TreeView1 td:first-child { ... 阅读全文
posted @ 2014-07-11 17:51 haiziguo 阅读(2818) 评论(0) 推荐(1)
摘要:C#写法public static string StripHTML(string strHtml) { string strOutput = strHtml; Regex regex = new Regex(@"]+>|]+>"); ... 阅读全文
posted @ 2014-06-27 16:53 haiziguo 阅读(191) 评论(0) 推荐(0)
摘要:breakfast ... 阅读全文
posted @ 2014-05-15 10:47 haiziguo 阅读(1631) 评论(0) 推荐(0)
摘要:public class JsonHelper { public static string JsonSerialize(T t) { DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(T)); MemoryStream ms = new MemoryStream(); ser.WriteObject(ms, t); string jsonString = Encoding.... 阅读全文
posted @ 2014-03-26 13:54 haiziguo 阅读(424) 评论(0) 推荐(0)
摘要:public static readonly DependencyProperty IsUpdateUIProperty = DependencyProperty.Register( "IsUpdateUI", typeof(bool), typeof(LoginStackPanel), new PropertyMetadata(false, (a, b) => { LoginStackPanel lsp ... 阅读全文
posted @ 2013-12-04 11:00 haiziguo 阅读(414) 评论(0) 推荐(0)
摘要:1 WriteableBitmap/BitmapImage/MemoryStream/byte[]相互转换2012-12-18 17:27:04|分类:Windows Phone 8|字号订阅1,WriteableBitmap与BitmapImage转换1.1 BitmapImageto WriteableBitmapBitmapImage bitmapImage=new BitmapImage(new Uri(“http://...”,UriKind.Revelate));WriteableBitmap writeableBitmap = new WriteableBitmap(bitmap 阅读全文
posted @ 2013-11-19 09:19 haiziguo 阅读(3820) 评论(0) 推荐(1)
摘要:public sealed partial class WorkItem : Page { private IAsyncAction _threadPoolWorkItem; private ManualResetEvent _sleep = new ManualResetEvent(false); public WorkItem() { this.InitializeComponent(); } // 在线程池中找一个线程去执行指定的方法,并指定其优先级 priva... 阅读全文
posted @ 2013-11-14 14:41 haiziguo 阅读(285) 评论(0) 推荐(0)
摘要:上面实例代码展示如何将tabitem中的字段绑定到menuitem上,先通过TemplateBinding获取属性值赋值到DataContext属性,然后再通过指定的控件类型和第几个来绑定IsEnabled="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ContextMenu},AncestorLevel=1},Path=DataContext}" >具体说明可以参考:http://www.cnblogs.com/lzhp/archive/2012/09/11/26 阅读全文
posted @ 2013-10-13 12:07 haiziguo 阅读(524) 评论(0) 推荐(0)
摘要:单个字符的匹配一.单个字符或字符串二.匹配任意的字符使用“.”,可以像.ea来匹配所有三个字符,三个字符中第一个字符是任意的。如果想单个字符的话,可以使用[dt],匹配d或t。三.匹配区间[a-z][0-9]如果是想即表示字母和数字的话,[0-9a-z]四.可以使用^来表示取反,经常和单个字符使用或范围模式使用如[^a]:表示不为a的匹配,[^1-3^a-z]表示不为1-3和a-z的匹配。注意^的优先级是最弱的,也就是其他的匹配完才会匹配。五.匹配特殊字符,可以使用转义字符\,如果经常写[0-9]或者[^0-9]还是比较累的。现在给出其简化形式\d,\D,字母数字下划线的写法为[a-z0-9A 阅读全文
posted @ 2013-10-09 10:07 haiziguo 阅读(368) 评论(0) 推荐(1)
摘要:public static T GetInstance(DataRow dr) { var ctors = typeof(T).GetConstructors( BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public); if (ctors.Count() != 1) throw new InvalidOperationEx... 阅读全文
posted @ 2013-09-02 16:42 haiziguo 阅读(1967) 评论(0) 推荐(0)
摘要:使用模板HierarchicalDataTemplate 从父节点删除选中项 private void treeView1_Selected(object sender, RoutedEventArgs e) { if ((e.OriginalSource as TreeViewItem).Header.GetType()==typeof(InlineUI... 阅读全文
posted @ 2013-08-22 16:15 haiziguo 阅读(5544) 评论(0) 推荐(0)