10 July 2013

LINQ expressions return type is IEnumerable Collection objects

Hi All,

Recently I came across a situation where-in I was asked by my colleague as what is the LINQ expression's return type. I happened to answer him that it's IEnumerable collection.

May be I needed to do a research until when I found this link...
The summary of the blog by Mr.Charlie Calvert is as follows:
"LINQ query is deferred query evaluation, i.e. the query expression executes when we iterate thru or access its contents until then the query is not executed.
We generally write a LINQ query as
from x in y
where x is the content of the datasource y. And this datasource must implement the IEnumerable interface.
Also the LINQ objects are Composable meaning that the output of a LINQ query can be made as an input to another LINQ query.This is possibly because the LINQ query only accepts objects that implement IEnumerable interface as datasources and also returns the return type as IEnumerable objects. Hence this is possible."

Thanks for reading..
And don't forget to share your valuable feedback as it helps us to know that my effort is useful...and also helps me in improving if pointed out my drawbacks.


With Love,
Satish Bommideni
LINQ expressions return type is IEnumerable Collection objectsSocialTwist Tell-a-Friend

14 October 2009

Chill - out watching this animation..!

Hey Guys & Gals..!
Watch this awesome animation by clicking here
Chill - out watching this animation..!SocialTwist Tell-a-Friend

22 September 2009

A Funny HRD Notice...!

Dear STAFF,

Please be advised that these are NEW rules and regulations implemented to raise the efficiency of our firm.


1) TRANSPORTATION:

It is advised that you come to work driving a car according to your salary.


a) If we see you driving a Honda, we assume you are doing well financially and therefore you do not need a raise.

b) If you drive a 10 year old car or taking public transportation, we assume you must have lots of savings therefore you do not need a raise.

c) If you drive a Pickup, you are right where you need to be and therefore you do not need a raise.

2) ANNUAL LEAVE :

Each employee will receive 104 Annual Leave days a year ( Wow! said 1 employee).

- They are called SATURDAYs AND SUNDAYs.


3) LUNCH BREAK:

a) Skinny people get 30 minutes for lunch as they need to eat more so that they can look healthy.

b) Normal size people get 15 minutes for lunch to get a balanced meal to maintain their average figure.

c) Fat people get 5 minutes for lunch, because that's all the time needed to drink a Slim Fast and take a diet pill.

4) SICK DAYS:

We will no longer accept a doctor Medical Cert as proof of sickness.

- If you are able to go to the doctor, you are able to come to work.

5) SURGERY :

As long as you are an employee here, you need all your organs.

- You should not consider removing anything. We hired you intact.

- To have something removed constitutes a breach of employment.

6) INTERNET USAGE :

All personal Internet usage will be recorded and charges will be deducted from your bonus (if any) and if we decide not to give you any, charges

will be deducted from your salary.

- Important Note: Charges applicable as Rs.20 per minute as we have 10MB connection.

Just for information, 73% of staff will not be entitled to any salary for next 3 months as their Internet charges have exceeded their 3 months salary.

Thank you for your loyalty to our company. We are here to provide a positive employment experience.

Therefore, all questions, comments, concerns, complaints, frustrations, irritations, aggravations, insinuations, allegations, accusations, contemplation, consternation and input should be directed somewhere else.


Best Regards,
HRD
A Funny HRD Notice...!SocialTwist Tell-a-Friend

24 June 2009

Using Microsoft .NET and C# with Oracle 9i

Using Microsoft .NET and C# with Oracle 9i


Oracle provides a software tool called ODP.NET that allows connectivity between the .NET languages and an Oracle database. This interface is a set of tools that allow the creation of .NET objects that connect directly to Oracle databases. Learn the basics of connecting to and performing simple queries to an Oracle database.

Prerequisites

Let’s face it -- neither Microsoft nor Oracle really wants to see their two flagship products work together. Microsoft would rather see a programmer use C# with SQL Server, Access, or just a plain XML data file before connecting to an Oracle data source. Oracle, on the other hand, has committed firmly to the J2EE development system for major development involving their databases.

However, Oracle does provide a software tool called ODP.NET that allows connectivity between the .NET languages and an Oracle database. This interface is a set of tools that allows the creation of .NET objects that connect directly to Oracle databases. This, at the very least, allows applications to connect to and make use of the power and capability of an Oracle database. It includes support for regular SQL queries and updates, stored procedures, and reading data from an Oracle record set into a .NET DataSet object, among other things. This article will cover the basics of connecting to and performing simple queries to an Oracle database using this set of objects.

First we’ll look at the set-up required to perform these tasks. If you are going to work with ODP.NET in ASP.NET applications, you will, obviously, need a web server with IIS and the .NET Framework installed and running. I will not be covering the steps needed to set up an IIS Web Application, as I will be focusing on actually working with the database.

If you are only working on a stand-alone application, you will just need the .NET Framework installed. In both cases, you will probably want some sort of development environment to allow easy editing of .NET code. Next, you will need to install the ODP.NET data provider on the web server if you are using ASP.NET or on your local machine if you are writing a stand-alone app. Also, each computer that will access the database as a client will need the Oracle client software installed. ODP.NET is a client-side library, and will need to be installed with your application if you are thinking of distributing your application widely. One of the nice things about ODP.NET is that it doesn’t require any extra configuration of the Oracle server. You can download the ODP.NET driver from the Oracle website at:

http://otn.oracle.com/software/tech/windows/odpnet/index.html

The first important thing to recognize about ODP.NET for Oracle 9i is that it contains two namespaces, first Oracle.DataAccess.Client. This contains the actual working classes for connecting to and acting on the Oracle database. The second namespace is Oracle.DataAccess.Types. This namespace has all the classes and methods required when working with specific Oracle data types. In this article, we won’t deal with the Types namespace at all. There are several classes to take note of in Oracle.DataAccess.Client and these are:

OracleConnection -- The basic class for connecting to a database

OracleCommand -- A class that represents a database command, either a text query or a stored procedure

OracleDataAdapter -- This class allows the programmer to pipe a returned Oracle record-set into a .NET DataSet

OracleParameter -- This class represents all the attributes and information in a stored procedure parameter

OracleDataReader -- This class represents a simple, read only data set, useful for quickly getting small, simple results, or data you will not want to change

Each of these classes will become very important in the future when we look a connecting to and working with an Oracle database.
Using Microsoft .NET and C# with Oracle 9iSocialTwist Tell-a-Friend

25 February 2009


SEAL THE DEAL


[SQL] Cannot perform an aggregate function on an expression containing an aggregate or a subquery.

This is a general problem for a newcomer to SQL Server.

select avg(count(ip)) from pagehits where [month] = 2 group by ip

will give the following error: “Cannot perform an aggregate function on an expression containing an aggregate or a subquery.” MS SQL Server doesn't support it.

Solution - use a derived table:

select avg(ipcount) from (select count(ip) ipcount from pagehits where [month] = 2 group by ip) as sub

I'm posting this because searches on the error message didn't return good results, so if someone else has this problem (read: when I forget this again) this may save some frustration.

SocialTwist Tell-a-Friend

The Basics of SQL Server.





What is RDBMS?

Relational Data Base Management Systems (RDBMS) are database management systems that maintain data records and indices in tables. Relationships may be created and maintained across and among the data and tables. In a relational database, relationships between data items are expressed by means of tables. Interdependencies among these tables are expressed by data values rather than by pointers. This allows a high degree of data independence. An RDBMS has the capability to recombine the data items from different files, providing powerful tools for data usage.

What is Normalization?

Database normalization is a data design and organization process applied to data structures based on rules that help building relational databases. In relational database design, the process of organizing data to minimize redundancy is called normalization. Normalization usually involves dividing a database into two or more tables and defining relationships between the tables. The objective is to isolate data so that additions, deletions, and modifications of a field can be made in just one table and then propagated through the rest of the database via the defined relationships.

What are different normalization forms?

1NF: Eliminate Repeating Groups

Make a separate table for each set of related attributes, and give each table a primary key. Each field contains at most one value from its attribute domain.

2NF: Eliminate Redundant Data

If an attribute depends on only part of a multi-valued key, remove it to a separate table.

3NF: Eliminate Columns Not Dependent On Key

If attributes do not contribute to a description of the key, remove them to a separate table. All attributes must be directly dependent on the primary key.

BCNF: Boyce-Codd Normal Form

If there are non-trivial dependencies between candidate key attributes, separate them out into distinct tables.

4NF: Isolate Independent Multiple Relationships

No table may contain two or more 1:n or n:m relationships that are not directly related.

5NF: Isolate Semantically Related Multiple Relationships

There may be practical constrains on information that justify separating logically related many-to-many relationships.

ONF: Optimal Normal Form

A model limited to only simple (elemental) facts, as expressed in Object Role Model notation.

DKNF: Domain-Key Normal Form

A model free from all modification anomalies is said to be in DKNF.

Remember, these normalization guidelines are cumulative. For a database to be in 3NF, it must first fulfill all the criteria of a 2NF and 1NF database.

What is De-normalization?

De-normalization is the process of attempting to optimize the performance of a database by adding redundant data. It is sometimes necessary because current DBMSs implement the relational model poorly. A true relational DBMS would allow for a fully normalized database at the logical level, while providing physical storage of data that is tuned for high performance. De-normalization is a technique to move from higher to lower normal forms of database modeling in order to speed up database access.

What is Stored Procedure?

A stored procedure is a named group of SQL statements that have been previously created and stored in the server database. Stored procedures accept input parameters so that a single procedure can be used over the network by several clients using different input data. And when the procedure is modified, all clients automatically get the new version. Stored procedures reduce network traffic and improve performance. Stored procedures can be used to help ensure the integrity of the database.

e.g. sp_helpdb, sp_renamedb, sp_depends etc.

What is Trigger?

A trigger is a SQL procedure that initiates an action when an event (INSERT, DELETE or UPDATE) occurs. Triggers are stored in and managed by the DBMS. Triggers are used to maintain the referential integrity of data by changing the data in a systematic fashion. A trigger cannot be called or executed; DBMS automatically fires the trigger as a result of a data modification to the associated table. Triggers can be viewed as similar to stored procedures in that both consist of procedural logic that is stored at the database level. Stored procedures, however, are not event-drive and are not attached to a specific table as triggers are. Stored procedures are explicitly executed by invoking a CALL to the procedure while triggers are implicitly executed. In addition, triggers can also execute stored procedures.

Nested Trigger: A trigger can also contain INSERT, UPDATE and DELETE logic within itself, so when the trigger is fired because of data modification it can also cause another data modification, thereby firing another trigger. A trigger that contains data modification logic within itself is called a nested trigger.

What is View?

A simple view can be thought of as a subset of a table. It can be used for retrieving data, as well as updating or deleting rows. Rows updated or deleted in the view are updated or deleted in the table the view was created with. It should also be noted that as data in the original table changes, so does data in the view, as views are the way to look at part of the original table. The results of using a view are not permanently stored in the database. The data accessed through a view is actually constructed using standard T-SQL select command and can come from one to many different base tables or even other views.

What is Index?

An index is a physical structure containing pointers to the data. Indices are created in an existing table to locate rows more quickly and efficiently. It is possible to create an index on one or more columns of a table, and each index is given a name. The users cannot see the indexes; they are just used to speed up queries. Effective indexes are one of the best ways to improve performance in a database application. A table scan happens when there is no index available to help a query. In a table scan SQL Server examines every row in the table to satisfy the query results. Table scans are sometimes unavoidable, but on large tables, scans have a terrific impact on performance.

The Basics of SQL Server.SocialTwist Tell-a-Friend

24 February 2009

What is RAD ?

Rapid Application Development (RAD)



One of the conveniences of developing software is that it is not a physical tool that can be lost once it gets developed or manufactured. Codes are used to implement the software and it does not disappear together with the product. We can re-use the code all over again in another software. We just make a little change in the interface to fit the requirement of the client and we have a brand new program. To make our lives even better in developing software, there are tools coming out of the marking that serves as code generators. No need to create complicated codes, we just run the system through our preferences and we have a fully functional program.
The idea of reusing codes and tools is what defines another form of Software Development Life Cycle called Rapid Application Development, or RAD. This form of software development constantly refers to the objective. Instead of creating original coding, developers use other tools such as software development kits and other graphic user interfaces to create programs. RAD also relies heavily on the available codes and reuses it to fit the intended program. Since RAD uses GUI, development kits and existing codes, software development will be faster.

The operational development of the software also works like the Prototype version. Instead of planning out and creating a single documentation, developers only have to look at the objective and use it as a “motivation” to create a program. It will be constantly tested and checked as the new “prototype” is released. Developers constantly create screens and show a workflow until it’s approved by users. It’s a very simple process since it doesn’t have to use so many original ideas. It’s basically an aggregate of different tools and cleverly using them to create a completely different software.

RAD focuses more on the visual instead of the coding or software development. Since it already uses tools for generating codes, developers will have more time setting up the GUI of the software rather than focusing on the root structure of the program. The development cycle also enlists the help of the users to make sure the product being developed could match their taste. This will ensure a good user feedback since their ideas was acknowledged and had an actual impact on the product development. RAD reduces stress in creating GUI, coding and structure since it has a remote possibility of being trashed by users.

Phases of RAD

Like most SDLCs, RAD also has a step by step process. But unlike other SDLCs, the process of developing a program under RAD is faster. Relying on sets of tools for software development, RAD will no longer have to force us to dig deeper in our coding techniques where we burn an hour or two just to complete a single command.

There are only three phases in Rapid Application Development:
Planning of Requirements, Design Workshop and Implementation.

1. Planning of Requirements

In this stage, developers meet with the project coordinator or manager to create specific objectives from the desired program. Strategies for development and tools for development are also laid out in a specific project. For business organizations, this stage is important since the projected answer to business concerns will be laid out for the first time. Everything in this stage is theoretical but it will be working together with the clients or businesses that need a software to answer their business need.

2. RAD Design Workshop

When the plans have been laid out; it is time to start building on the plans. Using the agreed tools and interfaces, developers will start to create different programs based on the business need. RAD requires a lot of feedback as it also requires a lot of software iteration. Since RAD already has the set of tools to create the program, developers will only need to refine the user interface. As tools make it easier to create the actual prototypes, users will be able to work on a prototype. Feedbacks and suggestions are welcomed as this will be the bases on of the additional software processes and commands. Slowly developers and users can come up with one prototype that is almost ready for public use.

3. Implementation Phase

After further refinement, the software will finally be introduced to the business or to their intended users. Even though it has gone through hundreds or even thousands of testing and critique, the stage wherein the software is implemented in a larger scale is different hence new suggestions and bugs should be expected from different users. Developers have to remember these inputs and use it for the next software update. Developers have to be sure that the software update will be correct so that users will abandon the older version. This will prevent the system from malfunctioning since only one version is used.

The difference of Design Workshop to the Implementation Phase is not only in bugs but in software implementation. In Design Workshop, developers have to start from the bottom to impress the users. In the latter phase, developers will only have to work in software updates to ensure wider user acceptance.

When do we use RAD?

* Experienced programmers are members of the team

RAD is a fast paced SDLC. Developers will be using different tools in order to achieve the goal of building a software fast. Although it does not need much coding because of the given set of tools, only experienced programmers could work on these tools. If anything happens to the software, only experienced developers could dig deep into the problem even though they did not encode the program.

* Expediting application development

For whatever reasons, developers are hard pressed to build applications fast. Using sets of tools, different software could be created in no time. The participation of the users will be greater since they will work in double time to check if the software is up with the standards.

* Quick solution for a business problem

The tools used in developing software have steps or processes that could cater to any business need. If a business needs an answer to their nagging question of productivity and better reporting, RAD could create the software based on the business need. There are lots of software which already have the functions needed by any businesses.

* Objective Oriented and Highly Critical Users
Everything starts and ends with the objective. Users have to use the software to achieve the intended goal faster or easier. Different user interface and workflows are based on the realization of the objective. RAD makes the developers focus more on answering the need before creating something on their own. The set of tools could be used to answer the problem. Even the design of the user interface could be influenced by users.
What is RAD ?SocialTwist Tell-a-Friend
 
#footer-column-container { clear:both; } .footer-column { padding: 10px; }