Wednesday, March 6, 2019

Login Application in Python and MySQL

In this article, we would like to share with you guys a login program written by me and my best friend Rolly M. Moises to log in using Python and MySQL. The code is very easy to use and understand.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting.

work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com




Sample Program Output


Program Listing

# Rollyn M. Moises and Jake R. Pomperada# Login Application in Python and MySQL# Tools            : PyCharm Community Edition 2018.3# Date             : March 6, 2019  Wednesday# Place of Origin  : Bacolod City, Negros Occidental Philippines# Website          : http://www.jakerpomperada.com
import pymysql
import getpass

connection = pymysql.connect(
    host='localhost',
    port=3306,
    user='root',
    password='',
    db='school_management',
)

def login():
 print("==== LOGIN SECURITY SYSTEM =====");
 print();
 user = input("Enter Username : ")
 password = getpass.getpass(prompt='Enter Password :')
 print("\n");
 query_db(user, password)


def query_db(username, pwd):

   try:
      with connection.cursor() as cursor:
         sql = "SELECT * FROM users WHERE username = %s and password = %s"         try:
            rows = cursor.execute(sql, (username, pwd,))
            if rows > 0:
             print("Login successful in the system.")

            else:
               print();
               print("Invalid username and/or password.")
               print();
               print();
               login()
         except:
            print("Unable to fetch records")
 
      connection.commit()
   finally:
      connection.close()
   print("\n");
   input("PRESS ENTER KEY TO CONTINUE")

print()
login()


school_management.sql

-- phpMyAdmin SQL Dump
-- version 4.8.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 06, 2019 at 02:17 AM
-- Server version: 10.1.37-MariaDB
-- PHP Version: 7.3.0

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `school_management`
--

-- --------------------------------------------------------

--
-- Table structure for table `student`
--

CREATE TABLE `student` (
  `id` int(11) NOT NULL,
  `name` varchar(100) DEFAULT NULL,
  `course` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `student`
--

INSERT INTO `student` (`id`, `name`, `course`) VALUES
(2, 'Jake Pomperada', 'Master in Information Technology'),
(3, 'Rollyn M. Moises', 'Master of Science in Computer Science');

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` int(11) NOT NULL,
  `username` varchar(100) DEFAULT NULL,
  `password` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `username`, `password`) VALUES
(1, '123', '123'),
(2, 'admin', 'admin');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `student`
--
ALTER TABLE `student`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `student`
--
ALTER TABLE `student`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;



Menu Driven CRUD in Python and MySQL

A simple menu driven crud program that we wrote together with my mentor in programming and best friend Rollyn M. Moises for our upcoming book in Python programming.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting.

work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com











Sample Program Output


Program Listing

# Rollyn M. Moises and Jake R. Pomperada# CRUD Application in Python and MySQL
# Tools            : PyCharm Community Edition 2018.3
# Date             : March 6, 2019  Wednesday
# Place of Origin  : Bacolod City, Negros Occidental Philippines
# Website          : http://www.jakerpomperada.com

import pymysql
import subprocess as sp

connection = pymysql.connect(
    host='localhost',
    port=3306,
    user='root',
    password='',
    db='school_management',
)

def add_record():
   print();
   print("ADD STUDENT RECORD")
   print();
   name = input("Enter Student Name     : ")
   course = input("Enter Student Course   : ")
   print();
   try:
      with connection.cursor() as cursor:
         sql = "INSERT INTO student (`name`, `course`) VALUES (%s, %s)"         try:
            cursor.execute(sql, (name, course))
            print("Student added successfully")
         except:
            print("Unable to save student record")
      connection.commit()
   finally:
      print("") #connection.close()
def select_records():
   
   try:
      with connection.cursor() as cursor:
         sql = "SELECT `id`, `name`, `course` FROM student"         try:
            cursor.execute(sql)
            result = cursor.fetchall()
            print();
            print("VIEW STUDENT RECORDS")
            print();
            print("ID\t\t NAME\t\t\t\t\t\t\t\tCOURSE")
            print("---------------------------------------------------------------------------")
            for row in result:
               print(str(row[0]) + "\t\t" + row[1] + "\t\t\t" + row[2])
 
         except:
            print("Unable to fetch records")
 
      connection.commit()
   finally:
      print("") #connection.close()
def delete_input():
   print();
   print("DELETE STUDENT RECORD")
   print();
   id = input("Enter Student ID         : ")
   print();
   delete_record(id)

def delete_record(id):

   try:
      with connection.cursor() as cursor:
         sql = "DELETE FROM student WHERE id = %s"         try:
            cursor.execute(sql, (id,))
            print("Successfully Deleted the Record...")
         except:
            print("Unable to delete record")
 
      connection.commit()
   finally:
      print("") #connection.close()

def update_input():
   print()
   print("UPDATE STUDENT RECORD")
   print();
   id = input("Enter Student ID         : ")
   name = input("Enter Student Name       : ")
   course = input("Enter Student Course     : ")
   print();
   update_record(id, name, course)

def update_record(id, name, course):

   try:
      with connection.cursor() as cursor:
         sql = "UPDATE student SET `name`=%s, `course`=%s WHERE `id` = %s"         try:
            cursor.execute(sql, (name, course, id))
            print("Successfully Updated the Record...")
         except:
            print("Unable to update record")
 
      connection.commit()
   finally:
      print("") #connection.close()
def exit_app():
   print();
   print("\tThank you for using this software.");
   print();
   connection.close()

def menu_option():
   ch = "0"   while ch != "5":
      tmp = sp.call('cls',shell=True)
      print();
      print("===== STUDENT RECORD SYSTEM =====");
      print();
      print("1. Add Student Record")
      print("2. Update Student Record")
      print("3. Show Student List Record")
      print("4. Delete a student Record")
      print("5. Quit Program ")
      print();
      ch = input("Select option : ")
      menu_selection = {
         "1": add_record,
         "2": update_input,
         "3": select_records,
         "4": delete_input,
         "5": exit_app
      }  
      func = menu_selection.get(ch)
      if func is not None:
         func()
      else:
         print("Invalid option selected")
      print();
      input('PRESS THE ENTER KEY TO CONTINUE ')

menu_option()


school_management.sql

-- phpMyAdmin SQL Dump
-- version 4.8.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 06, 2019 at 02:17 AM
-- Server version: 10.1.37-MariaDB
-- PHP Version: 7.3.0

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `school_management`
--

-- --------------------------------------------------------

--
-- Table structure for table `student`
--

CREATE TABLE `student` (
  `id` int(11) NOT NULL,
  `name` varchar(100) DEFAULT NULL,
  `course` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `student`
--

INSERT INTO `student` (`id`, `name`, `course`) VALUES
(2, 'Jake Pomperada', 'Master in Information Technology'),
(3, 'Rollyn M. Moises', 'Master of Science in Computer Science');

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` int(11) NOT NULL,
  `username` varchar(100) DEFAULT NULL,
  `password` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `username`, `password`) VALUES
(1, '123', '123'),
(2, 'admin', 'admin');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `student`
--
ALTER TABLE `student`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `student`
--
ALTER TABLE `student`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;





Monday, March 4, 2019

Example No. 2 using Two Dimensional List in Python

To append a new list of values into a two-dimensional list in Python example.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting.

work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Sample Program Output


Program Listing

# example2.py
# Jake R. Pomperada
# March 4, 2019   Monday
# Bacolod City, Negros Occidental
print();
print("\tExample No. 2 using Two Dimensional List");
print();
list_example = [[1,2,3], [4, 5, 6],[7,8,9,10]]
list_example.append([11,12,13,14,15])
print("\tDisplay Result")
print();
print("\t",list_example);
print();
print("\tEND OF PROGRAM")



Odd and Even Numbers using Two Dimensional List in Python

Write a program that will ask the user how many values to be processed. The program also will ask the user to give integer values using two-dimensional list and check which of the given number is odd or even numbers being provided by the user and display the result on the screen.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting.

work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com



Sample Program Output


Program Listing



# odd_even.py
# Rollyn M. Moises and Jake R. Pomperada
# March 4, 2019   Monday
# Bacolod City, Negros Occidental
print();
print("\tOdd and Even Numbers using Two Dimensional List");
print();
num = int(input('\tHow many numbers: '))
print();
accept = []
for a in range(0,num):   #row
    accept.append([])
for b in range(0,num) : # row
    for c in range(0,1) : # column
        accept[b].append(c);
        accept[b][c]=0;

for b in range(0,num) : # row
    for c in range(0,1) : # column
         accept[b][c]=int(input("\tGive value in item no. {0} : ".format(b+1)));

print();
print("\tDisplay Result")
print();
print("\tList of EVEN Numbers");
print();
for i in range(len(accept)):
    for j in range(len(accept[i])):
        if accept[i][j] % 2 == 0:
         print("\t",accept[i][j], end=" ")
print("\n");
print("\t List of ODD Numbers");
print();
for i in range(len(accept)):
    for j in range(len(accept[i])):
        if accept[i][j] % 2 != 0:
         print("\t",accept[i][j], end=" ")
print("\n");
print("\tEND OF PROGRAM")

Passed and Failed Grade Checker Using Two Dimensional List in Python

Write a program that will ask the user how many values to be processed. The program also will ask the user to give a series of grade values using a two-dimensional list and check which of the given grade is passed or failed. Furthermore, the program will list down the passed and failed grade on the screen.

 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting.

work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com




Sample Program Output


Program Listing


# grades.py
# Jake R. Pomperada
# March 4, 2019   Monday
# Bacolod City, Negros Occidental
print();
print("\tPassed and Failed Grade Checker Using Two Dimensional List");
print();
num = int(input('\tHow many numbers: '))
print();
accept = []
for a in range(0,num):   #row
    accept.append([])
for b in range(0,num) : # row
    for c in range(0,1) : # column
        accept[b].append(c);
        accept[b][c]=0;

for b in range(0,num) : # row
    for c in range(0,1) : # column
         accept[b][c]=int(input("\tGive value in item no. {0} : ".format(b+1)));

print();
print("\tDisplay Result")
print();
print("\tList of PASSED Grades");
print();
for i in range(len(accept)):
    for j in range(len(accept[i])):
        if accept[i][j] >= 75:
         print("\t",accept[i][j], end=" ")
print("\n");
print("\tList of FAILED Grades");
print();
for i in range(len(accept)):
    for j in range(len(accept[i])):
        if accept[i][j] < 75:
         print("\t",accept[i][j], end=" ")
print("\n");
print("\tEND OF PROGRAM")






Positive and Negative Number Lister Using Two Dimensional List in Python


Write a program that will ask the user how many values to be processed. The program also will ask the user to give a series of grade values using the two-dimensional list and check which of the given number is positive or negative in terms of numerical value and display the result on the screen.

 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting.

work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Sample Program Output


Program Listing


# positive_negative.py
# Jake R. Pomperada
# March 4, 2019   Monday
# Bacolod City, Negros Occidental
print();
print("\tPositive and Negative Number Lister Using Two Dimensional List");
print();
num = int(input('\tHow many numbers: '))
print();
accept = []
for a in range(0,num):   #row
    accept.append([])
for b in range(0,num) : # row
    for c in range(0,1) : # column
        accept[b].append(c);
        accept[b][c]=0;

for b in range(0,num) : # row
    for c in range(0,1) : # column
         accept[b][c]=int(input("\tGive value in item no. {0} : ".format(b+1)));

print();
print("\tDisplay Result")
print();
print("\tList of Positive Number");
print();
for i in range(len(accept)):
    for j in range(len(accept[i])):
        if accept[i][j] >= 0:
         print("\t",accept[i][j], end=" ")
print("\n");
print("\tList of Negative Number");
print();
for i in range(len(accept)):
    for j in range(len(accept[i])):
        if accept[i][j] < 0:
         print("\t",accept[i][j], end=" ")
print("\n");
print("\tEND OF PROGRAM")

Maximum and Minimum Numbers Using Two Dimensional List in Python

A very simple program that I wrote using Python that will ask the user to give a series of number and then the program determine and check which of the series of number has the maximum and minimum value and display the result using the two-dimensional list in python.

 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting.

work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com



Sample Program Output


Program Listing

# max_min.py
# Jake R. Pomperada
# March 4, 2019   Monday
# Bacolod City, Negros Occidental
print();
print("\tMaximum and Minimum Numbers Using Two Dimensional List");
print();
num = int(input('\tHow many numbers: '))
print();
accept = []
for a in range(0,num):   #row
    accept.append([])
for b in range(0,num) : # row
    for c in range(0,1) : # column
        accept[b].append(c);
        accept[b][c]=0;

for b in range(0,num) : # row
    for c in range(0,1) : # column
         accept[b][c]=int(input("\tGive value in item no. {0} : ".format(b+1)));

print();
print("\tDisplay Result")
print();
print("\tThe maximum number is {0}. ".format(max(accept)));
print();
print("\tThe minimum number is {0}. ".format(min(accept)));
print();
print("\tEND OF PROGRAM")


Friday, March 1, 2019

TUP’S POMPERADA PUBLISHES HIS 6TH BOOK

First of all I would like to say thank you very much for Sir James U. Sy Jr. for featuring me in his column in Negros Daily Bulletin and also to Sir Arman Toga the chief editor of Negros Daily Bulletin for the support.

I this article I will share the content of the article written by Sir James Sy about my book for story about this article can be read in this following link http://www.ndb-online.com/february2819/tup-s-pomperada-publishes-his-6th-book?fbclid=IwAR3b7TO2IQohuIOOPYWFp7vC5GlN_ermVjB6N61396JsmqLmT-AQE4N2-ME


TUP’S POMPERADA PUBLISHES HIS 6TH BOOK

By James U. Sy Jr.
Jake R. Pomperada, MAED-IT, a newly-hired Science Research Specialist II at the Technological University of the Philippines-Visayas (TUP-V), has published his sixth book entitled Beginner’s Guide to C++ Programming through the Metro Manila-based Mindshapers Co., Inc..


Jake R. Pomperada, MAED-IT, holding his latest published book, with his beloved mother Lydia Rodriguez-Pomperada.*(Contributed photo)
His first five books were PHP with MySQL A Web Programming Language (as co-author with Mamerlo V. Abante, PhD, DIT, Marissa G. Chua, MA Coed, and Kevin M. San Jose, MSIT-CAR) (2015), Introduction to JAVA Programming (2016), Fundamentals of JavaScript Programming (2016), Introduction to JAVA Programming Rev. Ed. (2018), and Introduction to C# Programming (2018).
Pomperada graduated Cum Laude in Master of Arts in Education, Major in Instructional Technology at La Consolacion College-Bacolod (LCC-B) on March 15, 2008 and has earned 21 units in Doctor of Philosophy (Ph.D.), Major in Technology Management at the Carlos Hilado Memorial State College (CHMSC)-Talisay (2010-2011). He is currently enrolled in Master of Information Technology at the Northern Negros State College of Science and Technology for a year now.
Pomperada, a freelance programmer and web designer/developer since 1999, drew from his vast experience in the industry in making the book. He previously worked as a Software Engineering Consultant / Application Development Team Lead at Accenture Inc. in Manila (2015-2017) and a Document Analyst / Software Quality Assurance Engineer at Channel Technologies Inc. He has started the entrepreneurial venture Red Dragon Digital Hub in 2018.
Prior to writing his books, he has started sharing his knowledge of IT to Generation Y and Z teens as an academic teacher and continued to do so until late 2018, having taught in a total of 10 schools - College of Arts & Science in Asia and the Pacific (CASAP)-Bacolod Campus (2018), TUP-V (2013-2015), Megume Information Technology Center (2012-2013), Asian Business Institute of E-Technology (2011-2015), STI College Bacolod City (2011-2013), USLS (2009-2011), LCC-B (2007-2011), CHMSC-Talisay (2006-2009), CSA-B (2006), and Bacolod City College (BCC) (2005-2006).
The Outcome Based Education (OBE) compliant Beginner’s Guide to C++ Programming will be distributed by Mindshapers Co., Inc. in Luzon, Visayas, and Mindanao. Interested parties may check the book at http://www.mindshaperspublishing.com.*