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 pre
<asp:RegularExpressionValidator ValidationGroup="Anagrafica" ID="RegularExpressionValidatorEmail"
                                                    ControlToValidate="TextBoxEmail" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                                    ErrorMessage="Indirizzo email immesso non valido" EnableClientScript="true" runat="server" />
by Davide Orazio Montersino   March 05, 2012 @ 1:00am
26 Views
no comments
 
C#
//Email regex validator
Regex regex = new Regex(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*");
 
//Website regex validator
Regex regex = new Regex(@"^http\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?$");
 
//Comments on forum regex validator (max 4000 characters)
Regex regex = new Regex(@"^[+_%@:,.'!?&quot;\\\^\&\#\$\*\(\)\-\/a-zA-Z0-9\s]{1,4000}$");
by Egli   February 06, 2012 @ 9:34pm
56 Views
no comments
 
/*
@Function NumToBase();
@Exercise JS developed by Luca Provenzano
*/
 
function NumToBase(num, base, prefijo, sufijo){
                var Conversion;
                if (typeof base == 'undefined') base = 16;
                if (typeof prefijo == 'undefined') prefijo = '0x';
                if (typeof sufijo == 'undefined') sufijo = '';
by Luca Provenzano   September 13, 2011 @ 2:58pm
92 Views
no comments
 
copy $(ProjectDir)\..\{path to file} $(TargetDir)
 
rem add '1>nul' to NOT display any messages from the copy.
rem add '2>nul' to NOT fail the build and to NOT display any error messages from the copy.
 
 
by Al Gonzalez   June 16, 2011 @ 3:44pm
152 Views
no comments
 
C#
using System;
using System.Collections.Generic;
using System.Xml.Linq;
using FizzWare.NBuilder;
using Microsoft.VisualStudio.TestTools.UnitTesting;
 
namespace Tests.Reporting
{
    [TestClass]
    public class DynamicXmlFormatting
163 Views
no comments
 
C#
using System;
using System.Collections.Generic;
using FizzWare.NBuilder;
using Microsoft.VisualStudio.TestTools.UnitTesting;
 
namespace Tests.Reporting
{
    [TestClass]
    public class DynamicTextFormatting
    {
174 Views
no comments
 
C#
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
public partial class Features_ImportExport : System.Web.UI.Page
{
    const string DocumentUrl = @"~/Content/Demo/SampleImportDocument.rtf";
    const string ContentFolder = @"~/UploadImages/Imported";
by Mehul Harry   May 30, 2011 @ 10:04pm
287 Views
no comments
 
C#
var text = "I (Iceland) Found (Faroe Islands) the Needles (Norway) South (Sweden) of Finland (Finland). Drinks (Denmark) for Everyone (Estonia) Laughed (Latvia) the Little (Lithuania) Neanderthal (Northern Ireland) Selling (Scotland) English (England) Wales (Wales) Inside (Ireland) Northern Europe";
var rg = new Regex(@"\([^)]*\)", RegexOptions.IgnorePatternWhitespace);
var replacedStr = rg.Replace(text,"");
by nyinyithann   February 16, 2011 @ 7:43am
131 Views
no comments
 
C#
protected void Map(Expression<Func<T, object>> property, Func<PropertyDescriptor, string> columnNamer)
{
    MemberInfo memberInfo;
 
    if (property.Body is MemberExpression)
        memberInfo = ((MemberExpression)property.Body).Member;
    else
        memberInfo = ((MemberExpression)((UnaryExpression)property.Body).Operand).Member;
 
    Map(memberInfo.Name, columnNamer);
by Andy Sherwood   February 04, 2011 @ 3:24pm
207 Views
no comments
 
C#
using System;
using System.Linq.Expressions;
 
public static class Aaa
{
    public class A
    {
        public string NameField;
    }
by b1gbr0   October 26, 2010 @ 3:30am
198 Views
no comments
 
C#
public interface IView
{
    event EventHandler Load;
}
 
public class Presenter
{
    private IView _View;
 
    public Presenter(IView view)
by Cat   October 22, 2010 @ 3:11am
212 Views
no comments
 
C#
public static void Copy(string sourceDirName, string destDirName, bool excludeSubdirectories)
{
    // Style #1: fluent
    Guard.MethodArgument("sourceDirName").IsNotNullOrEmpty(sourceDirName);
    Guard.MethodArgument("destDirName").IsNotNullOrEmpty(destDirName, "The destination directory is required!");
 
    // Style #2: lambdas and expressions
    Guard.Argument.IsNotNullOrWhiteSpace(()=>sourceDirName);
    Guard.Argument.IsNotNullOrWhiteSpace(()=>destDirName, "The destination directory is required!");
by Al Gonzalez   May 24, 2010 @ 8:58pm
344 Views
1 comments
 
<Extension()> _
Public Function GetBindingInfo(ByVal DataLayoutControl As DataLayoutControl, _
                               Optional ByVal ExcludePropetries As String = "") As List(Of DataLayoutBindingInfo)
    Dim bh As New LayoutElementsBindingInfoHelper(DataLayoutControl)
    Dim info As LayoutElementsBindingInfo = bh.CreateDataLayoutElementsBindingInfo
    GetBindingInfo = (From x As LayoutElementBindingInfo In info.GetAllBindings _
                      Where (Not x.DataInfo.Name.ToUpper.EqualsAny(ExcludeNames)) _
                      And (Not x.DataInfo.Name.ToUpper.EqualsAny(ExcludePropetries)) _
                      Select New DataLayoutBindingInfo(x.DataInfo.Name, x.DataInfo.Caption, x.Visible, x.EditorType)).ToList
End Function
by Thom Lamb   May 19, 2010 @ 7:42am
329 Views
no comments
 
<Extension()> _
Public Function TimeIntervals(ByVal DateNavigator As DateNavigator) As TimeIntervalCollection
    Dim dc As List(Of DateTime) = (From x In DateNavigator.Selection Order By CDate(x) Select CDate(x)).ToList
    TimeIntervals = New TimeIntervalCollection
    Dim startdt As DateTime = DateTime.MinValue, enddt As DateTime = DateTime.MinValue
    For Each dt As DateTime In dc
        If startdt = DateTime.MinValue Then startdt = dt
        If enddt > DateTime.MinValue _
        AndAlso enddt.AddDays(1) < dt Then
            TimeIntervals.Add(New TimeInterval(startdt, enddt.Subtract(startdt)))
by Thom Lamb   April 21, 2010 @ 9:21am
425 Views
no comments
 
'Form1.vb
#Region " Import Declaratives "
 
Imports DevExpress.XtraEditors
Imports DevExpress.Utils.Menu
Imports System.IO
Imports System.Xml.Serialization
 
#End Region
by Thom Lamb   February 11, 2010 @ 6:53am
2635 Views
no comments
 
C#
using System.Collections.Generic;
using System.Linq;
using Caliburn.PresentationFramework.ApplicationModel;
using CWS.Application.Rounds.Model;
using Db4objects.Db4o;
 
namespace CWS.Application.Rounds.Presenters
{
    public class SectionPresenter : Presenter, ISectionPresenter
    {
by Andy Sherwood   February 01, 2010 @ 7:02pm
255 Views
no comments
 
C#
public partial class _Default : System.Web.UI.Page
{
    private bool mInserted = false;
 
    protected void Page_Load(object sender, EventArgs e) {
        mInserted = false;
    }
    protected void ASPxGridView1_CustomJSProperties(object sender, ASPxGridViewClientJSPropertiesEventArgs e) {
        e.Properties["cpIsInserted"] = mInserted.ToString();
    }
by Mehul Harry   January 08, 2010 @ 4:08pm
683 Views
no comments
 
    <dxwgv:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False"
        DataSourceID="AccessDataSource1" KeyFieldName="CategoryID" 
        OnCustomJSProperties="ASPxGridView1_CustomJSProperties" 
        onrowinserted="ASPxGridView1_RowInserted">
        <ClientSideEvents EndCallback="function(s, e) {
    if (s.cpIsInserted == 'True') alert('Inserted!');
}" />
by Mehul Harry   January 08, 2010 @ 4:07pm
1164 Views
no comments
 
C#
    protected void ASPxButton1_Click(object sender, EventArgs e)
    {
        object key = ASPxGridView1.GetRowValues(2, "CategoryID");
        ASPxGridView1.Selection.SelectRowByKey(key);
 
    }
by Mehul Harry   January 06, 2010 @ 11:49am
479 Views
no comments
 
C#
[TestMethod]
public void CanGetValueItemfromCollection()
{
    var col = new Collection<string> {"Hello", "World"};
    var testItem = col.GetValueItem(c => c.Equals("World"));
    Assert.AreEqual(testItem, "World");
}
 
[TestMethod]
public void CanGetReferenceItemfromCollectionByProperty()
by Bob Baker   December 18, 2009 @ 12:01pm
331 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