Wednesday, December 30, 2009

Maximizing Revenue - Web2.0 & Business Process Management

I had a great holidays and had great time with family & freinds. There were great deals in the internet for electronics, clothes, furniture etc., etc., Companies were desparate to unwind the winter stuffs like cashmere, heaters, christmas lights to refill the rackspace with the goods needed for Spring. It was so insane to see the products priced less than 60% of actual retail price and we browsed through few websites to pick some household products.

While browsing through the internet i started to think about Web 2.0, Business process, System Integration, System availability, Business Continuity, Customer Satisfaction, faster time to market, more and more!!!..

To a corporate person all these different terms means the single concept, "Maximize Revenue". I am planning to post a series of article on this business concept "Maximize Revenue" linking it to a IT process.

I talked about a web2.0 & business process management in one of my earlier blogs posted here.

Thursday, December 24, 2009

ORACLE Bulk Update from C#

In the traditional programming model, if there is a requirement to update bunch of data to database, the programmers typically will end up writing a loop in C# to establish connection and insert/update data for each record that needs to be updated. This is an expensive, inefficient operation and can cause database connection exception, memory leakage on the application servers.

The alternative way of handling bulk updates is through utilizing ORACLE custom packages & C# ORACLE ODP.NET provider. The idea is to group all the data necessary for updates into an Array, hand it over to ORACLE in a single connection from C# utilizing ODP.NET and let ORACLE loop through the bunch of data and update it accordingly.

ORACLE Custom Package

In oracle we can create a custom package of CHAR array or INT array.


CREATE OR REPLACE PACKAGE ARRAY_PACKAGE AS
TYPE REF_CUR IS REF CURSOR;
TYPE CHARARRAY IS TABLE OF VARCHAR2(50) INDEX BY BINARY_INTEGER;
TYPE INTARRAY IS TABLE OF INTEGER(38) INDEX BY BINARY_INTEGER;
TYPE DATEARRAY IS TABLE OF DATE INDEX BY BINARY_INTEGER;
END ARRAY_PACKAGE;
/


The package can be utilized as an input parameter for the stored proc as shown below.



CREATE OR REPLACE PROCEDURE BULK_UPDATE_DATA (
p_Input_Value_Emp_Id Array_Package.Chararray,
p_Input_Value_Emp_Salary Array_Package.Chararray,
)
IS
BEGIN
DECLARE
DECLARE
BEGIN
FOR i IN p_Input_Value_Emp_Id.FIRST .. p_Input_Value_Emp_Id.LAST
LOOP
UPDATE EMP_TABLE
SET EMP_SAL_COL= p_Input_Value_Emp_Salary(i)
WHERE EMP_ID_COL= p_Input_Value_Emp_Id(i);
END LOOP;
COMMIT;
END BULK_UPDATE_DATA;
END;
/



ODP.NET for calling the proc

Well, we have created the ORACLE package/procedure above and we need a mechanism to invoke the procedure from C#. The default Microsoft Oracle provider does not have the necessary interfaces to pass the array to a ORACLE procedure.

The ODP.NET interface provides a collection type called PLSQLAssociativeArray which enables the C# app to pass the Array of value to the ORACLE CHAR ARRAY package.

Through ODP.NET provider, we can set the data type & Collection type of the input paramter as below.
OracleParameter parm1 = new OracleParameter();
parm1.OracleDbType = OracleDbType.Varchar2;
parm1.CollectionType = OracleCollectionType.PLSQLAssociativeArray;

So in the above snippet, the input parameter parm1 is of type varchar (string) and the collection is associative array. In simple term, the parm1 is a string array.

Once the parameters are set to match the stored proc we have defined above (BULK_UPDATE_DATA), we just need to add the parameters to the connections command object and invoke the connection.


The complete C# program to invoke the oracle procedure "BULK_UPDATE_DATA" will look like the one given in the image below.


With the next .NET/VS upgrade (.NET4.0/2008) microsoft is getting away with the support for Microsoft's default ORACLE provider and will become deprecated (i have a posting on June that details about microsoft's oracle provider support. please click here to read more ) . So it is good practice to build the new applications that are interfacing with ORACLE using ODP.NET provider.

Friday, December 11, 2009

Music in CLOUD - Apple's strategic move

There is no question about the revolution created by Apple in the Music industry. Until now the users of iPod or desktop has to download the iTunes software on their devices(ipod, iphone & desktops) to get the music from Apple iTunes.

With the recent purchase of LALA media, an online music provider, there will be a big shift in the way the Apple delivers content. That's correct, Music from CLOUD.

May be the entire technology industry is witnessing a move towards WEB3.0 - CLOUD services.

Thursday, November 26, 2009

Cloud Computing

I have been researching about Cloud computing for one of the projects i am working on rite now. It was amazing to see the services offered through cloud computing.

In the traditional application development model, if there is a need to develop and host a internet facing applications, we need to do the capacity, infrastructure, security planning and purchase hardwares (windows, unix, websphere servers) and softwares. The process of setting up the infrastructure takes few weeks to couple months since it has to go through neccessary approvals and budgetary constraints of the organization. Lets say we crossed the first bottleneck of acquiring hardwares/softwares, the next hurdle is having the infrastructure laid down by the network group and setting up the secure environment with the Militarized zones for security purpose. Also a point to note is, if the application is mission critical and have heavy volume online transactions the capacity planning will also include the details for load balancing of the servers and the infrastructure design and environemnt set up has to account for the installation of load balancers.

Also cost wise in the traditional model, its very expensive to maintain and manage the infrastructure. The project will incur an annual maintanance cost for the servers, licenses and support to install patches and upgrades.

I think i am throwing things that is pretty normal in IT organizations. Well, the cloud computing provides a relief to all these hurdles.

The cloud computing provides the infrastructure and technology facilities over the internet. So the project team doesn't need to worry about establishing the infrastructure. The technology infrastructure is abstracted from the application development. We just need to know the type of infrastructure required for the application (For eg: windows 2008 , unix with ORACLE 10g etc.,). Once the type of technology infrasture has been determined, we can install/set up the hardwares/softwares through couple of mouse clicks and the instances will be ready to use. The infrastructure set up takes around 10-20mins and you are all set to begin development/deployment.

The cloud computing alleviates the effort/cost required to set up the infrastructure and also saves the maintanance cost. One more good thing about cloud computing is the cloud service providers automatically patche the instance/server and its free of cost.

One more point to note in cloud is, if for any reason the application requires additional servers/processing power, adding few more instance to the existing instance is pretty easy. For ex; lets say if the application requires few additioanl processing power from 8AM-5PM and can run with the normal processing power during the rest of the day, the cloud computing provides elastic facility to expand/contract the computing capacity of the server.

From cost perspective, we pay for what we use in terms of computing facility.

I was playing around with Amazon Elastic cloud and was suprised to see that within few mouse clicks i was able to mount the Unix with the ORACLE 10g database instance.

There are several providers in the cloud space but i just looked at services provided by Amazon and its extra-ordinary.

Monday, November 23, 2009

Web 2.0 & Business Process Management

Web2.0 has revolutionized the internet world and offered a seamless transition from paper forms/document to online web pages. The industries across the globe invests in IT projects to cut costs on postal and paper charges by offering the solutions online through the websites.

The telecom industry has eliminated the paper submission of application forms for new telephone/wireless connection to online submission and paper bills to electronic bills. The form submitted online is integrated with the Ordering system whereby the orders are keyed in for a customer. The created order flows through the provisioning system where the order is assigned to a network technician for physically establishing the connection to the home. Once the technician completes the order, the call charges are calculated in the Rating system and supplied to a billing system where the bills are generated and posted online for customers review and payments.

The financial services [banking] industries has integrated online submission of mortgage forms with the business process of credit approval. When the customer submit the mortgage form online, the process flow through validating credit history & residential address. Upon credit approval, the business process is coupled with the quote generation for customers review. Once the customer approves the quote online, the customer will be recieve the credit and the bills for mortgage payments are generated online for customers review and payment.

The other major financial services industry is insurance and the business process is tightly integrated with the technology. The insurance companies are promoting the sales online by selling the products through websites. When the customer requests for quote for a policy, the customers primary medical details are collected online. The medical history is verfied with medical information board and the underwriting engine generates the quotes for underwriters review based on mortality/medical history. The quotes are released by underwriters for online review of customers/policy owners. When the customer agrees for the insurance quote, the quote is converted to a policy and the policy is available online for the customers.

We can speak a lot about Web 2.0 and integration of business process management. But the ultimate benefit to the businesses are:

> Reduction in expenses incurred for paper mail
> Quickers sales
> Faster realization of cash/payments from the customers
> Reduction in manual intervention in the business process & hence decreased errors.
> Effective collection of data for generating potential leads
> Environmental friendly business

Monday, November 16, 2009

CNBC - Interview with Gates & Buffett

Last night CNBC telecasted a live show from Columbia business school. Mr.Buffett and Me.Gates answered questions from the B-School students on various aspects from past crisis (am optimistic "crisis has gone"), learnings, future opportunities, investments etc.,

I admire Mr.Buffett's strong statement about investments on education. He said he will be ready to invest $100K to his employee to go to business school as they will be worth $1M after completion of business studies. He also added that he will invest another $50K for improving communication skills and their net worth will be $1.5M.

A question was asked about Mr.Gates view on "Apple". Mr.Gates responded by applauding Steve jobs for his entreprenurial skills in bringing the Apple back on track once he rejoined the Apple when the companies sales & profits were declining.
Mr.Gates also indicated that Steve jobs brought the competition in the Software/Hardware market by introducing Mac's & iPods.

My take on the entire interview was
Success doesn't come free. You need an investment to become successful. Investment in education, investment of time, investment in research & development always fetches good results regardless of world & economic conditions. For ex; An investment banker will only be successful, only if they invest their time to research the market position, conditions, portfolios before investing in the stocks.
Mr.Buffett indicated that he studied the Moody's 1000 pages rating book twice before doing his first investment.

Thursday, November 12, 2009

GridGain for Elastic Computing

I attended a seminar on GridGaid for interfacing with Amazon Cloud. It was cool. The tool interfaces with the Cloud and performs,
Auto Scaling - Scale up/down based on the computing load
Data Grid - Split the storage across node

But it doesn't come free of cost. The enterprise edition of GridGain has these great feature and its pay per usage (On top of what we pay for Amazon). I asked the question about how to justify the pricing for the usage of GridGain on top of Cloud cost. The presenter explained that the open source version has lot more features like automatic on/off cloud, compute on the cloud etc., But the enterprise edition has more features which will be required by large organization that requires faster computing and data load power.

Tuesday, November 10, 2009

ORACLE Analytics functions

In one of the projects i have worked on recently, we had a requirement to group the user information based on the latest updated user and display the results. The usage of native SQL like ORDER BY & GROUP BY was cumbersome and leads to a poor query performance.
Upon research we discovered that the ORACLE Analytic functions can do whatever the native SQL function does with a better performance.

The requirement was to filter the unique user id, user number from the user profile table with the latest user entry and the result should be group by User Number. For Ex; the query should return the Mohan4 & Mohan 3.

UserIdUser_NumberLatest_EntryOptions
Mohan11Nov-06-2009Y
Mohan21Nov-07-2009N
Mohan32Nov-09-2009Y
Mohan41Nov-10-2009N


The result can be obtained by GROUP BY Clause, but the problem is we can only retrieve GROUP BY Columns. The non-group by columns will not be retrieved in the GROUP BY clause.

We utilized the ORACLE Analytics functions to overcome these difficulties with performance, Group by issue etc, So our query looked like,

(SELECT USER_NUMBER, USER_ID, LATEST_ENTRY, OPTIONS
FROM
(SELECT USRINF.*, ROW_NUMBER() OVER (PARTITION BY USER_NUMBER ORDER BY LATEST_ENTRY DESC) RANK
From DB_SCHEMA.USERINFO USRINF WHERE LATEST_ENTRY IS NOT NULL
ORDER BY LATEST_ENTRY DESC
)
WHERE
1=1
AND RANK=1
);

In the above query, the clause “PARTITION BY” groups the results based on the column name indicated next to it. In this case, it is acted on the column USER_NUMBER. The subquery in the above query
SELECT USRINF.*, ROW_NUMBER() OVER (PARTITION BY USER_NUMBER ORDER BY LATEST_ENTRY DESC) RANK
From DB_SCHEMA.USERINFO USRINF WHERE LATEST_ENTRY IS NOT NULL
ORDER BY LATEST_ENTRY DESC

Will display the result as


UserIdUser_NumberLatest_EntryOptionsROW_NUMBER()
Mohan11Nov-06-2009Y3
Mohan21Nov-07-2009N3
Mohan32Nov-09-2009Y1
Mohan41Nov-10-2009N3


The outer query filters the unique first record from the result set described above ordered by descending of the Latest_Entry column. So the result set of the final query will be


UserIdUser_NumberLatest_EntryOptionsROW_NUMBER()
Mohan32Nov-09-2009Y1
Mohan41Nov-10-2009N3

Monday, September 21, 2009

ORACLE 10g - Merge Into statement

In the traditional programming world, when we try to perform a function of update, we will check if the matching record exists in the system. If so, we would update the record. If the matching record does not available in the system, we would insert the row.

ORACLE's merge statment performs the update/insert through a single statment. Through the merge statement, the validation or check can be made before update/insert. For eg: The following merge statement will update the table EASTable when the userid matches with the input. If the user id is not present in the table, the input user information will be inserted.

MERGE INTO EASTable EAS
USING DUAL
ON ( EAS.USER_ID = USER_ID_INPUT)
WHEN MATCHED THEN
UPDATE SET EAS.IND1 = IND1_INPUT
EAS.IND2 = IND2_INPUT

WHEN NOT MATCHED THEN
INSERT
(EAS.USER_ID, EAS.IND1,EAS.IND2)
VALUES (USER_ID_INPUT,IND1_INPUT,IND2_INPUT);
COMMIT;

Monday, June 22, 2009

Enhance ASPX Page load performance

This morning i was reading a posting on the internet about, improving the ASPX page performance. The blogger recommends the usage of CSS Class in the HTML instead of inline HTML. Inline styles on the HTML's increases the HTTP response size and hence increases the page load time. Click here to read the post

To improve the page load time, we could consider the following options as well.
Compressing the JavaScript
Compressing the CSS

But the issue with the compression technique is the overhead in debugging.

Friday, June 19, 2009

System.data.oracleclient - Deprecated in .NET 4.0

The ADO.NET team had posted an article about the System.Data.OracleClient component. This component is available in .NET 4.0 but it is deprecated. So the existing and new applications will still compile with warnings for the first time.

It has been recommended to make use of microsoft's parter component to substitute the System.Data.OracleClient.

One of the options to consider is using "ORACLE ODP.NET". This component has some issues with respect to performance, errors etc.,

Friday, June 12, 2009

Jquery Part 4 - AJAX method call through JQuery

The JQuery tool provides a very good, easy to use AJAX interface. I came across a scenario where this could be applied very well. Assume we have a web service that returns the XML data and we need to display the XML output in the web page when the user clicks a button without refresh. We make AJAX calls through JQuery to the server to invoke the web service as given below.



On the button click we need to load the web service data without a post back.

To do that we need to include the JQuery tool kit scripts in the project folder and set the reference to the scripts.

The above code has many components associated with it. $document.ready will determine whether the HTML is loaded completely and rendered. The next function $('#btn1').click will bind the click event to the function following that. So the scripts within the click function will execute when the user clicks the button btn1.

The next line indicates that we are making an ajax call to the web service url "
jqueryAjax.aspx/GetWebServiceResult". The type parameter indicates the request type GET/POST. The data parameter can be used to pass the input parameter to the server side method. In this example the server side method is GetWebServiceResult. So the method declaration will have a tag [WebMethod] on the method's declaration. This method expects an input parameter of type int and it will pass the parameter recieved from client into the web service. From the client side we will pass the value to this method through data parameter in JQuery.

The contentType and dataType parameter will indicate the type of data transferred between client and server.

When the button is clicked, the client side code will execute and invokes the server side method and pass the input parameter to fetch the result. The server side method in turn will invoke the web service and the result is passed in the object "msg". If the AJAX call is successful, the Success function is invoked. If the AJAX call is failed, the failure function will be invoked.

The BuildHTML method will parse the web service results and display in the HTML.

So it is EASY :), No More UpdatePanel, ScriptManager!!!

Monday, June 1, 2009

WCF and RESTFul Service

I was attending few webminars and read materials over the past few weeks on the WCF fundamentals. One of the great feature with WCF is its ability to expose the services in RESTful format.

Saturday, May 30, 2009

SQL Server 2008 Training in Texas

The schedule for the SQL server 2008 training @ TCU Texas,

The registration can be made thrugh TCU's site. Click here to register

SQL Class Date:

June 20th from 9 am to 4 pm

June 21st from 1 pm to 5 pm

June 27th from 9 am to 4 pm

June 28th from 1 pm to 5 pm

Thursday, May 7, 2009

PLINQO - Plano,TX Training updates

Yesterday i attended a .NET user group training in Plano, TX about the PLINQO demonstration. PLINQO stands for Professional LINQ to Objects.

The presenters did a great job of demonstrating the PLINQO libraries and its benefit over microsoftjavascript:void(0)'s LINQ.

The greates feature i liked about this component is its ability to dynamically sync up with the database object and Batch Querying.

To learn more about PLINQO please visit the website PLINQO

Wednesday, May 6, 2009

ORACLE Fusion Dev platform

Oracle is hosting an event to demonstrate about their new product ORACLE FUSION Development Platform - ORACLE ADF 11g. This appears to be a full day event with demo, Q&A session. Click here to register and download material

Tuesday, May 5, 2009

JQuery - Part 3 Dynamic object loading

This post is about loading a control dynamically through Jquery scripts.

The powerful feature of Jquery selectors combined with CSS scripts enables the client side loading of controls with less coding/effort.

I recently incorporated this featur in one of the projects where we had a requirement to dynamically change the image at run time based on the result set from the database query. I would not want to write server side code to determine the image, Instead i started to research about loading the image through Jquery selectors.

The project required to load the image at one of the table column < td >.

I declared a placeholder client side div with a id "loadImage".
"< td >
< div id="loadImage" >
< %# DataBinder.Eval(Container.DataItem, "Flag").ToString().Trim()% >
< /div >
< /td >"

On the document ready event i wrote the Jquery funtion which will locate the position of the DIV and load the image on the particular DIV as below.

$(document).ready(function() {

$('#tbl_temp tr').each(function() {

var valueee = $(this).find('div');
var txt = jQuery.trim(valueee.text());

var imgSrc = "";
if (txt == 'G') {
imgSrc = 'images/green_icon.gif'
}

else if (txt == 'O') {
imgSrc = 'images/gray_icon.gif'
}
else {
}

if (imgSrc.length > 0) {
var img = new Image()
$(img) // once the image has loaded, execute this code

.load(function() {
//debugger;
$(this).hide();

valueee
.empty()
//.text = '';
// remove the loading class (so no background spinner),
// then insert our image
.append(this);
//debugger;
// fade our image in to create a nice effect
$(this).fadeIn();
}) // if there was an error loading the image, react accordingly
.error(function() {
// notify the user that the image could not be loaded
})
// set the src attribute of the new image to our image
.attr('src', imgSrc)
.css({ 'border': 'none' });
}
})
});

Saturday, April 18, 2009

REST Services

REST - Respresentation State Transfer is recently been given much importance in the industry. REST is neither a programming language nor a tool. It is an architecture to build the network system.

Microsofts ADO.NET Data Service is build on the REST framework. There are some good webcasts and article about the ADO.NET data service in Microsoft website and its worth watching.

Sunday, April 5, 2009

Jquery part 2 – Selectors

Jquery API provides an interface called “Selectors” which is a powerful component to filter the HTML elements based on the element name, id and element type.

The DOM elements can be selected with the Jquery function “$” or “jquery”. For example, the hyperlinks in the HTML pages can be retrieved using the selector $(a).

Following are the few examples of sample selectors that are very useful for DOM manipulation.

a – Retrieves all anchor links with the tag < a >.

#DOMElementID – Retrieves the DOM element with the id “DOMID”.

.DOMElementClass – Retrieves the DOM elements with the class “DOMClass”.

P a.DOMElementClass – Retrieves the DOM element links with the class “DOMClass” embedded within the tag < p >.

Ul > Li > a – Retrieves links which are children of list element
  • which are in turn children of < ul >.

    A[href^=http://] – Retrieves links with an href value beginning with http://.

    Div[type=text] – retrieves html text box.

    P:odd – retrieves every odd paragraph elements.

    Li:last-child – retrieves last child < li > of each < ul > element.

    :radio:checked – retrieves radio buttons in the DOM that are checked.

    :checkbox:checked – retrieves checkboxes in the Dom that are checked.

    Input:not(:checkbox) – retrieves input elements from the DOM except checkboxes.
  • Wednesday, March 18, 2009

    JQuery - Part 1

    JQuery Fundamentals

    Typically, the JavaScript was considered to be a clumpsy and difficult language to be used in the application development. The applications were designed to make use of javascript to support the validations, styles but the effort required to fix the browser compatibility superseded the benefit of client side scripting. Before the discovery of CSS the applications were developed by coupling the functionality and structure (HTML) together.

    < type="button" id="”btnClick”" onclick="document.getElementById('txtName’).style.color='blue';">
    Please click here
    < / button>

    The addition of CSS in the web development world allows us to separate the structure from the stylistic details of the HTML. It also gives us the flexibility to completely change the style by changing the different style sheet.

    < type="text/javascript">
    window.onload = function() {
    document.getElementById(' btnClick ').onclick = ChangeColor;
    };

    Function ChangeColor ()
    {
    document.getElementByID(‘txtName’).style.color = “Blue”
    }
    < / script>
    < type="button">
    Please click here

    In the above example, the structure is separated from functionality. This approach of separating the structure from functionality through javascript is called “Unobtrusive Javascript”

    The JQuery drew a huge attention amongst developer for its ability to support the development of unobtrusive JavaScript’s. JQuery works very well with the HTML page and performing operations on the DOM elements with significantly less lines of code. The scripts developed in JQuery model works well in all major browsers.

    JQuery has great features like
    DOM Selectors
    DOM manipulation
    Animation
    HTML traversing

    Sunday, January 11, 2009

    Great Quotes from the book "The one minute entrepreneur"

    I had an opportunity to read the book "The one minute entrepreneur" free of cost :) in the book store. The book touches the greatest suggestion from various speakers from motivation gurus to sales gurus, management geniouses to traning gurus. One thing i picked after reading that book was writing down on the book about what we learned on that day.
    The authors suggests that "To be a succesful entrepreneur one should cultivate an attitude of writing down the learnings in one word in one minute.". I hope this book is a great guide for everyone dreaming to be an entrepreneur.

    Friday, January 2, 2009

    Cross Browser Compatibility

    A recent report in the internet indicated the decline in number of Microsoft internet explorer user’s base. The percentage of IE users declined to 68% from 74% in the 6 months time period. Meanwhile Mozilla’s firefox saw an increase in usage to 24% from 17%.

    The decline in IE usage is attributed to several factors including the increase in the sales of Apple MAC using Safari, increase usage of Googles Chrome and open source Mozilla’s FireFox.

    The application developments should be more focused to support Cross-browsers.