Monthly Archives: January 2013

WHY SHOULD I KNOW ABOUT FACTORS AND PRIME NUMBERS?

I have borrowed material used in the blog from from internet (it is not my original creation). But added annotations to make kids understand.

 

My task was to teach kids about rational numbers. And then how to divide and multiply rational numbers?

I started off with an example like this. This lead to the concepts of factors and primes. I am pretty sure there are many applications of prime numbers. This is one simple example where kids can apply their knowledge about prime numbers to reduce fractions using prime factorization.

 

mult-division of real numbers

 

FACTORS

Factors are numbers you can multiply together to get another number.

image

Starting from factor concept, introduce the concept of prime numbers:

 

prime number

 

A number (except 1) with only two factors is called a PRIME number. Others are called composite numbers.

 

 

PRIME FACTORIZATION

 

So our original number 36 has many factors (see above), but only 2 and 3 are prime factors. Can we write 36 in terms of just its prime factors? Consider one factorization of 36:

 

image

Once you have your prime factorization, division becomes lot simpler.

 

How to Reduce Fractions Using Prime Factorization

The beauty of using the prime factorization method is that you can be sure that the fraction’s reduction possibilities are exhausted — that is, you can be certain that you haven’t missed any factors that the numerator and denominator may have in common.

ENTITY FRAMEWORK – ORACLE CONNECTION STRING

I see many hits to my post related to Entity Framework and Oracle related articles. I thought I will share some information which I figured out after fighting for sometime.

Depending on how you manage your TNS names, your connection string in web.config and app.config may not work sometime. The best way to mitigate that risk to have your connection string as follows. I am assuming that you have downloaded the EF provider from Oracle’s web site and installed it.

<add name=”MyEntities” connectionString=”metadata=res://*/OracleModel.csdl|res://*/OracleModel.ssdl|res://*/OracleModel.msl;provider=Oracle.DataAccess.Client;provider connection string=&quot;DATA SOURCE= (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = MY-SERVERNAME-OR-IP)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = PRODUCTION) ) );PASSWORD=MySecret*1;PERSIST SECURITY INFO=True;USER ID=JAMES.BOND&quot;” providerName=”System.Data.EntityClient” />

 

Oracle provider assemblies are added to GAC. So, it is important to install this on every machine from where you want to access Oracle database using Entity Framework.

Tagged , ,

APPLICATION SECURITY

Quite long ago, Microsoft came up with the concept of Membership Provider design pattern. I have used it (just like thousands of other applications) over and over to provide application security. It works great.

I was waiting for Microsoft to improve upon what they had done years ago. But, to my surprise their recent concepts around application security design have fallen short of expectations (no offence meant).

I have decent experience in designing/choosing application security related approaches. I have decided to share my design approach with the community. All the source code and database design in provided. It is available at http://applicationsecurity.codeplex.com/.

Over last many years, I have benefitted from the information people have shared on internet. This is an effort to give little back. All the advertisement money from this project will go to Habitat for Humanity Int’l.

 

In most scenarios, application security can be accomplished using ‘role based’ approach. Microsoft’s membership provider model (I am not going describe this here. There is plenty of material online about membership provider) was good in this respect. Many applications are successfully built using this provider. Recent releases of Microsoft’s .NET releases have taken slightly different approach w.r.t what this built in provider offers (see the links below). From my experience with building many applications, I feel that what is offered in .NET 40/4.5 is not enough.

This project is created to abstract the security requirements for all kinds of applications. In addition to roles, claims are also introduced (without the complexity surrounding it). Effort is made to support multi-tenancy also.

 USEFUL LINKS AND BACKGROUND

SimpleMembership, Membership Providers, Universal Providers and the new ASP.NET 4.5 Web Forms and ASP.NET MVC 4 templates

Think twice about using MembershipProvider (and SimpleMembership)

 

main-document

 

Data Model

This is the early draft of our data model. As you can see, I am using Microsoft’s Entity Framework. Important thing to notice is the fact that, our new design bridges the best of both worlds. Membership provider pattern is a very useful pattern that has worked for many years for many applications. Instead of using all the tables that come with ASPNETDB, I have created a table called CustomMembership. This will be used to provide the same provider interface that is being used by many web applications. Things take better turn with the availability of a more powerful variation of IPrincipal concrete implementation. Now, you will have access to features such as enterprise, claims etc.

Data Model

 

Solution is built using the following technology and tools:

1. Microsoft .NET 4.0/4.5

2. Microsoft Entity Framework 5.0

3. Microsoft Visual Studio 2012

4. Microsoft ASP.NET MVC 4.0 for management application UI

5. Microsoft ASP.NET MVC 4.0 WebAPI to support REST interface

6. SQL Server 2012 (Express and above)

7. SQL Server Database tools (SSDT) to manage the database objects in VS 2012/TFS 2012

8. Kendo UI Controls (This is not an advertisement for Telerik. I chose it because, I can quickly build what I need. Personally I am a big fan of Telerik controls. The main focus of this project is a good application security design, not this UI).

EDI: FLOW OF PURCHASE ORDER (850)

 

Flow of EDI transactions during a purchase order explained with a nice diagram.

Flow of Purchase Order

In many organizations, lot of effort takes place to handle the inbound EDI transactions. Mapping of EDI document fields to your application specific needs being one of most important activities. Not everyone in your organization will be well versed with a given EDI specification to map these accurately.

Our solution provides ZERO MAPPING capability. Why do you want to waste your time in understanding and mapping EDI? Instead focus on your business process. That is where the business value lies. Our solution enables this.

EDI PROCESSING: HAS EVOLUTION STOPPED ?

I have seen great evolution in programming languages and productivity in last 10 years. I started with assembly language. I cannot imagine writing present day complex applications using such languages. However, when it comes to EDI processing, we still do the complex mapping and talk segments and elements. There must be a better way to handle/process EDI documents.

WE WANT TO CHANGE THE WAY WE PROCESS EDI DOCUEMNTS. WE WANT TO BE THE CATALYSTS FOR THIS CHANGE!

MAPPING – WHY WHY WHY?

The following picture summarizes everything I want to say in this post.

mapping-complexity

(Image taken from the book:BizTalk 2010 EDI for Health Care)

I still remember my shift from C/Assembly language to C++. I was very excited with all the good and powerful things OOP/OOD brought to the table. It helped to model complex software better and increasing the productivity by multiple folds.

evolution of programming languages

I have been working with EDI documents for quite sometime now. Most of the EDI processing solutions still talk in terms segments, loops, separators etc.. IMO, there is a big scope for taking this concept to the next level (just like we moved from ASSEMBLY->C++). Once this happens, productivity will shoot up.

language-evolution

Our new solution will attempt to bring the same level of power and productivity as that of  OOP brought to the software world. When an application developer working on a EDI, for example purchase order (850), he/she should not in terms of segments/loops, instead talk about business terms such as Product.Color (this product’s color), Product.Weight (weight of the product) etc. This brings more meaning to the business process (and that’s how it SHOULD be).

We are looking for all sorts of channels to market this idea/product. If you think you can make a difference, let me know and contact me at shanthu@palisha.com

BTW, in addition to bringing new way of looking at EDI documents, our EDI processing platform is designed for scale (bring it on!), fault tolerance, friendly operations.

Tagged ,