my 1st failure as Entrepreneur

Me and my friend Eswar always discuss about ideas whenever we meet. we both are passionate to start some venture . we had an idea to make drinks online, we thought of making a drinks store online every 5 kms in Bangalore city and then spread to other cities. techies, software companies can buy drinks online to party at their home or at office.

we did coding for ecommerce site with sample data of drinks . we are new to web programming stuff. as we are already know core python programming, we learnt Django stuff and we built up ecommerce site on Django,Jquery,Html,CSS3 . we bought domain name called Drinkybee.com and we hosted it even though we dont have any customers . we hosted for beta testing and for showing demo to our customers who wants to host their store in our drinkybee.

we are new to marketing and learnt how to market our site. many store vendors rejected us as they dont know how much online business can do . but we got 2 customers who has 6 stores. we thought of going online and came to know the risk that liquor drinks cant be delievered to home and its Illegal according to karnataka excise dept. Our customers has called us saying lets stop going online as it has legal problems.

Before Setting up business check the legal front of it and then invest on it. By gones are bygones, we do have ecommerce site now and we can sell atleast that now. but our dream to launch drinkybee site didnt fade away . may be we have to approach other city like Mumbai or hyderabad.

our vision is just make drinkybee as synonym to drinker and at same time being responsible to society by reducing drink and drive .


permuations of list of lists for ecommerce attributes

Q)  In a ecommerce product a product can have many attributes like size,color,gender. and again each attribute can have multiple values like size ['s,'m','L','XL','XXL'].
and color as ['red,'blue','brown'] and gender as ['M','F'].

A ecommerce product want to display all possible combinations of attributes. each attribute has multiple values and attribute list vary in length. ex: if color ['red,'blue','green','brown'] and gender as ['M','F']
then possible combos are [red,M],[red,F],[blue,M],[blue,F],[green,M], [green,F], [brown,M] , [brown,F]

Solution1: Just a recursive algo, which takes list as argument. for each element in list , get the permutations of remaining lists.

l = [['red', 'brown', 'black'], ['S','M','L', 'XL'], ['M','F']]
def permu(lists, prefix=''):
    if not lists:
        print prefix
        return
    first = lists[0]
    rest = lists[1:]
    for letter in first:
        permu(rest, prefix + letter +",")


permu(l)

Solution:2 make a m way tree. like root having children for 1st set of attributes. and for each node of attribute has next set of attributes as children.

            [root]
[red] [blue] [green] [brown]

[M] [F]

. Then doing a dfs till node and print the path to leaf will give different combinations of product.

In Python:
class Node(object):
    def __init__(self):
        self.data=''
        self.children=[]
                
class mway(object):
    def __init__(self):
        self.root=None
    def insert(self,list_string):
        if self.root is None:
            root=Node()
            root.data=''
            root.children=[]
            self.root=root            
        
        node=self.root
        list_nodes=[]    
        for i in list_string:
            node=Node()
            node.data=i
            node.children=[]
            list_nodes.append(node)
        #stack for insertion
        li_bt=[self.root]
        while len(li_bt) > 0:
            node=li_bt.pop()
            #print "popping %s"%(node.data)
            if len(node.children) == 0:
                for n in list_nodes:
                    node.children.append(n)
                    #print "appending %s to %s"%(n.data,node.data)
            else:
                for chi in node.children:
                    if chi not in list_nodes:
                        li_bt.append(chi)
                    
    def printcomb(self,node,string=""): #dfs to leaf and print path
        if len(node.children) == 0:
            print string
        for i in node.children:          
            self.printcomb(i,string+ i.data + ",")
            
    def getroot(self):

        return self.root
        
print "enter number of attributes"
li_all=[]
attr=int(raw_input())
while attr > 0:
    print "enter attributes seperated by ,"
    list_attr=str(raw_input()).split(",")
    li_all.append(list_attr)
    attr=attr-1
    
mtree=mway()
for iattr in li_all:
    mtree.insert(iattr)
    
node=mtree.getroot()
mtree.printcomb(node)