Friday, December 15, 2006

ex - Microsoft whiz and next Space tourist

Hungarian-born billionaire and ex-Microsoft whiz kid Charles Simonyi sees his trip next year on a Russian Soyuz spacecraft to the International Space Station as a chance to do some good.

 

Simonyi, 58, left his native Hungary at 17 for the United States where he made a fortune after joining in 1981 the "start up" Microsoft, for which he oversaw the development of Word and Excel and which he left in 2002 to co-found Intentional Software Corporation.

http://www.charlesinspace.com/

Link to Charles Simonyi, billionaire, ex-Microsoft whiz and next space tourist - Yahoo! News

Thursday, December 07, 2006

Arpico Food Court

It was last week Saturday, after spending the first half in the office, I had to shop with my wife, as we were absolutely starving first we started with our lunch at arpico food court, as I entered to the food court I noticed that setup has been changed, 

 it was not the way it used to be, earlier each food outlet had their Owen individual cash machine with them (POS), which was very convenient and time saving, I mean when you decide which type of food you want and you can find that desired outlet pay the money and you can order you food while you wait without wasting your time, which is most effective for place like server foods,

 my point is that if the selected outlet is having along queue or if they are busy still you have option to find some other outlet and eat as much as you want,.

 Unlike that these people have made it worst and its a full of crap, now they have a single place with couple of cashiers where you can see the huge list of all outlets and their menus with menu numbers on the wall and since they have only two cashiers, you have to wait in the queue till your turn to order what you want and get the order receipt, then you have to find that outlet and handover that receipt to them then again you have to wait for your turn.

So most of the time you may have to wait in long queues and another thing is they don't have a food show case.

I just want to share this bad experience, anyway I have decided to not to go their again. 

Consider this when you go to a food court in rush our.

Friday, December 01, 2006

Using the Enterprise Library Data Access Block for .Net 2.0

Using the Enterprise Library Data Access Block for .NET 2.0

Read the Article

Summery :-

Writing database-access code is a repetitious and time-consuming task, but now that it's available as a reusable Enterprise Data Access Application Block, you'll never have to write such code again.

Microsoft has redesigned version 2.0 of the Data Access Block to take advantage of new ADO.NET 2.0 features. You can download the EntLib Data Access Block from MSDN.
Using the Data Access Block
To use the Data Access Block successfully, you will need to go through the steps listed below:

  1. Add a reference to the Microsoft.Practices.EnterpriseLibrary.Common.dll and Microsoft.Practices.EnterpriseLibrary.Data.dll assemblies from your solution. You can do this by using the "Add Reference" option and navigating to the <Drive Name>:\Program Files\Microsoft Enterprise Library January 2006\bin folder.
  2. Add the necessary configuration entries to the web.config or app.config file or a custom configuration file. To this end, you add the below <configSections> element under the root <configuration> element.
       
    <configSections>
    <section
    name="dataConfiguration"
    type="Microsoft.Practices.
    EnterpriseLibrary.Data.
    Configuration.
    DatabaseSettings,
    Microsoft.Practices.
    EnterpriseLibrary.Data" />
    </configSections>
    Then you also add the <dataConfiguration></SPAN< class=pf element directly under the root <configuration> element as shown below:
             <dataConfiguration          
    defaultDatabase=
    "AdventureWorksDB"/>
    In this example, I have marked AdventureWorks as the default database, declared separately under the <connectionStrings> element.
              <connectionStrings>
    <add
    name="AdventureWorksDB"
    providerName=
    "System.Data.SqlClient"
    connectionString=
    "server=localhost;
    database=AdventureWorks;
    UID=user;PWD=word;" />
    </connectionStrings>

  3. Import the core Microsoft.Practices.EnterpriseLibrary.Data namespace for the Data Access Block.
  4. Start writing code against the classes in the preceding namespace.

Whenever you work with the Data Access Block, you'll have to deal with the Database class first. The Database class represents the database itself, and provides methods  that you can use to perform CRUD (Create, Read, Update and Delete) operations against the database.


Execute a Query Returning a DbDataReader

I'll start with a simple example. You'll execute a simple SQL statement against the AdventureWorks database and retrieve the results in the form of a DbDataReader object, which you'll then bind to a GridView control in an ASP.NET page.  contains the full page code. Here's the Page_Load script:

   <script runat="server">
void Page_Load(object sender, EventArgs e)
{
Database db = DatabaseFactory.CreateDatabase();
string sqlCommand = "Select " + "EmployeeID,
NationalIDNumber," + "LoginID, Title from " +
"HumanResources.Employee ";
DbCommand dbCommand = db.GetSqlStringCommand
(sqlCommand);
using (IDataReader reader = db.ExecuteReader(
dbCommand))
{
gridEmployees.DataSource = reader;
gridEmployees.DataBind();
}
}
</script>
Transactional Code Block for Performing
Multiple Updates
There are times where you may want to execute
multiple operations against a database,
but perform them all within the scope of a
single transaction.
The EntLib Data Access Block enables this scenario by
providing the Database.CreateConnection() method
that allow you to get a reference to an ADO.NET 2.0
DbConnection object. Using the DbConnection object,
you can obtain a reference to a DbTransaction object
by calling the BeginTransaction() method,
assigning the return value to a DbTransaction
variable. Subsequently, you can then easily control
the transaction behavior by invoking either the
Commit() or Rollback() methods when the execution
succeeds or fails, respectively.
The following pseudo code shows how to execute
multiple stored procedures within the scope of a
single transaction.
   Database db = DatabaseFactory.CreateDatabase();
//Two operations, one to add the order
//and another to add order details
  string sqlCommand = "InsertOrder";
DbCommand orderCommand =
db.GetStoredProcCommand(sqlCommand);
//Add InsertOrder parameters
sqlCommand = "InsertOrderDetails";

DbCommand orderDetailsCommand =
db.GetStoredProcCommand(sqlCommand);
   //Add InsertOrderDetails parameters
using (DbConnection connection =
db.CreateConnection())
{
connection.Open();
DbTransaction transaction =
connection.BeginTransaction();
try
{
//Execute the InsertOrder
db.ExecuteNonQuery(orderCommand,
transaction);

//Execute the InsertOrderDetails
db.ExecuteNonQuery(
orderDetailsCommand,
transaction);
//Commit the transaction
transaction.Commit();
}
catch
{
//Roll back the transaction.
transaction.Rollback();
}
}