Husband’s mother, wife’s father…

This is a relationship conundrum which I think most of the married folks out there can relate with. When I got engaged with my wife and I looked around and saw my friends’ behaviors as well, I realized that regardless of the situation at the home, in the relationship between a husband and wife, the husband’s mother and the wife’s father is the dominant personality. Whether the person’s personality is strong / dominant or not in reality, but the perception in a marriage is always the same. I always used to think, why is it always like this only.

I have been thinking about this for the past 15-16 years and suddenly I had a sort of epiphany and things suddenly got very clear. No matter how much a person loves his or her sweetheart, this conflict or situation if not a conflict will always arise in the relationship. According to me, there’s a simple reason for this. For every boy, his mother is his role model for a woman and for every girl, her father is her role model for a man. Subconsciously we are all comparing whoever we interact with, with our role models. For every action a partner in a relationship takes, it is instantaneously and perhaps sub-consciously compared with the person’s role model. “How my mother would have done this?” or “How my father used to do this?” While this is unfair for the person being compared, the stark reality of the situation is that it exists and there is no running away from it.

Do I know how to resolve the situation? Absolutely not. I do not claim to have an answer to this conundrum. My aim was to merely share the epiphany that I had and hope that it helps someone. We cannot hope to change the subconscious mind of a person, but the best that we can do is probably understand the person’s perspective a little bit and in that process make the relationship more enjoyable and fulfilling.

।।तथास्तु।।

Rock, Paper, Scissors… in Python

For a long, long time, I have been an enthusiast of Python programming language. I am embarrassed to say that I have been trying to learn it fully for the past 10 or so years. In this much time with proper focus and dedication, I would have been a guru. But here I am, still a novice. But that’s beside the point.

Now that summer vacation is here, I have decided to teach my kids Python programming as much as I know. I want to show them the path and take them with me as far as I can go and then I hope they will go further from there. While Some time ago (maybe a couple of years ago) I had given myself a challenge to create a program that I had no source or coaching. So I had decided to create a game in Python. I chose the simple game of Rock, Paper, Scissors.  Over time, I changed computers and somehow I lost the source code of the program.

When my daughter started learning, she reminded me of the program and wanted to play the game. So I got started to write the program again. I’m happy to report that I have successfully re-written program. I’m sure there is a lot of scope of improvement in the coding style, code, and overall structure. But I am just starting and hope to improve. I’m posting the source code of my program and I will welcome all constructive criticism of the code and suggestions for improvement.

# An all-time favorite game of Rock Paper Scissors.
# An all-time favorite game of Rock Paper Scissors.
# Programmer: Mukul Dharwadkar
# Date: June 27 2017

import random

def instructions():
"""Displays the game instructions"""
print \ """ Today we will play the perennial favorite game of... Rock! Paper!! Scissors!!!.
The objective of the game is to outthink your opponent (in this case me) and defeat.
The rules are very simple
1.Paper covers the Rock
2.Rock breaks the Scissors
3.Scissors cut the Paper
Choose your move from the following:
1. Paper (p)
2. Rock (r)
3. Scissors (s)
Are you ready? Alright then, let's play... """

def get_name():
"""Get player's name"""
print \
"""First of all, let's get to know each other a little better.
My name is Compy...
What's yours?
"""
player_name = raw_input("What is your name: ")
return player_name

def greet_player(name):
"""Let's be polite and greet each other properly"""
print "How are are you doing %s?" % name

def legal_moves():
"""Define the legal moves"""
legal_moves = ("r", "p", "s")
return legal_moves

def player_move():
"""Players choose their move"""
move = None
while move not in moves:
move = raw_input("What is your move %s? --> " % name)
return move

def computer_move():
"""The computer will choose its move in this function"""
move = random.choice(moves)
print "Computer's move is %s" % move
return move

def compare_moves(p_move, c_move):
"""We will now compare the moves the human and computer make and then take the output to declare the winner"""
#This is a very crude way of writing this comparison code. Is there a better way to do this?
#TODO: Find out optimized way of writing this block of code.
if p_move == "r" and c_move == "p":
return "computer"
elif p_move == "r" and c_move == "s":
return "human"
elif p_move == "p" and c_move == "s":
return "computer"
elif p_move == "p" and c_move == "r":
return "human"
elif p_move == "s" and c_move == "r":
return "computer"
elif p_move == "s" and c_move == "p":
return "human"

def declare_winner(winner):

if winner == "human":
print "%s wins. Congratulations and well played!!!" % name
elif winner == "computer":
print "Computer wins. Better luck next time %s." % name
else: print "It's a tie"

#main body of the program
instructions()
name = get_name()
moves = legal_moves()
greet_player(name)
p_move = player_move()
c_move = computer_move()
winner = compare_moves(p_move, c_move)
declare_winner(winner)

Note: The indentation of the code is lost.
To do: Create a GUI interface for the program if I can.

Running WordPress site in distinct containers

I have been running my site on Plone for a long time, but the maintenance required was too high and I ran into several issues with bloated data file, unsupported plugins to name a few. Plus the instance was not very portable in case my server died or I had to move.

Then I was thinking about creating my own content management system, but time was a factor and the I thought I was losing my focus. What do I really want to do? Publish my thoughts, or develop something new. Actually it is both, but I don’t want it to become dependent on each other. So I decided to use prebuilt software. I very quickly evaluated Drupal, WordPress, Movable Type and decided that WordPress looks to be the best at this time. More on the evaluation later.

Second challenge was to make it completely portable by using containers and not just VMs.

To be continued…