Skip to main content

Posts

Move classic EC2 instance into VPC

Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/ . Click Instances in the navigation pane. On the Instances page, right-click your running instance and select Create Image. Fill in a unique image name and an optional description of the image (up to 255 characters), and click Create Image. Go to the AMIs page and view the AMI's status. While the new AMI is being created, its status is pending . It takes a few minutes for the whole process to finish. Once your new AMI's status is available , go to the Snapshots page and view the new snapshot that was created for the new AMI. Any instance you launch from the new AMI uses this snapshot for its root device volume. You could update your Auto Scaling group with the new AMI, however we will do this as part of the AWS CloudFormation step. Important information: We have to wait 30 mins after Lauch, for Password configuration. The password is the same as for the instance from which you created the AM...

What is difference between constants and read-only?

Constant and ReadOnly keyword are used to make a field constant which value cannot be modified. Constant Constant fields or local variables must be assigned a value at the time of declaration and after that they cannot be modified. By default constant are static, hence you cannot define a constant type as static. public const int X = 10; A const field is a compile-time constant. A constant field or local variable can be initialized with a constant expression which must be fully evaluated at compile time. void Calculate(int Z) {   const int X = 10, X1 = 50;   const int Y = X + X1; //no error, since its evaluated a compile time   const int Y1 = X + Z; //gives error, since its evaluated at run time } You can apply const keyword to built-in value types (byte, short, int, long, char, float, double, decimal, bool), enum, a string literal, or a reference type which can be assigned with a value null. const MyClass obj1 = null;//no error, since its ev...

Classes in C#

Classes A class is a construct that enables you to create your own custom types by grouping together variables of other types, methods and events. Classes are declared by using the keyword class followed by the class name and a set of class members surrounded by curly braces. If the class is not declared as static, client code can use it by creating objects or instances which are assigned to a variable. The variable remains in memory until all references to it go out of scope. At that time, the CLR marks it as eligible for garbage collection. If the class is declared as static , then only one copy exists in memory and client code can only access it through the class itself, not an instance variable . Structs Structs are defined by using the struct keyword, for example: public   struct PostalAddress {     // Fields, properties, methods and events go here... } Structs share most of the same syntax as classes, although structs are more limited...

ASP.Net Page Life Cycle

When the page is requested by a user, ASP.NET determines whether the page needs to be parsed and compiled, or whether a cached version of the page can be sent in response without running the page. At each stage of the page life cycle, the page raises some events, which could be coded. Following are the page life cycle events: PreInit: PreInit is the first event in page life cycle and raised before the initialization stage begins. Use this event for the following:  Check the IsPostBack property to determine whether this is the first time the page is being processed. If the request is a postback, the values of the controls have not yet been restored from view state. If you set a control property at this stage, its value might be overwritten in the next event. The IsCallback and IsCrossPagePostBack properties have also been set at this time. Create or re-create dynamic controls. Set a master page & theme property dynamically. R...