Friday, December 7, 2012

How to calculate age in Years,Months and Days crystal report form date of birth



Here DOB is Date of Birth.

Returns Year = DateDiff('yyyy',{DOB},CurrentDate())

Returns Months = DateDiff('m',{DOB},CurrentDate()) - (DateDiff('yyyy',{DOB},CurrentDate()) *12)

Returns Days =
DateDiff('d',{DOB},CurrentDate()) - ( (DateDiff('m',{DOB},CurrentDate()) / 12) * 365.25  )

Wednesday, October 10, 2012

ZXing QR barcode C# Example


BarcodeWriter BW = new BarcodeWriter();
BW.Format = BarcodeFormat.QR_CODE;
var bitmap =BW.Write("This is Bar Code Text");

How to hide user readable text in code 128?


public class PureBarcodeRenderer : ZXing.Rendering.BitmapRenderer
{
   public override Bitmap Render(BitMatrix matrix, BarcodeFormat format, string content, EncodingOptions options)
   {
      return base.Render(matrix, format, null, options);
   }
}

var writer = new BarcodeWriter
                {
                   Renderer = new PureBarcodeRenderer(),
                   Format = BarcodeFormat.CODE_128,
                   Options = new EncodingOptions
                                  {
                                     Height = 100,
                                     Width = 300
                                  }
                            };
var image = writer.Write(content);

How to hide user readable text in code 128?


public class PureBarcodeRenderer : ZXing.Rendering.BitmapRenderer
{
   public override Bitmap Render(BitMatrix matrix, BarcodeFormat format, string content, EncodingOptions options)
   {
      return base.Render(matrix, format, null, options);
   }
}

var writer = new BarcodeWriter
                {
                   Renderer = new PureBarcodeRenderer(),
                   Format = BarcodeFormat.CODE_128,
                   Options = new EncodingOptions
                                  {
                                     Height = 100,
                                     Width = 300
                                  }
                            };
var image = writer.Write(content);

C# ZXing.Net Code 128 Bar Code Example


var writer = new BarcodeWriter
                {
                   Format = BarcodeFormat.CODE_128,
                   Options = new EncodingOptions
                                  {
                                     PureBarcode = true,
                                     Height = 100,
                                     Width = 300
                                  }
                            };
var image = writer.Write(content);

Sunday, September 2, 2012

AJAX Recaptcha,Use Recaptcha with EXT.Net ,Use Recaptcha with EXT JS,Validate Recaptcha C#



C# code

        protected void btnCreateAccount_Click(object sender,DirectEventArgs  e)
        {
            recaptcha.Validate();
            bool result = recaptcha.IsValid;
            if (result)
            {
                X.Msg.Alert("Done""Given text is correct").Show();           
                X.Js.Call("javascript:Recaptcha.reload()");
              
            }
            else
            {
                X.Msg.Alert("Error""Given text is incorrect").Show();
            }

        }


_____________________________________________________________________
ASP Code
<ext:Window
            ID="winSignUp"
            runat="server"
            Closable="false"
            Resizable="false"
            Height="400"
            Icon="Lock"
            Title="Sign Up"
            Draggable="false"
            Width="350"
            Modal="true"
            BodyPadding="5"
            Layout="AnchorLayout"
            Hidden="true">
            <Items>
                <ext:TextField
                    ID="txtUserNameSignUp"
                    runat="server"                     
                    FieldLabel="User Name"
                    AllowBlank="false"
                    AnchorHorizontal="100%"
                    />
                <ext:TextField
                    ID="txtPasswordSignUp"
                    runat="server"
                    InputType="Password"
                    FieldLabel="Password"
                    AllowBlank="false"
                    AnchorHorizontal="100%"
                    />
                <ext:TextField
                    ID="txtRePassword"
                    runat="server"   
                    InputType="Password"                 
                    FieldLabel="Re Password"
                    AllowBlank="false"
                    AnchorHorizontal="100%"
                    />
                <ext:TextField
                    ID="txtEmailId"
                    runat="server"                    
                    FieldLabel="Email Id"
                    AllowBlank="false"
                    AnchorHorizontal="100%"
                    />
            </Items>
            <Content>
           
            <recaptcha:RecaptchaControl
    ID="recaptcha"
    runat="server"
    PublicKey="your public key"
    PrivateKey="your private key"
    />
            </Content>
              

            <Buttons>
                <ext:Button ID="btnCreateAccount" runat="server" Text="CreateAccount" Icon="Accept" >                 
                    <DirectEvents>
                        <Click OnEvent="btnCreateAccount_Click">
                            <EventMask ShowMask="true" Msg="Sign Up..." MinDelay="500" />
                        </Click>
                    </DirectEvents>

                </ext:Button>
            </Buttons>
        </ext:Window>
____________________________________


Wednesday, August 29, 2012

SQL 2008 - "SAVING CHANGES IS NOT PERMITTED." ERROR MESSAGE..

To fix this in Management Studio, go to 
Tools -> Options then go to the Designer Page and uncheck "Prevent saving changes that require table re-creation".