Format:
Recent snippets matching tags of code
Imports System.ComponentModel Public Class MyData Implements INotifyPropertyChanged ''USAGE in code behind 'Dim data1 As New MyData(DateTime.Now) 'Dim binding1 As New Binding("MyDataProperty") ' binding1.Source = data1 ' Me.txtEnterCode.SetBinding(TextBox.TextProperty, binding1)
45 Views
no comments
/************************************************************************************* * * Copyright 2012 Davide Orazio Montersino http://www.davidemontersino.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or
59 Views
no comments
mencoder -oac copy -ovc xvid -xvidencopts bitrate=687 -sub <srt file> -subcp UTF-8 -subfont-text-scale 3 -sub-bg-alpha 70 -o <outputfile> <inputfile>
57 Views
no comments
/* GNOT General Public License! (c) 1995-2011 Microsoft Corporation */ #include "dos.h" #include "win95.h" #include "win98.h" #include "sco_unix.h" #include "metro.h" //windows 8
404 Views
no comments
cls
@ECHO OFF
title Folder Personal
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Personal goto MDLOCKER
:CONFIRM
echo Are you sure u want to lock the folder(Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
149 Views
no comments
//Remember to use Jquery /* Other options for the popup window.open('http://www.someurl.com','nameofpopup','height=500,width=400,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes'); */ $(function () { $('.voucherpopup').click(function (event)
90 Views
no comments
<?php
function Pinyin($_String, $_Code='UTF8') { //GBK页面可改为gb2312,其他随意填写为UTF8
$_DataKey = "a|ai|an|ang|ao|ba|bai|ban|bang|bao|bei|ben|beng|bi|bian|biao|bie|bin|bing|bo|bu|ca|cai|can|cang|cao|ce|ceng|cha".
"|chai|chan|chang|chao|che|chen|cheng|chi|chong|chou|chu|chuai|chuan|chuang|chui|chun|chuo|ci|cong|cou|cu|".
"cuan|cui|cun|cuo|da|dai|dan|dang|dao|de|deng|di|dian|diao|die|ding|diu|dong|dou|du|duan|dui|dun|duo|e|en|er".
"|fa|fan|fang|fei|fen|feng|fo|fou|fu|ga|gai|gan|gang|gao|ge|gei|gen|geng|gong|gou|gu|gua|guai|guan|guang|gui".
"|gun|guo|ha|hai|han|hang|hao|he|hei|hen|heng|hong|hou|hu|hua|huai|huan|huang|hui|hun|huo|ji|jia|jian|jiang".
"|jiao|jie|jin|jing|jiong|jiu|ju|juan|jue|jun|ka|kai|kan|kang|kao|ke|ken|keng|kong|kou|ku|kua|kuai|kuan|kuang".
"|kui|kun|kuo|la|lai|lan|lang|lao|le|lei|leng|li|lia|lian|liang|liao|lie|lin|ling|liu|long|lou|lu|lv|luan|lue".
107 Views
no comments
public class BadNeighbors { public int maxDonations(int[] donations){ if(donations.length == 2)return Math.max(donations[0], donations[1]); int ret = 0; int [] dp = new int [donations.length]; dp[0] = donations[0]; dp[dp.length-1] = donations[dp.length-1]; boolean [] one = new boolean [dp.length]; one[0] = true;
95 Views
no comments
var x = _context.Database.SqlQuery<Company>("SELECT * FROM Companies").ToList();
218 Views
no comments
using System; using System.Collections.Generic; using System.Data; using System.Data.Entity; using System.Data.Entity.Infrastructure; using System.Data.Objects; using System.Linq; using System.Linq.Expressions; using BusinessDomain.Entities; using Microsoft.VisualStudio.TestTools.UnitTesting;
958 Views
no comments
public class GenderConfiguration : ComplexTypeConfiguration<TypeSex> { public GenereConfiguration() { // set column name with Fluent Api Property(g => g.Value).HasColumnName("Sex"); } }
128 Views
no comments
// enum type public enum Sex { Male=1, Female=2 } // wrapper class for enum support in EF4 public class TypeSex {
297 Views
no comments
public class MyClassConfiguration :EntityTypeConfiguration<MyClass> { public MyClassConfiguration() { //define property key and database generated option, identity in this case, and table generated column order. HasKey(p => p.Uid).Property(c => c.Uid).HasDatabaseGeneratedOption( DatabaseGeneratedOption.Identity).HasColumnOrder(1); // define column type (default navarchar(MAX) last release) and columnlength Property(p => p.Name).HasColumnType("nvarchar(MAX)").HasMaxLength(4000); //Ignore mapping on specific property Ignore(p=>p.Description);
242 Views
no comments
//during context definition, alternatively choose. //Drop and create database strategy DbDatabase.SetInitializer(new DropCreateDatabaseAlways<TestContextEf>()); // Drop and create database if model changes DbDatabase.SetInitializer(new DropCreateDatabaseIfModelChanges<TestContextEF>()); // Create database if not exists DbDatabase.SetInitializer(new CreateDatabaseIfNotExists<TestContextEF>());
121 Views
no comments
DbDatabase.SetInitializer<TestContextEF>(null)
152 Views
no comments
public static class ContextHelpers { public static TModel Create<TModel>(this DbContext context) where TModel : class { var dbsetProperty = (from property in context.GetType().GetProperties().ToList() where typeof (IDbSet<TModel>).IsAssignableFrom(property.PropertyType) select property).Single(); var dbset = dbsetProperty.GetValue(context, null) as IDbSet<TModel>;
146 Views
no comments
//So here is what my site data context ends up looking like. public class SiteDataContext : DbContext, ISiteDataContext { public DbSet<User> Users { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity<User>().Property(u => u.Id) .HasColumnName("UserId"); modelBuilder.Entity<User>().HasKey(u => u.Id);
172 Views
no comments
#http://www.nivot.org/2009/03/26/PowerShell20CTP3ModulesInPracticeNETInterfaces.aspx function Get-Interface { #.Synopsis # Allows PowerShell to call specific interface implementations on any .NET object. #.Description # Allows PowerShell to call specific interface implementations on any .NET object. # # As of v2.0, PowerShell cannot cast .NET instances to a particular interface. This makes it
351 Views
no comments
public class Popper { public static void PopItem(UIElement control) { DoItem(TimeSpan.FromMilliseconds(200), 1, 1.5, control); } public static void UnPopItem(UIElement control) { DoItem(TimeSpan.FromMilliseconds(200), 1.5, 1, control);
363 Views
no comments
do{ if(boolean result){ //here is action deal with error break; } if(boolean result){ //here is action deal with error break; } if(boolean result){
133 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
