Tuesday, August 26, 2008

LINQ

LINQ - LANGUAGE INTEGRATED QUERY

ENVIRONMENT:




  1. Create DataClasses1.dbml.

  2. Create a database Test with table test which has Id (integer, PK) and Name (varchar(10)).

  3. Create a stored procedure GetDatas

  4. Using server explorer connect to database Test and add the table "test" and Stored proceure "getDatas" in the DataClasses1.dbml

* Once the dbml file is created system automatically creates a class "DataClasses1DataContext"

EXAMPLES

  1. Retrieve data from Table test

    using (DataClasses1DataContext dc = new DataClasses1DataContext())
    IEnumerable t = from b in dc.tests select b; //where b.name.StartsWith("Ra")
    foreach (test t1 in t)
    {
    Console.WriteLine(t1.name);
    }
    }

  2. retrieve data from Stored Procedure
    using (DataClasses1DataContext dc = new
    {
    var t = from b in dc.getDatas() select b;
    foreach (var t1 in t)
    {
    Console.WriteLine(t1.name);
    }
    }

  3. Insert in to Table test

    using (DataClasses1DataContext dc = new DataClasses1DataContext())
    {
    test d = new test();
    d.name = 'n';
    dc.duplicates.InsertOnSubmit(d);
    dc.SubmitChanges();
    }

  4. Updation
    using (DataClasses1DataContext dc = new DataClasses1DataContext())
    {
    IEnumerable t = from b in dc.tests select b; //where b.name.StartsWith("Ra")
    //Update Table
    test t2 = t.Single((a) => a.ID == 1);
    t2.name = "updated";
    dc.SubmitChanges();
    }


* If the datable doesn't contain primary key , you will not able to do insertion , updation and deletion . To
achieve this add attribute to any one of the column for that table in DataClasses1DataContext class as follows
[Column(Storage = "_id", DbType = "Int", IsPrimaryKey = true)]
public System.Nullable id
{
get
{
return this._id;
}
set
{
if ((this._id != value))
{
this._id = value;
}
}
}




Wednesday, August 20, 2008

Trip to Isha

After a long wait I managed to visit Isha Yoga Center on 20th June, 2008 with my wife.
My wife sowmiya was 6 months pregnant at that time and Its her first visit over there.
We reached isha yoga centre at 8 Am, and went to volunteer stay area, where we get refreshed and went to Theerthakund.Timing is different for gents and ladies to take bath in Theerthakund. I have some fear to send my Wife alone. But there was many volunters who took care of her. She went with them, once she enterd in to the water pool she felt her baby's movement, which was her first experience. No movement was experienced before. She was very happy.
Then we had a brekfast at 10.00 with lot of varieties and hygenic foods. We went inside the temple and spend some time. We attended Nadha Arathana which was really superb. While enteing in to the temple also she felt baby's movement, she spend most of the time inside the temple.
There was no prayer related to any religion nothing. Simply silence.
Then we returned back in evening.
Really good trip. We have decided to go to temple once in a month.

Whats Yoga?


There is a beautiful story about a caterpillar that lived much of its life believing that it had come into being only to eat and sleep and do what the rest of the caterpillars did. However it was unhappy. Somehow it sensed that its life had another dimension not yet experienced.
One day, driven by a strange longing, it decided to become still and silent. It hung from the branch of a tree, weaving a cocoon around itself. Inside the cocoon, although constrained and uncomfortable, it waited, sensing and aware. Its patience bore fruit, for when the cocoon burst open, it was no longer the lowly worm that went in, but a beautiful, resplendent, winged butterfly which dazzled the sky. It soared and flew, no longer limited to its worm-like existence, but free and unbounded. The caterpillar had been transformed into a thing of air and lightness, magic and beauty.

Once the transformation had taken place, it was impossible for the butterfly to return to being a worm. In the cocoon, the caterpillar had become one with its inner being and in this union it reached its ultimate nature. What happened in the cocoon can be described as yoga. Yoga is the path towards being boundless.

Yoga transforms and liberates human beings so that they can reach this unbounded state. Humans, unlike animals, are not merely existing. They are becoming. To evolve as a human being is to become aware of one's limitations; to strive, with intense passion, towards the transcendence for which we all have the potential.