SQL SERVER – DECLARE Multiple Variables in One Statement

June 10th, 2009 by pinaldave § 0

SQL Server is great product and it has many feature which are very unique to SQL Server. Regarding feature of SQL Server where multiple variable can be declared in one statement, it is absolutely possible to do.

Method 1: Multiple statements for declaring multiple variables

DECLARE @Var1 INT
DECLARE
@Var2 INT
SET
@Var1 = 1
SET @Var2 = 2
SELECT @Var1 'Var1', @Var2 'Var2'
GO

Method 2: Single statements for declaring multiple variables

DECLARE @Var1 INT, @Var2 INT
SET
@Var1 = 1
SET @Var2 = 2
SELECT @Var1 'Var1', @Var2 'Var2'
GO

From above example it is clear that multiple variables can be declared in one statement. In SQL Server 2008 when variables are declared they can be assigned values as well.

Reference : Pinal Dave (http://www.SQLAuthority.com)

Building Custom Control Using ASP.NET 3.5

June 8th, 2009 by vivek.navadia § 2

The two basic types of controls are fully rendered and composite controls. When you build a fully rendered control, you start from scratch. You specify all the HTML content that the control renders to the browser. When you create a composite control, on the other hand, you build a new control from existing controls.

Typically, when building a basic control, you inherit your new control from one of the following base classes:

System.Web.UI.Control

System.Web.UI.WebControls.WebControl

System.Web.UI.WebControls.CompositeControl

The CompositeControl class inherits from the WebControl class, which inherits from the Control class. Each of these base classes adds additional functionality.

Building Rendered Controls

Let’s start by creating a simple fully rendered control. When you create a fully rendered control, you take on the responsibility of specifying all the HTML content that the control renders to the browser.

Create new VB Web Application Project from File Menu and let’s name it NHSWebApplication. After Creating Web Application project just right click on App_Code folder (if not in solution then first create folder named App_Code) and add one class file name TestControl.vb.

Note: Any code added to the App_Code folder is compiled dynamically.

The Code of TestControl.vb file is as shown below

‘Namespace Declared

Namespace NHSWebApplication

‘TestContril Class is inherited from base class CONTROL

Public Class TestControl

Inherits Control

‘Declaring Local Variables for Getting and Setting Value of ROWS and COLUMNS attribute

‘assigned from HTML code of ASPX page

Private _Rows As Integer

Private _Columns As Integer

‘Declaring Properties (Attributes) of control to set ROWS from HTML code of ASPX Page

Public Property Rows() As Integer

Get

Return _Rows

End Get

Set(ByVal value As Integer)

_Rows = value

End Set

End Property

‘Declaring Properties (Attributes) of control to set COLUMNS from HTML code of ASPX Page

Public Property Columns() As Integer

Get

Return _Columns

End Get

Set(ByVal value As Integer)

_Columns = value

End Set

End Property

‘Overrides the RENDER method to draw html content

Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)

writer.RenderBeginTag(HtmlTextWriterTag.Table)

‘First loop to create Rows

For i As Integer = 0 To _Rows – 1

writer.RenderBeginTag(HtmlTextWriterTag.Tr)

‘Inner loop to Create Columns

For j As Integer = 0 To _Columns – 1

writer.AddAttribute(“Style”, “border:solid 1px #000000″)

writer.RenderBeginTag(HtmlTextWriterTag.Td)

writer.Write(“Rendering Costom Control”)

writer.RenderEndTag()

Next

writer.RenderEndTag()

Next

End Sub

‘End of the Rendering of Custom control

End Class

End Namespace

As we see in above code RENDER method is override and the object of HtmlTextWriter class is passed to HTML Tag that needs to be rendered. For example

writer.RenderBeginTag(HtmlTextWriterTag.Table) same as <Table>

writer.RenderBeginTag(HtmlTextWriterTag.Tr) same as <tr>

writer.RenderBeginTag(HtmlTextWriterTag.Td) same as <td>

Attributes of each of the Tag is added using

writer.AddAttribute(“Style”, “border:solid 1px #000000″)

and it is same as

style=”border:solid 1px #000000)

so After each iteration it will create specified row and columns with specified format.

Now just build your application and then add new Web Form. Let’s say TestCustomControl.aspx. Open its design view or HTML view and see the Toolbox. You will find the custom control named TestControl. Just drag it on Design view or html code. See sample code of ASPX Page below.

<html xmlns=”http://www.w3.org/1999/xhtml” >

<head runat=”server”>

<title>Untitled Page</title>

</head>

<body>

<form id=”form1″ runat=”server”>

<div>

<cc2:TestControl ID=”TestControl1″ runat=”server” Rows=”2″ Columns=”3″>

</cc2:TestControl>

</div>

</form>

</body>

</html>

It will render a custom control on web form with Table having 2 rows and 3 columns with 1px Black border

Rendering Costom Control

Rendering Costom Control

Rendering Costom Control

Rendering Costom Control

Rendering Costom Control

Rendering Costom Control

Hope, this article will help you to understand how to build custom rendered control. I will write about building composite control soon.

Top 25 Most Dangerous Programming Errors

June 5th, 2009 by hardik.gohil § 1

1     Improper Input Validation
2     Improper Encoding or Escaping of Output
3     Failure to Preserve SQL Query Structure (‘SQL Injection’)
4     Failure to Preserve Web Page Structure (‘Cross-site Scripting’)
5     Failure to Preserve OS Command Structure (‘OS Command Injection’)
6     Clear text Transmission of Sensitive Information
7     Cross-Site Request Forgery (CSRF)
8     Race Condition
9     Error Message Information Leak
10   Failure to Constrain Operations within the Bounds of a Memory Buffer
11   External Control of Critical State Data
12   External Control of File Name or Path
13   Untrusted Search Path
14   Failure to Control Generation of Code (‘Code Injection’)
15   Download of Code Without Integrity Check
16   Improper Resource Shutdown or Release
17   Improper Initialization
18   Incorrect Calculation
19   Improper Access Control (Authorization)
20   Use of a Broken or Risky Cryptographic Algorithm
21   Hard-Coded Password
22   Incorrect Permission Assignment for Critical Resource
23   Use of Insufficiently Random Values
24   Execution with Unnecessary Privileges
25   Client-Side Enforcement of Server-Side Security

If you want to go through with example then please Refer below link:

http://www.softwaretestinghelp.com/top-25-common-programming-bugs-every-tester-should-know/#more-353

How to Find and Replace in Update Query?

June 5th, 2009 by kuldip.bhatt § 0

How to Find and Replace in Update Query ?

For e.g. I have field name orderFreQuencyvalues in tbl_OrderFrequency_mst

This Field contains values like ’04:30,05:00,05:30,06:00′ i.e coma separated values in one field of a table.

Now, how do I replace ’06:00′ with ’06:30′ in a query ? Let do it here.

Declare the Variables.

DECLARE  @find      varchar(255),
@replace   varchar(255),
@patfind   varchar(255)

Initialize the values for the variables.

SELECT   @find    = ’06:00′,
@replace = ’06:30′

SELECT   @patfind = ‘%’ + @find + ‘%’

Run the below query.

UPDATE   tbl_OrderFrequency_mst
SET      orderFreQuencyvalues = STUFF( orderFreQuencyvalues,
PATINDEX( @patfind, orderFreQuencyvalues ),
DATALENGTH( @find ),
@replace )

WHERE    orderFreQuencyvalues LIKE @patfind

STUFF( text or Field Name , start , length , Replace value)

Purpose of STUFF:
Deletes a specified length of characters and inserts another set of characters at a specified starting point

Patindex( FindValue , text or Field Name)
Find the Index where Findvalue Start

Datalength( TextData )
Return the lenght of the text

I hope you find this useful somewhere.

Etymology Of Decorator Pattern

June 5th, 2009 by vishal.shukla § 0

Today our purpose is to know why decorator pattern. In last post, we found that there is class explosion if we go with the first trial. Now what we can do to improve this design is, we can have one abstract super-class Food which will be specialized by Pizza and Sandwich classes. Food class will be abstract:


public abstract class Food {
private List ingredients;
private String description;
public abstract double cost();
}

Pizza class will extend this Food class and add pizza specific property in this class. For example, crustType, extraCheese, olives, jalapano, paneer etc. If the pizza subclass needs to add jalapano in the toppings, value of jalapano will be true. Similarly, we can have Sandwich class, extending Foot class and adding some Sandwich specific properties to it.

Read More >>

How to Change the Default Location of the My Documents Folder

June 5th, 2009 by gaurang.tripathi § 0

The My Documents folder is your own personal and Most important folder in which you can store your documents, graphics, Music and mostly default location for downloads. By default, the target or actual location of the My Documents folder is C:\Documents and Settings\user name\My Documents, where C is the drive in which Windows is installed, and user name is the currently logged-on user.

Why should we change the default location of My Document Folder ?

(1) In order to maintain data and make it easily available and keep it secure with other files.

(2) Often we forgot to backup My Document Folder Before our PC is being formatted and accidently our whole data in My Document is Erased, So this is the best practice for you to make sure that your all data is secured before formatting C Drive (System Drive).

To change the default location of the My Documents folder, follow these steps:

1.  Click Start, and then point to My Documents.

2. Right-click My Documents, and then click Properties.

3. Click the Target tab.

4. In the Target box, do one of the following:

* Type the path to the folder location that you want, and then click OK.

For example, D:\My Stuff.

* If the folder does not exist, the Create Message dialog box is

displayed. Click Yes to create the folder, and then click OK.

OR

Click Move, click the folder in which to store your documents, and then  click OK twice.

If you need to create a new folder, click Make New Folder. Type a name for the folder, and then click OK twice.

5. In the Move Documents box, click Yes to move your documents to the new location, or click No to leave your documents in the original location.

Restore the My Documents Folder to Its Default Location :

1.  Click Start, and then point to My Documents.

2. Right-click My Documents, and then click Properties.

3. Click Restore Default, and then click OK.

4. In the Move Documents box, click Yes to move your documents to the new location, or click No to leave your documents in the original location.

Introduction To Salesforce Platform

June 5th, 2009 by pankaj.lalwani § 0

What is Salesforce?

Salesforce.com is a vendor of Customer Relationship Management (CRM) solutions, which it delivers to businesses over the Internet using the software as a service model.

History

Origins

Salesforce.com was founded in 1999 by former Oracle executive Mac Benioff . In June 2004, the company went public on the New York Stock Exchange under the stock symbol CRM. Initial investors in salesforce.com were Marc Benioff,Larry Ellison,Halsey Minor, Magdalena Yesil and Igor Sill, Geneva Venture Partners.

Current status

Salesforce.com is headquartered in San Francisco, California, with regional headquarters in Dublin (covering Europe, Middle East, and Africa), Singapore (covering Asia Pacific less Japan), and Tokyo (covering Japan). Other major offices are in Toronto, New York, London, Sydney, and San Mateo, California. Salesforce.com has its services translated into 16 different languages and currently has 55,400 customers and over 1,500,000 subscribers. In 2008, Salesforce.com ranked 43rd on the list of largest software companies in the world.

Products and Services

Customer Relationship Management

Salesforce.com’s CRM solution is broken down into several applications: Sales, Service & Support, Partner Relationship Management, Marketing, Content, Ideas and Analytics.

Force.com Platform

Salesforce.com’s Platform-as-a-Service product is known as the Force.com Platform. The platform allows external developers to create add-on applications that integrate into the main Salesforce application and are hosted on salesforce.com’s infrastructure.

These applications are built using Apex (a proprietary Java-like programming language for the Force.com Platform) and Visualforce (an XML-like syntax for building user interfaces in HTML, AJAX or Flex).

AppExchange

Launched in 2005, AppExchange is a directory of applications built for Salesforce by third-party developers which users can purchase and add to their Salesforce environment. As of September 2008, there are over 800 applications available from over 450 ISVs.

Customization

Salesforce users can customize their CRM application. In the system, there are tabs such as “Contacts”, “Reports”, and “Accounts”. Each tab contains associated information. For example, “Contacts” has standard fields like First Name, Last Name, and Email.

Customization can be done on each tab, by adding user-defined custom fields.

Customization can also be done at the “platform” level by adding customized applications to a Salesforce.com instance, that is adding sets of customized / novel tabs for specific vertical- or function-level (Finance, Human Resources, etc) features.

Web Services

In addition to the web interface, Salesforce offers a Web Services API that enables integration with other systems.

Mobile support

In April 2009, Salesforce released a slimmed down version of their application for subscribers with Blackberry, iPhone, and Windows mobile devices

Languages

English, Dutch, Spanish, German, French, Finnish, Swedish, Japanese, Italian, Portuguese (Brazilian), Korean, Russian, Thai, Danish, Simplified Chinese and Traditional Chinese. Application and online help & training documentation are available in these languages.

Also, end user languages are available in Hungarian, Czech, Turkish, Polish, Lithuanian, Latvian & Estonian.

Other

Other technologies in use at salesforce.com are Resin Application Server, and the in-house technologies Apex (a Java-like programming language and programming platform) and S-controls (Salesforce widgets – these are predominantly based on JavaScript).

ADVANTAGES

Cloud Computing

These new ways of building and running applications are enabled by the world of cloud computing, where you access applications, or apps, over the Internet as utilities, rather than as pieces of software running on your desktop or in the server room. This model is already quite common for consumer apps like email and photo sharing, and for certain business applications, like customer relationship management (CRM).

Force Platform is the world’s first Platform as a Service (PaaS), enabling developers to create and deliver any kind of business application in the cloud, entirely on-demand Platform App and without software

Data-Centric Apps

A data-centric app is an application that is based on structured, consistent information such as you might find in a database or an XML file.We can find these data-centric apps everywhere, in small desktop databases like Microsoft Access or FileMaker, all the way to the huge systems running on database management systems like Oracle or MySQL. Unlike applications that are built around unstructured data, like plain text documents or HTML files, data-centric apps make it easy to control, access, and manage data.

  • Unparalleled time to value. Salesforce.com minimizes the risk involved in implementing business applications like CRM by eliminating the need for up-front capital investment, making the path to CRM success exceptionally short. Salesforce implementations usually take less than a month and rarely exceed three months, compared to 12 months or longer with client/server software. According to a recent study by Triple Tree and the Software and Information Industry Association (SIIA), on-demand deployments are 50 to 90 percent faster, with a total cost of ownership five to ten times less than installed software.
  • Less expensive initially-and in the long run. It’s easy to see why a multitenant, on-demand solution is much less expensive initially. There is no hardware to purchase, scale, and maintain, no operating systems, database servers, or application servers to install, no consultants and staff to manage it all, and no need for periodic upgrades.
  • Easy upgrades. Customers of on-demand applications benefit from instant deployment of new versions, which means the entire customer base is always on the latest version. Since customizations and integrations are maintained through upgrades, change management discussions can focus on taking immediate advantage of the new features and innovations available with each release.
  • Better service delivery. Due to the on-demand model’s tremendous economies of scale and our seven-year focus on service delivery, salesforce.com can provide higher service levels than the vast majority of companies can achieve on their own. We use the best technologies, policies, and procedures to ensure security at the facilities, application, and network level; to ensure maximum uptime and continuous availability; and to provide a performance record we’re proud of. In fact, we’re the only vendor who makes performance statistics available on a public site: http://trust.salesforce.com.
  • Better scalability. Successful businesses are continually changing and growing: Employee growth, transaction growth, the launching of new products and services, mergers and acquisitions, or any number of business events can dramatically and suddenly alter business needs.
  • Easier to customize. Users of on-premise solutions have no choice but to wait weeks or months for even minor modifications to their applications, and in some cases their requests are never met at all. The Salesforce application was designed from the beginning to make performing basic customizations to the user interface and underlying data objects easy, so that even business users could customize in minutes, without programming. Without the burden of fulfilling constant requests for minor customizations, IT is free to concentrate on performing more advanced customizations, such as associating specific behavior with objects that can be triggered by a wide range of system events.
  • Users are more satisfied and productive. A major reason on-premise deployments often fail is because of low user adoption-data that’s cluttered or difficult to get to quickly results in user resistance. Salesforce’s award-winning, easy-to-use interface has resulted in the highest user adoption rates in the industry.
  • Easier for administrators. Administrators can tailor processes and define how data is viewed for different departments and work groups, while ensuring that users can access only that data for which they are authorized. Salesforce’s ease of use extends to its administration functions. In fact, Forrester named Salesforce the “#1 On-Demand CRM Solution for Administration.”
  • Nurturing true value and innovation. By eliminating many of the problems related to traditional application development, the on-demand model frees developers to focus on developing solutions that deliver real business value. Salesforce.com supports developers with a host of on-demand development tools-including a point-and-click customization tool, toolkits for the most popular development environments, and the upcoming Force.com programming language-Apex-as well as the Force.com Developer Network. The Force.com community has grown rapidly, resulting in hundreds of innovative solutions that are made available to customers via the AppExchange directory, salesforce.com’s popular marketplace for pre-integrated, on-demand applications.

Disadvantages

Detractors claim that sales force management systems are:

  • difficult to work with
  • require additional work inputting data
  • dehumanize a process that should be personal
  • require continuous maintenance, information updating, and system upgrading
  • costly
  • difficult to integrate with other management information systems

Technologies Behind a Force Platform App

Multitenant architecture :

An application model in which all users and apps share a single, common infrastructure and code base.

Metadata-driven development model:

An app development model that allows apps to be defined as

declarative “blueprints,” with no code required. Data models, objects,forms, workflows, and more are defined by metadata.

Force PlatformWeb Services API:

An application programming interface that defines a Web service that provides direct access to all data stored in Force Platform from virtually any programming language and platform

Apex:

The world’s first on-demand programming language, which runs in the cloud on Force Platform servers

Visualforce

A framework for creating feature-rich user interfaces for apps in the cloud

Force Platform Sites

Public websites and applications that are directly integrated with your Salesforce organization-without requiring users to log in with a username and password

AppExchange directory

A Web directory where hundreds of AppExchange apps are available to Salesforce customers to review, demo, comment upon, and/or AppExchange directory install. Developers can submit their apps for listing on the AppExchange directory if they want to share them with the community.

Future

  • A shift from the mainframe to client/server systems, resulting in a move from legacy systems to packaged enterprise systems.
  • The rise of the PC, resulting in unprecedented user productivity-as well as a proliferation of data islands.
  • The rise of the Internet and perpetual network access, which led to an information explosion and changed the way millions of people work, play, and shop.
  • The emergence of Web services standards and technologies such as multitenant architectures.
  • The move towards service oriented architecture (SOA) approaches by most major software vendors, making integration with back-end systems easier.
  • The emergence of the on-demand model, which shifted the software market from an ownership to a “rental” model, freeing businesses from ownership hassle and expense. Salesforce.com is one of the most successful examples of this model, with 35,300 customers and more than 575 applications.

Applications Developed in Salesforce

All of the public web sites listed here have been built with Force.com Sites and run on the Force.com platform.

http://developer.force.com/sitesgallery

Currently, at digicorp we are developing an healthcare application on salesforce platform some brief overview about the application is as follows:

Used to store patient’s details like, Vital, Allergies, Medications order, Radiology order, Lab order, Referral order, Patient’s history etc. User can generate the messages for different type of orders to clerk/provider to enter into system/signoff respectively. It alos allows to store scanned documents of patients’ documents and generate the message to the provider as well. It allows to print the reports of Patient visits, orders, documents etc.

Original Content From:

http://www.salesforce.com

http://en.wikipedia.org/wiki/Salesforce.com

First Trial To Objectize Objectville

June 1st, 2009 by vishal.shukla § 0

We have our small menu ready now, we know what all we are going to serve in Objectville. Oops, it may seem strange if you are new here in Objectville. New readers, just have a look at New Restaurant In Town and continue here. Lets prepare class for each item
Classes we need to create:

    DoubleCheesePizza
    ItalianPizza
    FreshVeggiePizza
    Vegetable Sandwich
    Cheese Sandwich
    Aalu-matar Sandwich

We also need to take care of our ordering system in hotel so we need one attribute called “cost” in all of the above classes. We will have descriptions of each item. Keeping in mind likings of customers, we need to have thin crust pizzas, as well as thick crust pizza. So lets have a look at these classes.

Read More >>

Where am I?

You are currently viewing the archives for June, 2009 at Digicorp.