Showing posts with label Fundamentals. Show all posts
Showing posts with label Fundamentals. Show all posts

Sunday, December 19, 2010

SQL Server SUBSTRING giving me incorrect results

I get incorrect result when i try to do a substring within a stored proc,but the same thing if i try it in a query window gives me proper results.

declare @FinalCol_List as varchar(100)
Set @FinalCol_List= '11,22,33,bb,'
print @FinalCol_List
IF LEN(@FinalCol_List) > 0
SET @FinalCol_List = SUBSTRING(@FinalCol_List, 1, LEN(@FinalCol_List) - 1)

print @FinalCol_List

Monday, December 14, 2009

Design of the UNSPSC: A Hierarchical Structure.

The UNSPSC is a hierarchical classification, having five levels. The levels allow users to search products more precisely (because searches will be confined to logical categories and eliminate irrelevant hits) and it allows managers to perform expenditure analysis on categories that are relevant to the company’s situation.
Each level contains a two-character numerical value and a textual description as follows:
XX Segment
The logical aggregation of families for analytical purposes
XX Family
A commonly recognized group of inter-related commodity categories
XX Class
A group of commodities sharing a common use or function
XX Commodity
A group of substitutable products or services
XX Business Function
The function performed by an organization in support of the commodity

UNSPSC Examples
In the UNSPSC classification, products and services are placed within logical categories so that people can more easily find what they are looking for and evaluate expenditures on commonly grouped items.
For example, the commodity “pen refills” is part of a larger class of products, “Ink and lead refills”, which in turn is part of a family of products, “Office supplies,” which is itself part of a segment of products, “Office equipment, accessories, and supplies.” Each level of the hierarchy has its own unique number.

Hierarchy Category Number and Name
Segment 44 Office Equipment, Accessories and Supplies
10 Office Machines and their supplies and accessories
11 Office and desk accessories
Family 12 Office supplies
15 Mailing supplies
16 Office supplies
17 Writing instruments
18 Correction media
Class 19 Ink and lead refills
01 India ink
02 Lead refills
Commodity 03 Pen refills

“Pen refills” = UNSPSC classification 44-12-19-03.
The hierarchy allows people looking for pen refills to use the higher level terms to narrow their search to the relevant domain that will most likely lead them to the desired item.
In post facto analysis of spending, purchasing managers can evaluate expenditures according to any level of the hierarchy. Companies that use significant amounts of writing utensils and supplies, such as architectural, graphic arts, and printing companies, may want to analyze spending on the class or commodity levels. Such analysis will allow them to spot opportunities where they can consolidate suppliers, find better sources, negotiate volume discounts, and similar optimizations of their supply chain. Companies where these items are not a significant portion of their spending, may elect to analyze spending on the higher family and segment categories only.
The UNSPSC can be further extended by adding a ninth and tenth digit after the commodity number. These numbers can indicate business relationships to the supplier such as rental/lease, wholesale, retail, or original equipment manufacturer (OEM).

Tuesday, April 21, 2009

Difference between Design Pattern & Framework

Framework:
A framework is a set of collaborative classes for a specific application that can be reused (API) following a predefined design.

A general specification that is collection Of classes and Interfaces APIs that are designed to work together to handle a particular type of Problem. Framework is a skeleton of code used for developing an application.

Eg: Struts based framework
(Action Classes, Configuration Files) grouped together called Framework

a framework is a finite solution that help you structure your code and solve a particular kind of problems. A framework is usually made of several patterns implementation. A framework is based upon the IoC (Inversion of Control) principle; your application just need to provide and declare some callback functions and start the framework. From there the framework is in charge of running the application, calling your callback functions whenever it's necessary. So as you can see, they are very different concepts, the main difference being that a framework is a physical and usable piece of code while a pattern is a logical design solution to a given kind of problem.

Design Pattern :

Best practice for solving a common problem.

Design Patterns is a solution for recursively occured problem. These patterns wont have sperate API.

A Design pattern is a way of doing common things in a special way .Each known pattern has evolved from the failures of many programs that had been written in various domains.The most effective way of dealing with a problem is documented in a given style recommended by GoF (Gang of Four). The patterns themselves are useless is not applied properly and needs some experiance in writing solutions and different scenarious has to be taken in mind. The pattern that is in close resemblance with the problem at hand is the pattern to work with. Patterns are tried and tested ways of writing programs better but dont be too hasty to apply them with a blind eye. They need patience and a sharp eye of distinction. Patterns are also related closely with the logic and the code.

A pattern may not be restricted to programs only. It extends to the database level too.