Python Dictionary

Python dictionary is the key-value pair implementation in python. It is used to store and retrieve information using a key. It is also called associative array.

In the video below, I demonstrated how you can make use of dictionary to build a simple events management program.

The source code I used in this example are found below:

import sys
import re

print ('****mynew events****')
MyEvents={'Name':" Python Conference" , 'EventDate':'6/12/018' }
print (MyEvents)

###add Venue
print ('****mynew events with venue****')
MyEvents['Venue']= 'Makati Shangrila'
print (MyEvents)

###Change the venue
print ('****mynew events with updated venue****')
MyEvents['Venue']='Edsa Shangrila'
print (MyEvents)

###Add speakers
#print ('****mynew events with spekers****')
MyEvents['Speaker 1']='Luke Warm'
MyEvents['Speaker 2']='Baker Dozen'
MyEvents['Speaker 3']='Andy players'
print (MyEvents)
del MyEvents["Speaker 2"]
print (MyEvents)
#MyEvents.pop('Speaker 3')
#print (MyEvents)

MyEvents['Speaker 2']=MyEvents.pop('Speaker 3')
print (MyEvents)

##print (MyEvents)
##print ('****Myevents printed horizontally****')
for key,values in MyEvents.items():
    print(key,":",values )
    if  (key[0:7])=="Speaker":

print ("Total number of Speakers:",x)

MyEvents['Participant 1']='Sarah Lance'
MyEvents['Participant 2']='Kara Danvers'
MyEvents['Participant 3']='Barry Allen'
MyEvents['Participant 4']='Oliver Queen'
MyEvents['Participant 5']='Laurel Lance'
#MyEvents['Participant 6']='Laurel Lance'

for key,values in MyEvents.items():
    print(key,":",values )#python3 , if in python2 use print item, instead.
    if  (key[0:11])=="Participant":

print ("Total number of PArticipants:",y)

Python Lists, Tuples and Sets

List, tuples and sets are some of the  data structures that are available on python.

List contains comma separated element that are changeable. List are enclosed in square brackets []

Tuples contains comma separated elements that are not changeable. Tuples elements are enclosed in parenthesis ()

Set contain elements that are unique. Set can be changed but uniqueness is maintained. Set elements are enclosed in braces{}

In the video below, I discussed these data structures:

Below are the codes I used for the demo:

import sys
print (sys.version)

print ("************ List ************")
print("List is a collection of comma separated values which are changeable")
print ("List allows duplicate members. It is enclosed in a square bracket")

print ("************ Tuple ************")
print("Tuple is a collection of comma separated values which is not changeable")
print ("Tuple allows duplicate members. It is enclosed in a parenthesis")
print (tuple1)

print ("************Sets ************")
print("Sets is a collection of comma separated values which are changeable and unique")
print ("Set does allows duplicate members. It is enclosed in a brackets {}")
print (set1)

print ("************use of index************")
print("you cn make use of index on list and tuple. set doe not support indexing")
print ("to get the element of the index make use of the systax print (list1[3])")
print ("the index is zero based which means the first element is list1[0]")
print (list1[0])
print (tuple1[0])
#print (set1[0])  ## this will cause an error

print ("************Slicing list and tuples************")
print("you can extract data from list and tuples using slicing")
print ("the format is list1[0:3] ")
print (list1[0:3])
print (tuple1[0:3])

print ("************Slicing List and tuples with step interval************")
print("you can make use of steps when slicing your data")
print ("the format is list1[0:3:2] ")
print (list1[0:3:2])
print (tuple1[0:3:2])

print ("************Changing the value of list using index************")
print("you can change the value in the list using index. you cannot modify the value in tuples")
print ("the format is list1[0]=9 ")
#tupple1[0]=9 #this will cause an error
print (list1[0:])

print ("************creating a big list with range ********************")
print("listing 0 to 150")
print (list2)
print("tuples 0 to 100 step 5")
print (tuple2)

print ("************Getting last element with negative index********************")
print (list2[-1])
print (tuple2[-1])

print ("************slicing with negative index*******************")
print (list2[:-1])
print (tuple2[:-1])

print ("************last five element ******************")
print (list2[-6:-1])
print (tuple2[-6:-1])

print (set2)


print ("************add element to list and set ****************")
print (list2)
print (set2)

print ("************Removing from the list and set ****************")
print (list2)
print (set2)

print ("************Removing from the list and set with discard ****************")
#list2.discard(170) 'there is no discard method in the list
print (list2)
print (set2)

print ("************ Reversing****************")
print (list3)

print ("************sum and average****************")
print (list4)
print("sum of the list",sum(list4))
print("average of the list",sum(list4)/len(list4))
print("minimum value", min(list4))
print("maximum value", max(list4))

print("********set operation *********************")
print (set4)



Numeric Data types and Mathematical Operations in Python

Learning numeric data type in Python is essential to learning the Language. I created a training episode below for this basic fundamentals of learning python and i’m surprised to see a lot of mathematical functions available in the language though this is just the basic of them. The link to the video is below:

The code for the demo is published below. Good luck and Happy coding!

import sys
import math
print (sys.version)
print () #print a new line

#integer example
print("a whole number is an example of integer m=1")
print ("m="+repr(m))
print () #print a new line

#float example
print("a number with decimal is an example of float example m=2.16")
print ("m="+repr(m))
print () #print a new line

print("a number with decimal is an example of float example c=1j")
print ("c="+repr(c))
print ("cx2="+repr(c*2))
print () #print a new line

print("x="+repr(x)+" y="+repr(y)+" z="+repr(z) )
print () #print a new line

print ("******")
print () #print a new line

print ("******")
print( "X divided by y is x/y")
print (x/y)
print () #print a new line

print ("******")
print( "X divided by 2 is x/2")
print (x/2)
print () #print a new line

print ("******")
print( "X divided by 2 and get the int part only (floor division) is x//2")
print (x//2)
print () #print a new line

print ("******")
print( "X mod 2. Get the remainder of x/2 is X%2 ")
print (x%2)
print () #print a new line

print ("******")
print( "get the integer division and mod using is divmod(x,2)")
print (divmod(x,2))
print () #print a new line

print ("******")
print( "X Times y is x*y")
print (x*y)
print () #print a new line

print ("******")
print( "x squared is x**2 or pow(x,2)")
print (x**2)
print (pow(x,2))
print () #print a new line

print ("******")
print ("The squareroot of x is math.sqrt(x)")
print (math.sqrt(x))
print () #print a new line

print ("******")
print ("this is also square root of x. x**(1/2)")
print (x**(1/2))
print () #print a new line

print ("******")
print ("this is the cube root of x. x**(1/3)")
print (x**(1/3))
print () #print a new line

print ("******")
print ("the value of pi is math.e")
print (math.pi)
print () #print a new line

print ("******")
print ("the value of e that we use with log math.e")
print (math.e)
print () #print a new line

print ("******")
print ("log of x is math.log(x)")
print (math.log(x))
print () #print a new line

print ("******")
print ("sine of x is math.sin(x)")
print (math.sin(x))
print () #print a new line

print ("******")
print ("cosine of x is math.cos(x)")
print (math.cos(x))
print () #print a new line

print ("******")
print ("factorial of x")
print (math.factorial(x))

Strings And String Processing in Python

If you are learning a new programming language, usually string manipulation exercise are among the first thing to do. Python has a wide library of functions for string manipulation. Please watch my video below for the presentation

Here are the code that I have used for the demo:

print ("Hello World")
## this is a comment
# String Variables

str1="This is a string"
print (str1)
#string is a zero based array of characters

#print ("****the first six charachter*****")
print (str1[0:5])

#print ("****the 2nd to 8th*****")
print (str1[1:7])
#print ("****6th characters and onward *****")
print (str1[5:])

str4='"this a string created with single qoute"'

str5="this's a string created with double qoute"

str5='this\'s a string created with single qoute and escape charater'

#long strig using three single quotes
str6=''' this is a lOnG...
long... span manyline

#long strig using three double quotes
str7="""this is a lOnG...
long... span manyline
string ex2"""

print (str7.count("s"))
print (str7.find("s"))

print (len(str7))

print (str7.upper())
print (str7.lower())
print (str7.title())

str2 = "thisisyear 2009"
print (str2.isalnum())
print (str2.isupper())

str3 = "non alphanumeric";
print (str3.isalnum())

print("*** string concatenation demo***")
A="I have two hands."
B="the left and the right"

#repr() Return a string containing a printable representation of an object.

print("****repr demo****")
print (repr(x))

print ("The value of small x="+repr(x))
print ("The value of X="+repr(X))

Storing and Retrieving Hierarchical Data in SQL SERVER using HierachyID

HierachyID datatype has been introduced in SQL Server 2008 and is still an available features today. This datatype allows you to store and retrieve data easily. It goes with several built-in CLR functions that will allow you to easily retrieve data based on your specification.

Below scripts creates an employee table with hierarchyID:

CREATE TABLE [dbo].[employee](
[employeeid] [int] IDENTITY(1,1) NOT NULL,
[hid] [hierarchyid] NULL,
[lastname] [varchar](50) NULL,
[firstname] [varchar](50) NULL,
[role] [varchar](20) NULL,
[employeeid] ASC


This script will insert hierarchical data in the newly created table:

INSERT INTO [dbo].[employee]
(‘/1/’,’King’,’Nosmo’,’Sr. Manager’),
(‘/1/1/1/’,’Players’,’Andy’,’Sr. web developer’),
(‘/2/’,’Dela Cruz’,’Juan’,’Sr.Manager’),

You can now start querying for people that reports directly  to Philip Morris by using the getancestor() CLR function. Notice that the parameter is the level of relationship

select * from employee
where hid.GetAncestor(1)=’/’

Results to:

employeeid hid lastname firstname role
22 0x58 King Nosmo Sr. Manager
26 0x68 Dela Cruz Juan Sr.Manager

Hierarchy ID is stored in binary format. You can use the ToString() function to convert it to string.  This query below will return three levels of hierarchy that reports to Philip.

select [hid].ToString() as HID,hid.GetLevel()as Level,[lastname],[firstname],[role] from employee where hid.GetAncestor(1)=’/’ or hid.GetAncestor(2)=’/’ or hid.GetAncestor(3)=’/’
order by 1

This is going to be the result:

HID Level lastname firstname role
/1/ 1 King Nosmo Sr. Manager
/1/1/ 2 Walking Jay Manager
/1/1/1/ 3 Players Andy Sr. web developer
/1/1/2/ 3 Trinidad Victoria Tester
/2/ 1 Dela Cruz Juan Sr.Manager
/2/1/ 2 Mills Richard Manager
/2/1/1/ 3 Gump Richard Forest

You can also make use of getdescendant function to know who is your boss.

select [hid].ToString() as HID,hid.GetLevel()as Level,[lastname],[firstname],[role] from employee where hid.GetDescendant(null,null)=’/1/1/’

This is going to be the result of the previous query:

HID Level lastname firstname role
/1/ 1 King Nosmo Sr. Manager



Software Automation With AutoHotkey

About AutoHotkey

Autohotkey(AHK)  is a free, opensource, scripting language for Windows. If you are doing repetitive task you can automatee the task for you by programming  an .AHK script which  functions like a macro. It can be used for the following:

  1.  Provides easy keyboard shortcuts or hotkeys
  2.  Launch an application automatically with predefined parameters
  3. open and create documents automatically
  4.  do an automated file operation such as copy, delete and rename  files
  5.  expand acronyms by using hot strings
  6.  Automatically fill out form
  7.  Automatically control the mouse
  8. Automatically send text
  9.  Use it to play your games
  10. You can make use of it for automated testing of  your newly created application


You can download autohotkey from After downloading all you need is to install the application.


How does it work?

You need to create a script and have it an extension of ahk. For example script1.ahk.  Next you need to run the script.   The script will be stored like a Terminate and stay Resident (TSR) program which will run everytime a trigger is run

Automate repetitive task with Autohotkey Example DEMO.AHK

This script will run the windows snipping tool and will prepare it to take a new snip when you press “windows key+c”  and it  it will type

“test1 “plus enter Puls “test”  when you press “windows key +t”.  It will paste copied data when you press  windows key +v


#c::send #+{s}
send test1 {Enter}
send test2
send ^v
send pasted by aht
send {Enter}


Developing Python on Visual Studio 2017

Python is now one of the emerging programming language. Just like any other programming language you can build different kinds of applications using it such as web application, desktop and command line base applications.

Developing it with visual studio make it more easy and classy. Visual studio has been used by a lot of developers since it first comes to being. Developers enjoy the IDE with its intellisense and centralized code repository among others. The advantage of developing python in Visual Studio is that you will probably need a learning curve with the IDE and if you are new to visual studio you can make use of if for other development purposes.

Please watch the video below for more details:

How do you plan your day as a YouTuber?

If you are planning to have a career in YouTube, you need to plan your day to day activity. There are several task that you need to do to be a successful YouTuber.

You need to:

  1. Research your content. A secret to a successful video is a well research content
  2. Create your videos. You will be needing a lot of hours when you start up especially if you are new to editing
  3.  Distribute or circulate your video. Once your video is uploaded to Youtube you need to plan how to circulate it.
  4. Manage your subscriber. You will definitely need a lot of time managing your subscriber but that is not the only task. make sure you control it.
  5. Plan  you work. You need to look at the dashboard and see what needs to be improved.

YouTube is an interesting work but you have to plan your day to day task.

Here’s my break down in terms of hours.

Task Hours
Manage Subscribers 2
plan and create Content 2
research 2
Circulate your work 3
Plan and strategize 1

In this episode, I document the things I learned in the YouTube platform. Please watch.

Project Management Process Group and Knowledge Areas

Below are the project management knowledge areas and process group based on PMBOK 6th edition.


Process Groups
Knowledge Areas Initiating Planning Executing Monitoring
and Controling
Closing Process count
Project Integration


Develop Project Charter Develop Project management plan Direct And Mange Project Work
Manage Project Knowledge
Monitor and Control Project Work
Perform Integrated Change Control
Close Project Or Phase 7
Project Scope


Plan Scope Management
Collect Requirements
Define scope
Create Work breakdown Structure
Validate Scope
Control Scope
Project Schedule


Plan Schedule management
Define Activities
sequence activities
Estimate Activity Duration
Develop Schedule
Control Schedule 6
Project Cost


Plan Cost Management
Estimate Cost
Determine budget
Control Cost 4
Project Quality


Plan Quality management Manage Quality Control Quality 3
Project Resource


Plan Resource Management
Estimate Activity Resources
Acquire Resources
Develop Team
Manage Team
Control Resources 6
Project Communications


Plan Communication Management Manage Communication Monitor Communications 3
Project Risk


Plan Risk Management
Identify Risk
Perform Qualitative Risk Analysis
Perform Quantitative Risk
Plan Risk Responses
Implement Risk Response Monitor Risk
Project Procurement


Plan Procurement Management Conduct Procurements Control Procurements
Project Stakeholder


Identify Stakeholder Plan Stakeholder engagement Manage Stakeholder Engagement Monitor Stakeholder Engagement
2 24 10 12 1 49

Installing SQL Server 2017 on Red Hat Enterprise Linux

In  this new training episode on SQL Server administration. I talked about how to install SQL Server 2017 on Red Hat Enterprise Linux.

Here are the steps:

1. Enable the Sql Server Repository

sudo curl -o /etc/yum.repos.d/mssql-server.repo

2. run update and install sql server

sudo yum update
sudo yum install -y mssql-server

3. Configure Sql Server

sudo /opt/mssql/bin/mssql-conf setup

4. check server status

systemctl status mssql-server

5. open port 1433

sudo firewall-cmd –zone=public –add-port=1433/tcp –permanent
sudo firewall-cmd –reload