Thursday, September 24, 2015

Turbo C/C++ for Windows 7,8 and 10 with full screen mode

Recently I needed Turbo C and download from internet. I was little surprised why it is not working on full screen mode on windows 8. After spending lot of time on internet I found some trick and turbo C which works on full screen mode on Windows 7, 8 and 10.

If you are looking Turbo C and need to have in maximize mode then you can check this artical.
It might help you. It works fine on every version of Windows

1.You have to download TurboC from following location.
https://www.dropbox.com/s/jx330ion8wyo4jp/TurboC%2B%2B.rar?dl=0
2.You need to extract the folder.
3.Copy the folder in C Drive.
4.Run the exe from this location "C:\TurboC++\DOSBox.exe".
5.You can open HelloWorld program, compile and run it.

please let me know if you face any issue.

Saturday, July 13, 2013

Differences between bitwise OR and Logical OR in C#


Difference between bitwise OR and Logical OR in C#

Laugh between | and ||

Most of time we use bitwise OR rather than logical OR. But there is a very small thing which can sleep our eyes. Recently I was using and surprised in one business logic which was going fail. Then I relies it's been serious to use it.


            int a1 = 0, b1 = 0;

            bool x = (a1 == 0 || ++b1 != 0);/* here b1 is still 0. the '++b1 != 0' was not evaluated */

            Console.Write(x);/* True*/
            Console.Write(a1);/* 0 */
            Console.Write(b1);/* 0 */

            int a2 = 0, b2 = 0;

            bool y = (a2 == 0 | ++b2 != 0);/* here b2 is 1. the '++b2 != 0' was evaluated. */

            Console.Write(y);/* True */
            Console.Write(a2);/* 0 */
            Console.Write(b2);/* 1 */

I hope it helps you somewhere.


Sunday, July 7, 2013

Differences between Aggregation and Composition

UML diagram in Software development shows complete system by using its notation. Those are classes, properties, operation and relationships (Instance and Class Level). The most interesting notations in UML are relationship. Relationship is link between entities. There is a small extent between Aggregation and Composition in instance level relationship.

Association: It lines between two entities.

Aggregation: It shows “Has a” relationship. It is more specific than association. It is used when one part is container of other side. But contains classes do not have a strong dependency on the container. Means when container is disposed then contents are not destroyed.

Notation- in UML diagram aggregation is represented by hollow diamond shape.


Example - A Student and a Course are having an Aggregation relationship. 

    public class Student
    {
        private Course course;
        public Student(Course c)
        {
            this.course = c;
        }
    }
    public class Course
    {


    }

Composition: It shows “Owns a” relationship. It is even more specific than aggregation. It gives a high dependency on container. Where container is being disposed then contains classes must be destroyed.

Notation- in UML diagram Composition is represented by filled diamond shape.


Example - A Car and an Engine are having a Composition relationship. 

      public class Car
    {
        private Engine engine;
        public Car()
        {
            engine = new Engine();
        }
    }

    public class Engine
    {

    }

Now we are in differentiation in aggregation and composition- the relationship in association is object level. It shows container and part. Aggregation has soft relationship but composition is based on strong and believes to destroy its complete parts.

Saturday, February 2, 2013

NHibernate - Generate Id from seed table


Recently I came across a problem where I had to auto generate entity Id by using seed table of database. I was not allowed to keep auto generate at database level.  I was using NHibernate ORM.

Scenario:
I have a seed table.
   Table : Seed
   Columns :
            1.       TableName
            2.       LastId
      I have to use this table to create id for other tables. I was looking a better way to accomplish this.

Solution :
            1.       Create a seed generator class - NHibernate gives an interface IIdentifierGenerator which really helps lot. It gives a signature to use and pass id.


namespace SimpleNHibernateClient.ConsoleApplication
{
    using NHibernate.Id;

    /// <summary>
    /// Seed Generator
    /// </summary>
    public class SeedGenerator<T> : IIdentifierGenerator
    {
        public object Generate(NHibernate.Engine.ISessionImplementor session, object obj)
        {
            return 1;/* Take it from seed table corresponding T. */
        }
    }
}


          2.       Entity Class-This is a entity class to be saved into database.

namespace SimpleNHibernateClient.ConsoleApplication
{
    public class Student
    {
        public virtual int Id { getset; }
        public virtual string Name { getset; }
    }
}

         3.       Mapping Class-This is a mapping class to be used for mapping and calling seed generator.


namespace SimpleNHibernateClient.ConsoleApplication
{
    using FluentNHibernate.Mapping;

    public class StudentMap : ClassMap<Student>
    {
        public StudentMap()
        {
            Table("Student");
            Id(x => x.Id, "Id").GeneratedBy.Custom<SeedGenerator<Student>>();
            Map(x => x.Name, "Name");
        }
    }
}

Now it gets generated by Generate Method.

Saturday, January 5, 2013

Use Test Manager for Silverlight Application

Use Test Manager for Silverlight Application

Step:

1. Test Plan

2. Suite

3. Test Case

4. Action

5. Record

6. Play


If you want to use Test Manager for Silverlight Application and you haven't installed it then you can refer [my post]



Step 1:  Test Plan

When you open Test Manager then you see a dialog box. This dialog box shows your test plan from TFS.



About Test Plan : Test Plan is a folder and it is a Root Node. for example Project Name.

if you are looking for new test plan then click on add button of top of dialog. add new Test Plan


Step 2: Suite

Click on New Button and click on suite.

now you can create a suite

About Suite : Suite is a logical group of your module. for example Login Suite


Step 3: Test Case

Now time to create Test Case.Click on new button and give title of Test Case and detail

Step 4: Action

Add action for test case

Step 5: Record

Now It records the test.

Step: 6:

Play test cases.

so enjoy with Test Manager. It is nice tool to make automated test cases.