CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
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)
by DaveCS   March 13, 2012 @ 7:03pm
45 Views
no comments
 
SQL
 
 
 
 /*************************************************************************************
  *
  *        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
by Davide Orazio Montersino   January 10, 2012 @ 2:19am
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>
by alirezaimi   November 11, 2011 @ 9:42am
57 Views
no comments
 
C++
/*
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
by Sean Hall   September 03, 2011 @ 10:30am
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) 
by Egli   August 22, 2011 @ 9:39pm
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".
by clark   August 02, 2011 @ 4:45am
Tags: php, encode,
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;
by Mostafa   July 27, 2011 @ 10:18pm
Tags: #TopCoder
95 Views
no comments
 
C#
var x = _context.Database.SqlQuery<Company>("SELECT * FROM Companies").ToList();
by biboyatienza   June 22, 2011 @ 2:19am
218 Views
no comments
 
C#
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;
by biboyatienza   June 13, 2011 @ 9:22pm
958 Views
no comments
 
C#
public class GenderConfiguration : ComplexTypeConfiguration<TypeSex>
{
   public GenereConfiguration()
    {
      // set column name with Fluent Api
      Property(g => g.Value).HasColumnName("Sex");
    }
}
by pythonyan   April 26, 2011 @ 2:35am
Tags: EF4, CodeFirst
128 Views
no comments
 
C#
// enum type
public enum Sex
{
  Male=1,
  Female=2
}
 
// wrapper class for enum support in EF4
public class TypeSex
{
by pythonyan   April 26, 2011 @ 2:30am
Tags: EF4, CodeFirst
297 Views
no comments
 
C#
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); 
by pythonyan   April 26, 2011 @ 2:14am
Tags: EF4, CodeFirst
242 Views
no comments
 
C#
//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>());
by pythonyan   April 26, 2011 @ 1:57am
Tags: EF4, CodeFirst
121 Views
no comments
 
C#
DbDatabase.SetInitializer<TestContextEF>(null)
by pythonyan   April 26, 2011 @ 1:50am
Tags: EF4, CodeFirst
152 Views
no comments
 
C#
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>;
by John Nelson   March 17, 2011 @ 8:58am
146 Views
no comments
 
C#
//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);
by Mallioch   February 18, 2011 @ 8:25pm
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
 
C#
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);
by Jerry Nixon   February 01, 2011 @ 4:39pm
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){
by x03570227   December 30, 2010 @ 6:33pm
Tags: codestyle
133 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate