Sunday, January 4, 2015

Time Record System in PHP and MySQL

Hi there in this article I would like to share with you a simple business application program that I wrote that will monitor the attendance of the student and employees in a company I called this program Time Record System in PHP and MySQL. What the program will do is to allow the student or employee's to time in and time out when they report in their class or work. The program will count the number of hours an employee work in the company. There are still many things to do in order to improve how this program works properly with different scenarios what is important we can have an idea how to perform computation of hours rendered by employees in their work.

If you like my work please send me an email at jakerpomperada@yahoo.com and jakerpomperada@gmail.com. My mobile number here in the Philippines is 09173084360.

Thank you very much and Happy Programming




Sample Output of Our Program


Saturday, January 3, 2015

Three Dimensional Array in C++

In this article I would like to share with your how to write a three dimensional array in c++ also known as multidimensional array. The logic behind three dimensional array in C++ is the use of three for loop statement. In most programming problems the use of three dimensional array is rarely being used but it is a good idea to have some knowledge how write multidimensional array using C++ as our programming language.

If you have some questions regarding about my work please send me an email at jakerpomperada@yahoo.com and jakerpomperada@gmail.com.

Thank you very much and Happy Programming.


Sample Output of Our Program


Program Listing

#include <iostream>

  using namespace std;

   main()
   {
       int elements[2][2][2];
       int count=1;

      cout << "\n\n Three Dimentional Array";
      cout << "\n\n";
     for (int a=0; a<2; a++) {
        for (int b=0; b<2; b++) {
           for (int c=0; c<2; c++) {

            cout << "Enter Values No "
            << count++
            << " : ";



            cin >>elements[a][b][c];
           }
        }
     }
     cout << "\n\n";
     cout << "List of Values ";
     cout << "\n\n";
     for (int a=0; a<2; a++) {
        for (int b=0; b<2; b++) {
           for (int c=0; c<2; c++) {
            cout << "\n" << elements[a][b][c];
           }
        }
     }

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



DOWNLOAD SOURCE CODE HERE

Thursday, December 25, 2014

Addition of Five Numbers in Java Server Pages


One of the interesting web scripting programming language that is based on Java is Java Server Pages or JSP this programming language is based on Java but their are some similarities in terms of syntax in PHP. As I having my christmas vacation at home I try to keep myself busy by learning other programming language one of its is JSP or Java Server Pages. At first I find it very confusing and hard just to write a single line of code primary because majority of my experience in based in using PHP as my primary web programming language.

Basically before you can write your first JSP program you must download and install the Apache Tomcat Web Server that enables you to run your JSP script on it. The tomcat installer is very small and very easy to install and configure it is very similar to Apache web server in many ways the only difference it can only runs Java related codes like JSP and Servlets. 

What are program will do is quite simple it will ask the user to enter five numbers in our form and then send those five number values to another page using POST method and then our JSP script will compute the sum of the five numbers. The code is very simple and easy to understand once you have a basic background in Java programming you can easy leverage your existing knowledge in JSP programming.

I hope you will find my work useful and beneficial I'm just a beginner in terms of programming using JSP. If you have some questions please send me an email at jakerpomperda@gmail.com and jakerpomperada@yahoo.com.

People here in the Philippines who wish to contact me can reach me through my mobile numbers at 09173083260 and 09993969756.

Thank you very much and Happy Programming




Sample Output of Our Program

Program Listing

index.htm

<html>
    <head>
        <title>Addition of Five Numbers</title>
    </head>
    
     <body bgcolor="lightgreen">
 <br><br>
<h2> Addition of Five Numbers </h2>
<br>
        <form action="./add.jsp">
            First number: <input type="text" name="val1"/><br>
            Second number: <input type="text" name="val2"/><br>
            Third number: <input type="text" name="val3"/><br>
            Fourth number: <input type="text" name="val4"/><br>
            Fifth number: <input type="text" name="val5"/><br>
          <br><br>
 <input type="submit" value="Solve" title="Click here to find the sum." />
        </form>
    </body>
</html>

add.jsp

<html>
    <head>
        <title>Addition of Five Numbers</title>
    </head>
   
<body bgcolor="lightgreen">
 <br><br>
<%
int a,b,c,d,e1,sum;
try{
a=Integer.parseInt(request.getParameter("val1"));
b=Integer.parseInt(request.getParameter("val2"));
c=Integer.parseInt(request.getParameter("val3"));
d=Integer.parseInt(request.getParameter("val4"));
e1=Integer.parseInt(request.getParameter("val5"));

sum=(a+b+c+d+e1);
out.println("<h1> The total sum of " +a+ ", " +b+" ,"+c+" , "+d+", "+e1 + " is " + sum + ".</h1>");
}
catch(Exception e)
{
out.println("<script>alert('You entered invalid number',); </script>");
}
%>
    </body>
</html>



Friday, December 19, 2014

Count Number of File Downloads in PHP

In this article I will share with you a program that I wrote to count the number of downloads of a certain files using PHP as our programming language. The code does not uses mysql to store the number of downloads rather it uses a text file to store how many times the file is being downloaded from the website. Actually there are many methods in order to count the number of times the file is being downloaded from a website. Feel free to change or modify my code to suit in your needs.

If you have some questions please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com. People here in the Philippines who wish to contact me can reach me through my mobile numbers 09173084360 and 09993969756.



Sample Output of Our Program


Wednesday, December 17, 2014

Count Number of Visitors in PHP

In this article I would like to share with a very simple program  that is written in PHP to count the number of views on a web page. In order for us to count the number of views in a particular website in their webpage we are using sessions function in PHP. The sessions is a process that we want start if login or visit a particular website it is very similar to cookies that is being stored in our web browsers the only difference is cookies save the information in the history of our browser. Everytime the user open this web page it will increment the number it  is the same way is we just refresh our web page using using F5 from our keyboard.

I hope you will find my work useful to add functionality in your website that using PHP and MySQL as your main developmental language. If you have some questions regarding my work feel free to send me an email at jakerpomperada@yahoo.com and jakerpomperada@gmail.com.

People here in the Philippines who wish to contact me can reach me through my mobile numbers 09173084360 and 09993969756

Thank you very much and Happy Programming



Sample Output of Our Program


Program Listing

<html>
<title> Count Number of Views </title>
<body bgcolor="lightgreen">
<style>
div#first {
 position:absolute;
 right:820px;
 }
</style>
<br><br>
<font face="comic sans ms" size="3" color="blue">
<?php

session_start();

if(isset($_SESSION['visitor']))
     $_SESSION['visitor']+=1;
else
    $_SESSION['visitor']=1;
    echo"<h1> <div id='first'>Total Number of Views : ".$_SESSION['visitor']." </div></h1>";
echo "<br><br><br>";
echo "<h3> Written By: Jake R. Pomperada  </h3>";

echo "<font size='5'>Email Address : </font>";
echo "<br>";
echo "<h3>jakerpomperada@yahoo.com<br>";
echo "jakerpomperada@gmail.com </h3>";
?>
</font>
</body>
</html>


Monday, December 15, 2014

Product Cost Information System in PHP and MySQL

Yesterday I have a chance to visit a bookstore here in the Philippines as I glance their collection of books. One of the book gets my attention the title is Teach Yourself SQL in 24 Hours I bought the book immediately and started reading it. I find out what are the proper ways of using SQL statements in developing a database application I also understand the concepts of database normalization, relational database concepts and correct practices in designing and developing database driven applications.

One of the interesting topic that I read is all about calculated fields in SQL as far I understand calculated fields is far more important in a sense we do most computation using the fields in our table. It is a good practice not to store computed values on a field because if we change the value in other field we must also update the compute values in other field. What a waste of time to us and also be create erroneous results in our computation during the process because we have fixed the value store in our tables in the database.

In this article I will show you how to create a Product Cost Information System using PHP and MySQL as my programming language to demonstrated how to use properly the calculated fields in SQL and also the use the SUM() function in SQL correctly. What the program will do is very simple it will populate the records from our table and then perform a series of computation using calculated fields in SQL that I declare in our program and then display the results in our webpage. The program code itself is very simple and easy to understand I also use Twitter Bootstrap to improve the appearance of our result in our webpage.

I hope you will find my work useful in your programming projects and applications that uses PHP and MySQL as your main developmental language.If you have some questions you can send me an email at jakerpomperada@yahoo.com and jakerpomperada@gmail.com. Be one of my friends in www.facebook my address is https://www.facebook.com/jake.pomperada

People here in the Philippines who wish to contact me can reach me at my mobile numbers 09173084360 and 09993969756. My telephone number at home is +63 (034) 4335675.

Thank you very much and Happy Programming.





Sample Output of Our Program



Thursday, December 11, 2014

Object Oriented Programming in PHP

One of the most popular web scripting language now a days in PHP formerly known as Personal Home Page as a developer this programming language one of my favorite in building different types of application from website to business applications on wide variety on clients. In this article I would like to share with you my experience in writing object oriented programming in PHP.

At first learning how to program in object oriented is quiet focusing if you have trained in procedural programming also known as structured programming. In object oriented programming we start in declaring a class which acts as blue print of our object. In our class we declare public variable that we will use are attributes or properties of our object and then after that we create our methods also know as behavior that will carry out the actions of our class. In this example I wrote a a class math and then I declare two variables as public variable which means I can use this two variables outside of my class. In PHP 5 we use the keyword  __construct which allows us to pass parameters in our function solve as our method in our class. 

We later create an object that will inherit the attributes and methods of our class math I called our object product. As you observe I am also using a keyword $this this keyword in PHP act as a pointer to pointing the attributes we have in our class in this case our attributes are $val1 and $val2. After which I create a function to perform the multiplication of the two value that we pass in our function parameters. I called the function named solve() this function will not only perform multiplication operation but also display the computed result on our web page.

public function solve() {
$sum = ($this->val1 * $this->val2);
echo "The product of " .$this->val1. " and " 
    .$this->val2. " is " .$sum.".";
}


To create an object I used the follow commands   $product = new math(2,4);  and I also pass two values to be multiplied by our function. Take note we know that we create an object by using the new statement in PHP. After which we display the result in our web page by declaring the following statements below.

echo "<h1> <font color='green'>"; echo $product->solve(); echo "</h1> </font>";   


I hope this object oriented programming article that I wrote will give you some insights how to write object oriented program using PHP as your programming language. The benefits of learning object oriented programming in PHP is very significant you can make your code must easier to write, maintain and most important you can easy learn how to use PHP framework like Zend, CakePHP, CodeIgniter and Symfony because this frameworks are written in object oriented way.

If you have some questions about my works feel free to send me an email at jakerpomperada@yahoo.com and jakerpomperada@gmail.com.

People here in the Philippines who wish to contact me can reach me in my mobile numbers 09173084360 and 09993969756.


Sample Output of Our Program


Program Listing

<?php class math { public $val1, $val2; public function __construct($val1, $val2 ) 
{
$this->val1 = $val1; $this->val2 = $val2;
}
public function solve()
{ $sum = ($this->val1 * $this->val2);
echo "The product of " .$this->val1. " and " .$this->val2. " is " .$sum.".";
}
} $product = new math(2,4); echo "<h1> <font color='green'>"; echo $product->solve(); echo "</h1> </font>";
?>


Worker's Payroll System Using JavaScript

In this article I would like to share with you a program that is being developed and presented to me by my student we called this program workers payroll system written in Javascript. Before I publish this code I ask permission from them if they allow me to share their work to other people specially students that are new in Javascript and they yes to here is it. 

The following are my student contribute in writing this program JB Vie C. Busaing,  Maricar S. Conde, John Paul C. Divinagracia, Nylre Jel C. Ortega, Krisha Carey L. Ureta and  Arvel B. Vergara.

What this program will do is to compute the net pay of the employee in the company after all the deductions like tax, cash advances, pagibig and many other deductions. The deductions are based here in the Philippines.

I you have some questions regarding to our work you can send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

Thank you very much.





Sample Output of Our Program



Wednesday, December 10, 2014

Payroll System With Payslip Generator in C++

In this article I would like to share with you Payroll System with Payslip Generator that I wrote for a client before using C++ as my programming language what is good about this program it has a login system and a payroll system that will ask the user to enter the time in and time out of employee in a week of work and it generates reports by the end of the computation process. I hope you will find my work useful in your learning in C++ programming. 

I hope you will find my work useful and beneficial in your quest to learn object oriented programming in PHP and MySQL. If you have some questions about my works feel free to send me an email at jakerpomperada@yahoo.com and jakerpomperada@gmail.com.

People here in the Philippines who wish to contact me can reach me in my mobile numbers 09173084360 and 09993969756.

Thank you very much and Happy Programming.




Sample Output of Our Program

Program Listing

#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <conio.h>

using namespace std;
int some (string s){
    istringstream buffer(s);
    int some_int;
    buffer>>some_int;
    return some_int;
}

 int start();

main() {
     char pass2[20],user[20];
        char ch;
        // Admin Account
        int pass=0,user2=0;
        // User Account
        int pass1=0,user1=0;
        // Employee Account
        int pass3=0,user3=0;

     do {
         system("cls");
         cout << "\t \n =====================================";
         cout << "\t \n          PASSWORD SECURITY             ";
         cout << "\t \n =====================================";
         cout << "\n\n";
         cout << "\t Enter User Name     : ";
         cin >> pass2;
         cout << "\t Enter your Password : ";
         cin >> user;

        // Admin Account
        user2=strcmp(pass2,"admin");
        pass=strcmp(user,"admin");


       // User Account
        user1=strcmp(pass2,"user");
        pass1=strcmp(user,"user");


      // Employee Account
        user3=strcmp(pass2,"emp");
        pass3=strcmp(user,"emp");


         // For Admin Account

        if (pass==0 && user2==0) {
            cout << "\t \n Welcome to the System! Administrator";
            cout << "\n\n";
            start();
         }

         // For user account
        if (pass1==0 && user1==0) {
            cout << "\t \n Welcome to the System! Users";
            cout << "\n\n";
            start();
         }

         // For Employee account
        if (pass3==0 && user3==0) {
            cout << "\t \n Welcome to the System! Employees";
            cout << "\n\n";
            start();
         }


         else {
            cout << "\t \n Intruder Detected Try Again.";
            cout << "\n\n";
           system("pause");
        }

     } while (pass != 0 && user2!=0 || pass1!=0 && user1!=0
              || pass3==0 && user3==0);
       cout << "\n\n";
       system("pause");
}

int start() {

    ofstream output ("dtr.txt", ios::app);
    ofstream payslip ("payslip.txt", ios::app);
    ifstream read_file ("employee.txt");

    string id, display;
    string day[]= {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday"};
    string time_in[5], time_out[5];
    int time_in_conversion[5], time_out_conversion[5];
    int lunch_break = 1;
    int total_hrs = 0;
    float sss =0.00;
    float pilhealth= 0.00,widtax= 0.00,pagibig = 0.00;

    float net_income =0.00, gross_income=0.00;
    float  gsis = 0.00;
    float  rate_per_hr ;
    float tax = 0.00;
    int regular_time;
    float deduction = 0.00;

    cin.ignore();
    cout<<"Enter employee id: ";
    getline(cin, id);
   output << "\n";
   output << id << setw(3) << ":";
    while (!read_file.eof()){

        getline(read_file, display);

        if (id==display){

            cout<<"Welcome Employee No : "<<id << setw(10);
            getline (read_file, display);
            cout << "\n\n";
            cout<<setw(5) <<"Name          : " << setw(2) << display<<endl;
            payslip << "\n";
            payslip<<"Name        : "<<setw(2) <<display<<endl;
            getline (read_file, display);
            cout<<setw(8) <<"Position       : " << setw(2) << display<<endl;
            payslip<<"\nPosition    : "<<setw(2) <<display <<endl;
            getline (read_file, display);
            cout<<setw(10) <<"Department   : " << setw(2) << display<<endl;
            payslip<<"\nDepartment  : "<<setw(2)<< display<<endl;


            for (int a = 0; a<5 ; a++){
            cout << "\n";
          cout <<setw(5) << day[a];
            cout << "\n";
            cout<<"\tTime in: ";
            cin>>time_in[a];


            cout<<"\tTime out: ";
            cin>>time_out[a];

            output<<  day[a] << setw(8);
            output<<setw(6) << time_in[a] <<"AM"<< "-";
            output<<setw(4) <<time_out[a]<<"PM ";

            time_in_conversion[a] = some (time_in[a]);
            time_out_conversion[a] = some (time_out[a]);

            total_hrs +=((time_out_conversion[a] - time_in_conversion[a])-lunch_break);
            cout<<"\n\tTotal Hours: "<<total_hrs;
            }



cout<<"\n\t Total Worked Hours: "<<total_hrs;

cout<<"\n\t Enter rate per hour: ";
cin>>rate_per_hr;
cout<<"\n\t Enter SSS : ";
cin>>sss;
cout<<"\n\t Enter PagIBIG : ";
cin>>pagibig;
cout<<"\n\t Enter Philhealth: ";
cin>>pilhealth;
cout<<"\n\t Enter Withholding tax: ";
cin>>widtax;

    gross_income = total_hrs*rate_per_hr;
    net_income = gross_income - (pilhealth+widtax+pagibig+sss);
    deduction =(pilhealth+widtax+pagibig+sss);
cout << setprecision(2) << fixed;
cout<<"\nRate per hour       : Php "<<rate_per_hr;
cout<<"\nGross Income        : Php "  <<gross_income;
cout<<"\nTotal deductions    : Php " <<deduction;
cout<<"\nNet Income          : Php "    <<net_income;
payslip << setprecision(2) << fixed;
payslip<<"\n***********Deductions*************";
payslip<<"\n\nSSS            : Php "<<sss;
payslip<<"\nPhilhealth       : Php "<<pilhealth;
payslip<<"\nPagIBIG          : Php "<<pagibig;
payslip<<"\nWitholding tax   : Php "<<widtax;
payslip<<"\n__________________________________";
payslip<<"\n          total  : Php "<<deduction<<endl;
payslip<<"\n\nGross pay      : Php "<<gross_income;
payslip<<"\n Net Income     : Php " <<net_income;
payslip<<"\n\n";
payslip<<"\n*******************************";
output<<"\nTotal hours: "<<total_hrs;
output<<"\n";

output.close();
payslip.close();
    }


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



Product File Maintenance System in Visual Basic 6

This is another application that is being shared by my close friend Mr. Dave R. Marcellana he called this program Product File Maintenance System in Visual Basic 6 it is a module for his Point of Sale System that we previously published in our website. What is good about this program it will show how to create a basic CRUD application using Visual Basic 6. When we say CRUD it stands for create, retrieve, update and delete of records from our database in this case Dave using Microsoft Access to store all the information to the table. 

I hope you will find the work of  Dave useful in your learning how to create a database application using Microsoft Visual Basic 6 and Microsoft Access.

If you have some questions about our work feel free to send me an email at jakerpomperada@yahoo.com and jakerpomperada@gmail.com. I will be happy to read all your emails and suggestions how I can improve my works in programming.

People here in the Philippines who wish to contact me can reach me at my mobile numbers 09173084360 and 09993969756.

Thank you very much and Happy Productive Programming.


Sample Output of Our Program


Decimal To Binary Converter in C++

In this article I would like to share with you a sample program that I wrote in my spare time I called this program Decimal To Binary Converter 1.0 in C++. What does the program will to is to ask the user to enter any integer value and then it will convert into its binary equivalent. The code is very easy to understand and can be used in your programming assignments and activities in C++ programming. In this program I am using CodeBlocks as my text editor and Dev C++ as my C++ compiler. All this software is freely available over the Internet free to download and use.

If you have some questions about my work feel free to send me an email at jakerpomperada@yahoo.com and jakerpomperada@gmail.com. I will be happy to read all your emails and suggestions how I can improve my works in programming.

People here in the Philippines who wish to contact me can reach me at my mobile numbers 09173084360 and 09993969756.

Thank you very much and Happy Productive Programming.



Sample Output of Our Program

Program Listing

#include <iostream>
#include <stdlib.h>

using namespace std;

int main()
{
    char reply;
   do {
    int decimal_number=0, quotient=0;
    int binary_number[100],a=1,b=0;

    system("COLOR 9A");
    cout << "\n";
    cout << "\t================================\n";
    cout << "\tDecimal To Binary Converter 1.0\n";
    cout << "\t================================\n";
    cout << "\n";
    cout <<"Please Enter Any Decimal Number :=> ";
    cin >> decimal_number;

    quotient = decimal_number;

    while(quotient!=0){
        binary_number[a++]= quotient % 2;
        quotient = quotient / 2;
    }

    cout << "The Binary Value of Decimal Number is "
        <<decimal_number << ". => ";
    for(b = a-1 ; b>0; b--) {
    cout << binary_number[b];
    }
   cout << "\n\n";
  cout << "Do you want to continue y/n : ";
  cin >> reply;
   } while(reply=='Y' || reply=='y');
   cout << "\n\n";
   cout << "\t Thank You For Using This Software.";
   cout << "\n\n";
   system("pause");
}