Saturday, July 29, 2017

Count Number of Eight Digits in Visual Basic NET

A simple program that will ask the user to give a series of numbers in integer format. Our program will count the number of eight digit occurrence based on the given number by our user. The code is written in Visual Basic NET and it is very easy to understand.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Thank you.







Sample Program Output


Program Listing

Public Class Form1

    Public Function CountCharacter(ByVal value As String, ByVal ch As Char) As Integer
        Return (New System.Text.RegularExpressions.Regex(ch)).Matches(value).Count
    End Function


    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Label2.Text = "Total Number of  Number of 8 Digitst is " & CountCharacter(TextBox1.Text, "8") & "."
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        End
    End Sub

    Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click

    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        TextBox1.Text = ""
        Label2.Text = ""
        TextBox1.Focus()
    End Sub
End Class


Thursday, July 27, 2017

Addition of Two Numbers in NodeJS

I started learning NodeJS programming the first thing that I would like to write is to add the two numbers using NodeJS here is the solution. The code is very simple and easy to understand for beginners like me that is new in NodeJS programming.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Thank you.






Sample Program Output


Program Listing

sum.js

/* Addition of Two Numbers in NodeJs    */
/* July 27, 2017   Thursday   10:41 PM  */
/* Written By: Mr. Jake R. Pomperada   */


var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

console.log('\n');
console.log('Addition of Two Numbers in NodeJS');
console.log('\n');
rl.question('Enter first value : ', function (x) {
   rl.question('Enter  second value : ', function (y) {
var a = parseInt(x);
var b = parseInt(y);
        var sum = (a+b);
       console.log('\n');
       console.log('The sum of ',a, ' and ',b, ' is ' , sum,'.');
  console.log('\n');
       console.log('End of Program');
        rl.close();
    });
});




Saturday, July 15, 2017

Basics of Struct in C++


In this article shows you how to use basics of struct in C++ the code is very easy to understand and use.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Thank you.





Program Listing


#include <iostream>

using namespace std;

struct new_person {
    string name;
    int age;
    int val1;
    int val2;
};

main() {

 int sum_up=0;

    new_person jake;
    new_person boy = {"Boy Abunda",65};
    new_person solve;
    solve.val1 = 5;
    solve.val2 =10;

    sum_up = (solve.val1 + solve.val2);



    cout << "\n\n";

    jake.name = "Jake Rodriguez Pomperada";
    jake.age = 31;
    cout << "\t\t Basics of Struct in C++";
    cout << "\n\n";
    cout << jake.name <<  " " << " Age " <<jake.age;
    cout << "\n\n";
    cout << boy.name <<  " " << " Age " <<boy.age;
    cout << "\n\n";
    cout << "The sum of "<< solve.val1 << " and " <<
          solve.val2 << " is " << sum_up << ".";
    cout << "\n\n";
    system("pause");
}



Using Structure in C++

A very simple program to demonstrate how to use structure in C++ the code is very easy to understand and use.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Thank you.




Program Listing

#include <iostream>

using namespace std;

struct new_person {
    string name,address;
    int age;
};

main() {
    new_person sample;

    cout << "Enter your name : ";
    getline(cin,sample.name);
    cout << "\nEnter your Address : ";
    getline(cin,sample.address);
    cout << "\nEnter your Age : ";
    cin >> sample.age;


    cout << "\n\nName    : " << sample.name;
    cout << "\n\nAddress : " << sample.address;
    cout << "\n\nAge     : " << sample.age;
    cout << "\n\n";
    system("pause");

}

Student Record System in AngularJS and PHP


In this article will show how to display and search a student record using AngularJS and PHP. The code is very easy to understand and use.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Thank you.







Sample Program Output


Program Listing

index.php


<html ng-app="fetch">
    <head>
    <title>AngularJS and PHP in AngularJS and PHP </title>
      <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
            <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.24/angular.min.js"></script>
    </head>
    <body>
    <br>
<style>
  body {
  font-family:arial;
  font-weight:bold;
  size:12px;
      background-color:lightblue; 
  
  }
 </style> 
      <div class="row">
        <div class="container">
         <h1>Student Record System in AngularJS and PHP</h1>
<br><br>
          <div ng-controller="dbCtrl">
            Type Student Name or ID Number Here 
<br><br>
<input type="text" ng-model="searchFilter" class="form-control">
<br><br>

            <table class="table table-hover">
                <thead>
                    <tr>
<th>ID</th>                       
   <th>Student Name</th>
                        <th>Course</th>
<th>Email Address</th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="students in data | filter:searchFilter"> 
                        <td>{{students.student_id}}</td>
                        <td>{{students.name}}</td>
<td>{{students.course}}</td>
                        <td>{{students.email}}</td>
                    </tr> 
                </tbody>
            </table>
          </div>
        </div>
      </div>
    </body>

    <script>
        var fetch = angular.module('fetch', []);

        fetch.controller('dbCtrl', ['$scope', '$http', function ($scope, $http) {
            $http.get("ajax.php")
                .success(function(data){
                    $scope.data = data;
                })
                .error(function() {
                    $scope.data = "error in fetching data";
                });
        }]);

    </script>

    </html>


ajax.php

<?php
//database settings
$connect = mysqli_connect("localhost", "root", "", "school");

$result = mysqli_query($connect, "select * from students order  by name ASC");

$data = array();

while ($row = mysqli_fetch_array($result)) {
  $data[] = $row;
}
    print json_encode($data);

?>


students.sql

-- phpMyAdmin SQL Dump
-- version 4.6.5.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jul 12, 2017 at 11:51 AM
-- Server version: 10.1.21-MariaDB
-- PHP Version: 5.6.30

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
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`
--

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

--
-- Table structure for table `students`
--

CREATE TABLE `students` (
  `id` int(11) NOT NULL,
  `student_id` varchar(20) NOT NULL,
  `name` varchar(200) NOT NULL,
  `course` varchar(200) NOT NULL,
  `email` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `students`
--

INSERT INTO `students` (`id`, `student_id`, `name`, `course`, `email`) VALUES
(1, '1', 'Bill Gates', 'BS Information Technology', 'bill_gates@yahoo.com.ph'),
(2, '2', 'Digong Duterte', 'BS LAW', 'digong@davao.gov.ph'),
(3, '3', 'Kobe Bryant', 'BS Managerial Accounting', 'kobe@la_lakers.com'),
(4, '4', 'Carina Tan', 'MS Information Technology', 'carina_tan@hotmail.com'),
(5, '5', 'Alma Duterte', 'MAED-IT', 'alma_duterte@lycos.com.ph'),
(6, '6', 'Baste Duterte', 'BS Marine Technology', 'baste@cnn.com.ph'),
(7, '7', 'Jake Pomperada', 'BS Computer Science', 'jakerpomperada@yahoo.com'),
(8, '8', 'Jacob Samuel Pomperada', 'BS Computer Engineering', 'jacob_samuel_pomperada@gmail.com'),
(9, '9', 'Ma. Junallie F. Pomperada,PH.D', 'BS Chemical Engineering', 'alliepomperada@yahoo.com.ph'),
(10, '10', 'Julianna Rae F. Pomperada', 'BS Business Management', 'iyapomperada@live.com');

--
-- Indexes for dumped tables
--

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

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `students`
--
ALTER TABLE `students`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
/*!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 */;







Grading System in AngularJS

A very simple program that I wrote using AngularJS to compute the grade of the student. The code is very simple and easy to understand.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Thank you.




Program Listing

<html>
   <head>
      <script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.5.2/angular.min.js"></script>
   </head>
   
   <body ng-app>
     Prelim Grade   <input ng-model="prelim"  type="number"> <br>
     Midterm Grade  <input ng-model="midterm" type="number"> <br>
Endterm Grade <input ng-model="endterm"  type="number"> 
<br><br>
 
Your Grade is {{ (prelim * 0.2) + (midterm * 0.3) + (endterm * 0.5) | number : 2 }}
</body>
</html>

 
  


AngularJS JSON Fetching Student Records


This sample program will fetch the record from a JSON file using angularjs. The code is very simple and easy to use. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Thank you.




Sample Program Output



Program Listing

index.php


<html ng-app="StudentApp">
  <head>
    <meta charset="utf-8">
    <title>AngularJS JSON Fetching Student Records</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
    <script>
      var countryApp = angular.module('StudentApp', []);
      countryApp.controller('StudentController', function ($scope, $http){
        $http.get('students.json').success(function(data) {
          $scope.records = data;
        });
      });
    </script>

<style>
h2 {
text-align:center;
color:blue;
position: relative;
top: 40px;
}

table.center {
    position: relative;
top: 60px;
width:80%; 
font-weight:bold;
    margin-left:15%; 
    margin-right:15%;
}
  </style>
  </head>
  <body ng-controller="StudentController">
<h2>AngularJS JSON Fetching Student Records</h2>
    <table class="center" border="1">
      <tr>
        <th>Student Name</th>
<th>Course</th>
        <th>Year Level</th>
<th>Address</th>
      </tr>
      <tr ng-repeat="students in records">
        <td>{{students.name}}</td>
<td>{{students.course}}</td>
        <td>{{students.year_level}}</td>
<td>{{students.address}}</td>
      </tr>
    </table>
  </body>
</html>


students.json

[
  {
    "name": "James Dean",
    "course": "BSIT",
    "year_level": "First Year",
"address": "One Gateway USA"
  },
  
  {
    "name": "Linda Lee",
    "course": "BSMA",
    "year_level": "Second Year",
"address": "#12345 Microsoft Way USA"
  },
  
  {
    "name": "Bryan Adams",
    "course": "MSIM",
    "year_level": "Third Year",
"address": "Spartan Road USA"
  },

  {
    "name": "Jake Pomperada",
    "course": "BSCS",
    "year_level": "Fourth Year",
"address": "Purok Pag-asa, Barangay Alijis, Bacolod City Negros Occidental"
  },

  {
    "name": "Jacob Samuel Pomperada",
    "course": "BSChe",
    "year_level": "Second Year",
"address": "Purok Pag-asa, Barangay Alijis, Bacolod City Negros Occidental"
  }

  

]


Wednesday, July 12, 2017

Lending Program in C++

A very simple program that I wrote 7 years ago to compute the interest rate of the money being loan by the customer in a lending company I wrote this program using C++.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.


Program Listing

#include <iostream>
#include <iomanip>
#include <fstream>


using namespace std;

main() {

    string name;

    int principal=0;
    int number_months=0;
    float rate=0.00,solve_rate=0.00;

    ofstream file("report.txt");

    cout << "\t  Kwarta Agad Lending Investor";
    cout << "\n\n";
    cout << "Enter Customer Name    :=> ";
    getline(cin,name);
    cout << "\nEnter Amount  Loan   :=> ";
    cin >> principal;
    cout << "\nNumber of Months    :=> ";
    cin >> number_months;
    cout << "\nEnter Rate Per Month :=> ";
    cin >> rate;
    solve_rate = (principal * number_months * rate ) ;
    cout << "\n\n";
    cout << fixed << setprecision(2);
    cout << "The Simple Interest Rate is Php "
         << solve_rate << ".";

    file << "\n\t ======= Kwarta Agad Lending Investor =========";
    file << "\n\n";
    file << "\n\t\t CUSTOMER REPORT";
    file << "\n\n";
    file << "\n Customer Name     : " << name;
    file << "\n Amount   Loan     : " << principal;
    file << "\n Number of Months  : " << number_months;
    file << "\n Rate Per Month    : " << rate;
    file << "\n\n";
    file << fixed << setprecision(2);
    file << "\n Interest Rate is Php " << solve_rate;
    file.close();
    cout << "\n\n";
    system("pause");
}

Histogram in C++

A very simple program in C++ to generate a Histogram and save on the text file.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.


Program Listing

#include <iostream>
#include <fstream>


using namespace std;

 main()
    {

       ofstream file("data.txt");

       cout<<"\n I)- First Histogram :"<<endl;

       for(int count_1=1;count_1<=10;count_1++)
 {
    for(int count_2=1;count_2<=count_1;count_2++)
cout<<"*";
       cout << "\n";
 }

       cout<<"\n II)- Second Histogram :"<<endl;

       for(int count_3=1;count_3<=10;count_3++)
 {
    for(int count_4=10;count_4>=count_3;count_4--)
cout<<"*";
     cout << "\n";
 }
 file << "\n\n";
 file   <<"\n I)- First Histogram :"<<endl;

       for(int count_1=1;count_1<=10;count_1++)
 {
    for(int count_2=1;count_2<=count_1;count_2++)
file<<"*";
        file << "\n";
 }

       file <<"\n II)- Second Histogram :"<<endl;

       for(int count_3=1;count_3<=10;count_3++)
 {
    for(int count_4=10;count_4>=count_3;count_4--)
file <<"*";
     file << "\n";
 }
 file.close();

    cout << "\n\n";
    system("pause");
    }

Odd and Even Numbers in Java Using Methods

In this sample program it will ask the user to give a number and then our program written in Java will check if the given number is an odd or even numbers using methods in Java.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.



Sample Program Output



Program Listing

// Problem : Write a program in Java that will check if the given number by the user is an
//           Odd or Even Number.         
// Date:  June 28, 2015
// Written By: Mr. Jake R. Pomperada, MAED-IT
// Email Address: jakerpomperada@yahoo.com and jakerpomperada@gmail.com

import java.util.Scanner;


class odd_even_checker {
    public int check_odd_even_number(int value)
    {
      if((value % 2) == 0) 
System.out.println("The given number is " + value + " is Even Number.");
else
System.out.println("The given number is " + value +  " is Odd Number.");
    return 0;
    }

 
public static void main(String args[]) {
  Scanner scan = new Scanner(System.in);
   char a;
do
    {
  // creating of an object
  
  odd_even_checker num = new odd_even_checker();
      
  System.out.println();
  System.out.println("===== ODD OR EVEN NUMBER CHECKER =====");
  System.out.println();
  System.out.print("Enter a Number :  ");
  int number_given =   scan.nextInt();
  
  System.out.println();
     num.check_odd_even_number(number_given);
  System.out.println("\n\n");
  System.out.print("Do you Want To Continue (Y/N) :=> ");
   a=scan.next().charAt(0);

   } while(a=='Y'|| a=='y');
          System.out.println("\n");
          System.out.println("\t ===== END OF PROGRAM ======");
         System.out.println("\n");
 }
  
   } // End of Program






















Circles in CSS

I this article I would like to share with you a sample CSS codes that will create a circle. CSS or Cascading Style Sheet is very basic and fundamentals to learn if you want to learn web development. The CSS tags are very short and easy to understand I hope you will learn from this. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.




Sample Web Page Output



Source Code Listing

<html>
 <head>
  <title>
     Circles Demo in CSS
  </title>
   <meta charset="utf-8">
  </head> 
  <style>
 .circle_orange {
  width: 47px;
  height: 47px;
  border-radius: 50%;
  background-color: #f58025;
  border: solid 0.5px #e0e0e0;
  
}
  
  .layer_circle1 {
  object-fit: contain;
  font-family: HiraKakuPro-W3;
  font-size: 12px;
  font-weight:bold;
  line-height: 3.67;
  text-align: center;
  color: #ffffff;
  
}
  
   .circle_gray {
  width: 47px;
  height: 47px;
  border-radius: 50%;
  background-color: lightgray;
  border: solid 0.5px #e0e0e0;
  
}
  
  .layer_circle2 {
  object-fit: contain;
  font-family: HiraKakuPro-W3;
  font-size: 12px;
  font-weight:bold;
  line-height: 3.67;
  text-align: center;
  color: gray;
  
}
  
 </style>
  
  <body>
    <div class="circle_orange layer_circle1"> 
      Demo
</div>
<br>
<div class="circle_gray layer_circle2"> 
  Test</div>
  </body>
</html>  

Saturday, July 1, 2017

Addition of Numbers Using Functions and Arrays in C++

A very simple program that I wrote during the time I'm still working as university professor to add the sum of three numbers using functions and one dimensional array in C++. I hope you will find my work useful.  Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.



Program Listing

#include <iostream>


 using namespace std;

int addition(int a, int b, int c)
{
    cout << "The sum of "
      << a << "," << b <<  " and "
      <<  c << " is "
      << (a + b + c) << ".";
}

main() {
    int a[2];
    cout << "\t\t ADDITION USING FUNCTION";
    cout << "\n\n";
    cout << "Enter a Value No. 1 ";
    cin >> a[0];
    cout << "Enter a Value No. 2 ";
    cin >> a[1];
    cout << "Enter a Value No. 3 ";
    cin >> a[2];
    cout << "\n";
    addition(a[0],a[1],a[2]);
    cout << "\n\n";
    system("pause");
}