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).

Saturday, December 12, 2009

Why follow Standardised Taxonomy across domains

Enables buyers and employee requisitioners to find all suppliers of a
given category
Enables purchasing managers to analyze expenditures and perform
strategic sourcing
Consistent coding across company divisions, suppliers, and information
systems gives uniform picture of company expenditures.
Integrates procurement card statement categories with all purchase
transactional data.
One numbering system integrates entire processing flow - from RFPs, to
ordering, to accounts payable, to general ledger.
Facilitates control over and compliance to spending limits and
authorized commodities by individuals and departments.
A standardized, already devised code is easy to implement and saves the
company time and expense in developing its own.

Saturday, November 14, 2009

GO -> Google's OpenSource programming Language

Google has released it new opensource programming language called GO.
GO tends to be a mixture of C , C++ ,Phyton and Javascript.
It is said to be very fast in compilation (over 120K lines of code compiling in under 10 seconds)

Currently Google tells it still has not started implementing the GO platform for it own internal use, but it has started moving towards it.
GO runs on GO.

With Google Android for Mobile , Google Wave on Collaboration , Google GO will make a impact on the coming next generation of Software Applications

Features :

Maps is a inbuilt variable
Has no hierarchy, so no time is spent defining the relationships between types.
Has static types the language attempts to make types feel lighter weight than in typical OO languages
Does not provide Implicit Numeric conversion
Has pointers but no pointer arithmetic
Garbage Collection ( Mark - Sweep )
No Generics at this point (has the ability to use the empty interface to construct containers (with explicit unboxing))
No Exceptions

Tuesday, September 15, 2009

MySQL: Set Auto Increment Value of a Table

I have come across many times where in we keep deleting rows from behind the database and when we run the application, suddenly things are not working.

One Main reason for this is some reference table is still incrementing vaules but the main table would have been gone ahead increment.and hence the mapping between the tables have gone haywire.

So to fix this it is necessary to reset our tables AutoIncrement(auto-index) Values.

Query :
ALTER TABLE table_name AUTO_INCREMENT = start_value

If you want to start a increment from value 100 then query is as

Incase you want have cleared all the data from the table , and want the table to start the increment from 1,
TRUNCATE TABLE table_name 

Note :

When TRUNCATE is fired if there are any existing triggers of ON DELETE will not be fired

Tuesday, August 25, 2009

NHPC IPO Allotment status

NHPC IPO has had an outstanding subscription of nearly 24X times.This is also the first IPO to come up with the allotment status within a week. This being the new norm of the SEBI. Aug 26th would be when we should be able to get to know abt our allotments of the share for the compnay.
We can check the NHPC Allotment for our application online at karvy/.

More IPO shopping coming our way.

Keep investing....

Tuesday, July 28, 2009

MAHARA : Site not available , Could not generate a new SSL key

MAHARA - MOODLE Integration

In Some cases, when you are integrating MAHARA with Moodle , the OpenSSL certificate Key is not displayed.
We came across this problem many times in a windows installation.The reason was the OpenSSL within the Apache folder is not configured in the MAHARA and Moodle.

They are more of configured to work on Linux than Windows.

The solution for the same is , using the OPENSSL methods we can override the existing methods by directly pointing to the openssl certificate file (openssl.cnf)

In Mahara,

Edit the File / api/xmlrpc/Lib.php

$config is a array which holds the path of the Openssl.cnf in the your exisiting setup

$config = array("config" => "C:\Apache\openssl.cnf");

// ensure we remove trailing slashes
$dn["commonName"] = preg_replace(':/$:', '', $dn["commonName"]);

//if (!$new_key = openssl_pkey_new()) {
if (!$new_key = openssl_pkey_new($config)) {
throw new ConfigException('Could not generate a new SSL key. Are '
. 'you sure that both openssl and the PHP module for openssl are '
. 'installed on this machine?');

//if (!$csr_rsc = openssl_csr_new($dn, $new_key, array('private_key_bits',2048))) {
if (!$csr_rsc = openssl_csr_new($dn, $new_key, $config)) {
// This behaviour has been observed once before, on an ubuntu hardy box.
// The php5-openssl package was installed but somehow openssl
// wasn't.
throw new ConfigException('Could not generate a new SSL key. Are '
. 'you sure that both openssl and the PHP module for openssl are '
. 'installed on this machine?');
//$selfSignedCert = openssl_csr_sign($csr_rsc, null, $new_key, 365 /*days*/);
$selfSignedCert = openssl_csr_sign($csr_rsc, null, $new_key, 365 /*days*/,$config);

unset($csr_rsc); // Free up the resource

The Same applies to Moodle.

Edit the File : /mnet/lib.php

$config = array("config" => "c:/apache/conf/openssl.cnf");
//$new_key = openssl_pkey_new();
$new_key = openssl_pkey_new($config);
//$csr_rsc = openssl_csr_new($dn, $new_key, array('private_key_bits',2048));
//$selfSignedCert = openssl_csr_sign($csr_rsc, null, $new_key, $days);
$csr_rsc = openssl_csr_new($dn, $new_key, $config);
$selfSignedCert = openssl_csr_sign($csr_rsc, null, $new_key, $days,$config);
unset($csr_rsc); // Free up the resource

Wednesday, July 8, 2009

The Groups in the Indian Stock Markets(BSE / NSE)

The scrips traded on BSE have been classified into various groups.

BSE has, for the guidance and benefit of the investors, classified the scrips in the Equity Segment into 'A', ‘B’,'T', ‘S', ‘TS' and 'Z' groups on certain qualitative and quantitative parameters.

Group A
It is the most tracked class of scripts consisting of about 200 scripts. Market capitalization is one key factor in deciding which scrip should be classified in Group A.
At present there are 216 companies in the A group.

According to BSE circular dated February 5, 2008 the criterion to get listed in Group A is
1. Company must have been listed for minimum period of 3 months.
* The Company can be directly listed in group 'A' provided the market capitalisation of a company being listed, based on its issue price, is higher than the average market capitalisation of 100th company in the existing group 'A' as per the ranking based on preceding 3 months data.
* Any company permitted to be traded in F&O segment from date of its listing shall be directly listed in group 'A'.
* Companies listed subsequent to any corporate action involving merger/ demerger/ capital restructuring etc.

2. Companies traded for minimum 98% of the trading days in past 3 months shall be considered eligible.

3. Companies with minimum non-promoter holding of 10% as per the shareholding pattern of most recent quarter shall be considered eligible. The criteria of minimum 10% non-promoter holding shall not be applicable to public sector undertakings (PSUs).

4. The weightage of 75% and 25% shall be given to ranking on three monthly average market capitalisation and traded turnover respectively to arrive at the final ranks.

5. The list derived, based on final rank shall be screened for compliance and investigation. Based on this screening, the list of top 200 companies shall constitute group 'A'.

6. The group re-classification shall be reviewed twice in a year i.e. February and August.

7. On inclusion of any new Company in group 'A' based on criteria 1(a) or 1(b) detailed above, the last company in the existing group 'A', based on its final rank calculated on data preceding three months shall be excluded.

Group G
G includes all governmental securities for retail investors

Group F
The "F" Group represents the Fixed Income Securities.

Group T
The "T" Group represents scrips which are settled on a trade-to-trade basis as a surveillance measure.

Group TS
The "TS" Group consists of scrips in the "BSE-Indonext" segment, which are settled on a trade-to- trade basis as a surveillance measure.

Group S

“The Exchange has introduced a new segment named “BSE Indonext” w.e.f. January 7, 2005. The “S” Group represents scripts forming part of the “BSE-Indonext” segment. “S” group consists of scripts from “B1” & “B2” group on BSE and companies exclusively listed on regional stock exchanges having capital of 3 crores to 30 crores. All trades in this segment are done through BOLT system under S group.”

Group B1 & B2:
All companies not included in group ‘A’, ‘S’ or ‘Z’ are clubbed under this category. B1 is ranked higher than B2.

B1 and B2 groups will be merged as a single Group B effective from March 2008.

Group G
Trading in Government Securities by the retail investors is done under the "G" group.

Group Z
The 'Z' group was introduced by BSE in July 1999 and includes companies which have failed to comply with its listing requirements and/or have failed to resolve investor complaints and/or have not made the required arrangements with both the depositories, viz., Central Depository Services (I) Ltd. (CDSL) and National Securities Depository Ltd. (NSDL) for dematerialization of their securities.

BSE also provides a facility to the market participants for on-line trading of odd-lot securities in physical form in 'A', 'B', 'T', 'S', 'TS' and 'Z' groups and in rights renunciations in all groups of scrips in the Equity Segment.

F&O expands to the Futures and Options segment, which indicates the way the stock price would move in the future and the traders bets on it.

Also I heard somewhere that T Group is also a bad group. Stocks in this group are settled in parts/settlements. For example, if you buy XYZ company shares, 100 numbers and sell it in same day, also actually you cannot sell unless u have shares in your account already, you have to give delivery and take delivery of it separately, it cannot be squared off in same day.

Data from link

Thursday, June 25, 2009

Rename an Existing Column of a Table in MS SQL

In SQL server , Renaming a existing column without any data loss is possible .
A Inbuild System Stored Proc is available for the same

EXEC sp_rename `tableName.[existingColumnName]`, `newColumnName`, `COLUMN`

EXEC sp_rename `tblShortName.[longName]`, `shortName`, `COLUMN`

The above SP on execution will change the column longName in the tblShortName table to shortName

Note :

Take care you make the changes in all the stored proc and function where you are refering the old Column to the new Column

Tuesday, June 9, 2009

Convert Multiple Row results into a variable , comma seperated into a single Row result

I wanted to display a set of row results in a single Row or a single variable by comma seperated values in a SQL query.

DATA from a select statement is



Need result in the manner of

Desired Result


The can be done by

DECLARE @strText varchar(Max)
SELECT @strText = COALESCE(@strText + ',', '') + CONTACT_NAME FROM table
SELECT @strText

Monday, April 27, 2009

ASP.NET 2.0 : Cross Page Posting

Cross Page Posting in ASP.NET 2.0

By default, button controls in ASP.NET pages post back to the same page that contains
the button, where you can write an event handler for the post. In most cases this is the
desired behavior, but occasionaly you will also want to be able to post to another page in
your application. The Server.Transfer method can be used to move between pages, however
the URL doesn't change. Instead, the cross page posting feature in ASP.NET 2.0 allows
you to fire a normal post back to a different page in the application. In the target page,
you can then access the values of server controls in the source page that initiated the post
To use cross page posting, you can set the PostBackUrl property of a Button, LinkButton
or ImageButton control, which specifies the target page. In the target page, you can then
access the PreviousPage property to retrieve values from the source page. By default, the
PreviousPage property is of type Page, so you must access controls using the FindControl
method. You can also enable strongly-typed access to the source page by setting the
@PreviousPageType directive in the target page to the virtual path or Type name of the
source page.
Here is a step-by-step guide for implementing the cross-page post back using controls
that implement the IButtonControl interface.
√ Create a Web Form and insert a Button control on it using the VS .NET designer.
√ Set the button's PostBackUrl property to the Web Form you want to post back. For
instance in this case it is "nextpage.aspx"
PostBackUrl="~/nextpage.aspx" Text="Post to nextpage" />
When the PostBackUrl property of the IButtonControl is set, the ASP.NET framework
binds the corresponding HTML element to new JavaScript function named
WebForm_DoPostBackWithOptions. The corresponding HTML rendered by the ASP.NET
2.0 will look like this:
< input type="submit" name="Button1" value="Post to Page 2"
WebForm_PostBackOptions("Button1", ",false”,"Page2.aspx", false, false))"
id="Button1" / >

How do we access viewstate value of this page in the next page ?
View state is page specific; it contains information about controls embedded on the
particular page. ASP.NET 2.0 resolves this by embedding a hidden input field name,
__POSTBACK . This field is embedded only when there is an IButtonControl on the
page and its PostBackUrl property is set to a non-null value. This field contains the view
state information of the poster page. To access the view state of the poster page, you can
use the new PreviousPage property of the page:
Page poster = this.PreviousPage;
Then you can find any control from the previous page and read its state:
Label posterLabel = poster.findControl("myLabel");
string lbl = posterLabel.Text;
This cross-page post back feature also solves the problem of posting a Form to multiple
pages, because each control, in theory, can point to different post back URL.

Can we post and access view state in another application?

You can post back to any page and pages in another application, too. But if you are
posting pages to another application, the PreviousPage property will return null. This is a
significant restriction, as it means that if you want to use the view state, you are confined,
for example, posting to pages in the same virtual directory. Even so, this is a highly
acceptable addition to the functionality of ASP.NET.

Tuesday, April 21, 2009

Difference between Design Pattern & 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.

Tuesday, April 14, 2009

Postgres Windows install problem. Error 'User Doesnot Exists'

I Installed postgre using the windows installer and later on did a uninstall.
Later when i tried installing again, the installer never allowed me to install with the normal settings of User Postgre and superuser Postgre
It always gave me the error
'User Doesnot exists'.

or Unable to install, Security name Not mapped to the UserID

Windows machine :
Go to your Control Panel -> User Accounts ->Advanced -> Advanced USer Management Advanced USer Management -> Advanced

You would be seeing all the Local Users/Groups

you would find the intial username used while installing Postgre.

You can right click -> delete

or create a New User and make him a normal User group
and then use the same username while postgre install.

Tuesday, March 3, 2009

Run a .SQL file from PHP

Execute a .SQL file from PHP code

// executes the SQL commands from an external file.

$file = "sqlQueryfile.sql";
//Check if file exists
if (!file_exists($file))
die("Error : "The file $file does not exist.");

$str = file_get_contents($file);
if (!$str)
die("Error : Unable to read the contents of $file.");

$this->last_query = $str;

// split all the query's into an array
$sql = explode(';', $str);
foreach ($sql as $query)
if (!empty($query))
$r = mysql_query($query);
if (!$r)
die("Error : "mysql_error());


PHP Extract / Unzip a Zip file by code

I came across a task where i had to unzip a zip folder on a server to a new directory path in PHP

For the code to work we need the PCLZip library.The PclLib is a free open source.

You can download the library from the PCLZip site

Steps for UnZip of files

//make a directory
// $target is the directory where you want to unzip the files
//$zipfile is the zipped file which has to be unzipped
$path = $target;
$file = $zipfile;
// Use the library
$archive = new PclZip($file);
if (($v_result_list = $archive->extract(PCLZIP_OPT_PATH, $path)) == 0)
die("Error : ".$archive->errorInfo(true));


PCLZip also supports error detection

Built in error function are
errorName() : Returns a string containing the name of the error.
errorCode() : Returns the error code value.
errorInfo() : Returns a description associated with the error.

Using the Traceable Library we can also trace our errors.
You can download the trace library seperately.



$zip = new PclZip('');
$list = $zip->create("readme.txt");
if ($list == 0) {
die("Error : ".$zip->errorInfo(true));



Tuesday, February 24, 2009

Get Connected to LinkedIn for professional Networking

I am not a big virtual social networking person. But i have really started to get hooked up with linkediin(
This is a really useful networking site for getting your professional network together and also to get connected to other corporate networks.The information exchange is a huge advantage when it comes to your professional goals.

There is a lot of HR activites that is happening now on the netowrk, which really can help real professional for specific domains and a sort of verification on the resource.

so I would say ... go ahead and get connected in Linkedin.

It also supports groups and you may find a lot of your college or school groups.But again this is at a very professional level. no scarapping or sending messege.

Give it a Try !!!

a synopsis from there aboutus

What is LinkedIn?

LinkedIn is an interconnected network of experienced professionals from around the world, representing 170 industries and 200 countries. You can find, be introduced to, and collaborate with qualified professionals that you need to work with to accomplish your goals.

my profile ->