Friday, April 10, 2015

Enter Keypress Using JQuery

In this sample code will show you how to use enter key press using  Jquery Javascript library framework our program will ask the user to enter their name and then the user press the enter key and then our program will greet our user.


 If you like my work please send me an email at  jakerpomperada@gmail.com and jakerpomperada@yahoo.com

People here in the Philippines who wish to contact me can call and text me in this number 09173084360. 

Thank you very much and God Bless.



Sample Program Output

Program Listing

<!-- Enter Keypress in JQuery              -->
<!-- April 10, 2015  Friday                     -->
<!-- Written By: Mr. Jake R. Pomperada, MAED-IT -->
<!-- JQuery Version                             -->
<html>
<title>Enter Keypress in JQuery </title>
<script src="jquery.js"></script>
<style>
h2 {
    font-family:arial;
};
</style>
<script>
 function clear_me() {
    document.getElementById("me").value="";
document.getElementById("display").value="";
display.innerHTML ="";
document.getElementById("me").focus();
}
</script>
<body bgcolor="lightgreen">
<br>
<h2 align="center"> Enter Keypress in JQuery
</h2>
<font face="arial" size='5'>
What is your name : ? &nbsp;
<input style="font-size:20px; font-family:arial; color:magenta" type="text" name="me"
  id="me" utofocus>
<br><br>
<button onclick="clear_me();" title="Click here to clear textbox.">
Clear Text Box</button> <br><br><br>
<div id="display" style="height: 50px; width: 100%;"></div>
</font>
<script>
var display=document.getElementById("display");

 $('#me').keypress(function(e) {
if (e.which == 13) {
      message = "Hello " + "<span style='color: red'>"+
 document.getElementById("me").value + "</span> "+ " How are you? Welcome To JQuery Programming " ;
      display.innerHTML= message;
 
}
});
</script>
</body>
</html>



Enter Keypress in JavaScript

 In this sample code will show you how to use enter key press using Javascript our program will ask the user to enter their name and then the user press the enter key and then our program will greet our user.


 If you like my work please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com

People here in the Philippines who wish to contact me can call and text me in this number 09173084360. 

Thank you very much and God Bless.



Sample Program Output


Program Listing


<!-- Enter Keypress in JavaScript                              -->
<!-- April 10, 2015  Friday                                            -->
<!-- Written By: Mr. Jake R. Pomperada, MAED-IT   -->
<!-- JavaScript                                                              -->
<html>
<style>
h2 {
    font-family:arial;
};
</style>
<script>
function get_name(e) {
       var display=document.getElementById("display");
if (e.keyCode==13){
  message = "Hello " + "<span style='color: red'>"+
  document.getElementById("me").value + "</span> "+ " How are you? " ;
       display.innerHTML= message;
  } 
       
}
 function clear_me() {
    document.getElementById("me").value="";
document.getElementById("display").value="";
display.innerHTML ="";
document.getElementById("me").focus();
}

</script>
<body bgcolor="lightgreen">
<br>
<h2 align="center"> Enter Keypress in Javascript
</h2>
<font face="arial" size='5'>
What is your name : ? &nbsp;
<input style="font-size:20px; font-family:arial; color:blue" type="text" name="me"
  id="me" onkeypress="get_name(event)" autofocus>
<br><br>
<button onclick="clear_me();" title="Click here to clear textbox.">
Clear Text Box</button> <br><br><br>
<div id="display" style="height: 50px; width: 100%;"></div>
</font>
</body>
</html>


Wednesday, April 8, 2015

Class in PHP

In this short code that I wrote it will show you how to create a class in PHP and how to create an object based on the class that we have written. This code will give you a first hand experience how to write a code in PHP using Object Ortiend Approach in programming.

If you like my work please send me an email at jakerpomperada@gmail.com andjakerpomperada@yahoo.com.

People here in the Philippines who wish to contact me can call and text me in this number 09173084360.

Thank you very much and God Bless.




Sample Program Output


Program Listing

<?php

class message {

 public $Name ="John Doe";
 public $Age = 56;
 public $Address = "Washington Street, USA";
 public $Work ="Janitor";
 }

  $info = new message;

 echo "<font size='5'>";
 echo "Name     : ".$info->Name."<br>";
 echo "Age      : ".$info->Age."<br>";
 echo "Address  : ".$info->Address."<br>";
 echo "Work     : ".$info->Work."<br>"; 
 echo "</font>";

 ?>

Number System Converter in Visual Basic .NET

In this article I would like to share with you a sample program that I wrote while I'm still learning how to program in Visual Basic .NET I called this program Number System Converter 1.0 in Visual Basic .NET.  What does our program do is very simple it will ask the user to enter a value in Octal and then it will convert in Decimal, Hexadecimal and Binary Number equivalent.

If you like my work please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

People here in the Philippines who wish to contact me can call and text me in this number 09173084360.

Thank you very much and God Bless.



Sample Program Output




Word Counter in JavaScript

Here is a sample program that I wrote will count the number of words in a given sentence by our user using JavaScript as our programming language. The code is very simple and easy to understand I intended my work for beginners that are new in JavaScript programming.

If you like my work please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

People here in the Philippines who wish to contract me through my mobile number can reach me in this number 09173084360.

Thank you very much and God Bless.





Program Listing

<html>
<title>Word Counter in Javascript</title>
<style>
body { 
  font-size:20px; 
  font-family:arial;
  color:blue;
  } 

input {
  display: table-cell;
}
   div.justified {
        display: flex;
        justify-content: center;
    }
</style>
<script language="JavaScript">
function count_words()
  {
  var words_count =document.getElementById("sentence").value.split(' ').length;;
  document.getElementById("word").value= words_count;
 }      
 
  
   function clear_me() {
    document.getElementById("sentence").value="";
document.getElementById("word").value="";
document.getElementById("sentence").focus();
}
  </script>
<body style='background-color:lightgreen'>
<div style='width:1100px;margin:auto'>
  <br> <h1 align="center">Words Counter in Javascript</h2>
  <div class="justified">
<textarea name="sentence"  id="sentence" cols="80" rows="5" autofocus></textarea>
<br /> </div>
 <br><center> <button onclick="count_words();" 
 title="Click here to find the number of words in a sentence.">
 Count Number of Words</button>
 <button onclick="clear_me();" title="Click here to clear text fields.">
Clear</button>  </center>
 <br> <br>
 <div class="justified"><label>  The number of words in a sentence is <input id="word"  size="5" readonly> . </label>   <br> </div>
  </body>
</html>


Lowercase and Digits Counter in PHP

In this article I would like to share a program that I wrote that will allows the user to count the number of occurrence of lowercase letters and digits in a given sentence using PHP as our programming language. What does the program will do is to ask the user to enter a word or a sentence and then our program will count how many times the lowercase letters and digits occurs in a given word or sentence.

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


Thank you very much and God Bless.




Program Listing

<html>
<title> Lowercase Letters and Digits Counter</title>
<style>
body { 
  font-size:20px; 
  font-family:arial;
  color:blue;
  } 
</style>
<?php
error_reporting(0);

$values = $_POST['value'];

// function to count the number of lowercase letters
// in a given word or sentence.

function lowercase_letters($string) {
   return strlen(preg_replace("/[^a-z]/","", $string));
}
// function to count the number of digits in a given
// word or sentence.

function count_digits($string) {
  return count(preg_grep('~^[0-9]$~', str_split($string)));
}
  
if(isset($_POST['check'])) {

  if ($values==" ") {
      echo "<script>";  
  echo "alert('It Cannot Be Empty!!! Please enter a number.');";
  echo "</script>";
  $values=" ";
  $results=" ";
     }

 if ($values != " ") {

   $results .=  "==== REPORT ==== ";
   $results .=  "<br><br>";
   $results .= "The sentence or the word is "
            ."<font color='RED'>".$values."</font>"."."
."<br><br>";
   $results .= "The number of capital letters is "
                ."<font color='RED'>".lowercase_letters($values)."</font> ".
" in a given word or sentence."."<br><br>";
$results .= "The number of digits is "
                ."<font color='RED'>".count_digits($values)."</font> ".
" in a given word or sentence.";
   }
 }
      
 
if(isset($_POST['clear'])) {
  $values=" "; 
  $results= " ";
  
}

?>
<body style='background-color:lightgreen'>
<div style='width:900px;margin:auto'>
  <br> <h1 align="center">Lowercase Letters and Digits Counter </h2>
  <br>
<form action="" method="post">
 Enter a Word or a Sentence : <input type="text" name="value"    value="<?php echo $values; ?>" autofocus  size=80/>
 <br><br>
   <input type="submit" name="check" value="Lowercase Letters and Digits Counter" 
  title="Click here to count the number of lowercase letters and digits in a given word or sentence."/>
  <input type="submit" name="clear" value="Clear" 
  title="Click here to clear text box and values on the screen"/>
</form>
<br>
<?php 
echo $results;
 ?>
  </body>
</html>

Tuesday, April 7, 2015

Perimeter and Area of a Square Solver in PHP


A simple program that I wrote in PHP to solve the perimeter and area of a square by providing the value of the side of the square by the user. 


If you have some questions please 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 at my mobile number 09173084360





Sample Program Output



Program Listing


<html>
<title> Perimeter and Area of a Square Solver </title>
<style>
body { 
  font-size:20px; 
  font-family:arial;
  color:blue;
  } 
</style>
<?php
error_reporting(0);

$values = $_POST['value'];

 // functions to find the perimeter and area of a square

 function perimeter_solve($variable) {
           return($variable * 4);
}

 function area_solve($variable) {
           return($variable * $variable);
}


if(isset($_POST['check'])) {

     if (ctype_alpha($values)) {
      echo "<script>";  
  echo "alert('PLEASE ENTER A NUMERIC VALUE.');";
  echo "</script>";
  $values="";
 }
 
else if(preg_match('#[^a-zA-Z0-9]#', $values)) {
      echo "<script>";  
  echo "alert('PLEASE ENTER A NUMERIC VALUE.');";
  echo "</script>";
        $values="";
      
}

    else  if ($values=="") {
      echo "<script>";  
  echo "alert('It Cannot Be Empty!!! Please enter a integer value.');";
  echo "</script>";
  $values="";
           }
else { 
      $title = "The value of the side of the square is ".$values." the equivalent in perimeter is " 
          .perimeter_solve($values)." . <br>";
$title .= "The value of the side of the square is  ".$values." the equivalent in area is" 
          .area_solve($values).".";
      
       }  
   }  

if(isset($_POST['clear'])) {
  $values=" "; 
  $title=" ";
  
}

?>
<body style='background-color:lightgreen'>
<div style='width:800px;margin:auto'>
  <br> <h1 align="center"> Perimeter and Area of a Square Solver</h2>
  <br>
<form action="" method="post">
 Enter the side value : <input type="text" name="value"    value="<?php echo $values; ?>" autofocus  size=20/>
   <input type="submit" name="check" value="Compute" 
  title="Click here to compute the perimeter and area of the square."/>
  <input type="submit" name="clear" value="Clear" 
  title="Click here to clear text box and values on the screen"/>
</form>
<br> 
<?php 
echo $title;
 ?>
  </body>
</html>

Demonstration of Cookies in PHP



In this article I would like to share with you about a cookie in PHP basically a cookie is a method we use in PHP to identify the user that visited or uses our website. It is a small file the is being send by our server to our user's computer. Every the the user computer send a request to our page with the use of a web browser, it will send a cookie also to the user via a web browser. The code is very simple and easy to understand.

If you have some questions please 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 at my mobile number 09173084360




Sample Program Output


Program Listing

<?php
$cookie_name = "visitors";
$cookie_value = "Jake Pomperada";
?>

<html>
<title> Demonstration of Cookies PHP</title>
<style>
body { 
  font-size:20px; 
  font-family:arial;
  color:blue;
  } 
</style>

<body>
<body style='background-color:lightgreen'>
<div style='width:800px;margin:auto'>
  <br> <h1 align="center">Demonstration of Cookies in PHP</h2>
  

<?php
if(isset($_COOKIE[$cookie_name])) {  
$last = $_COOKIE[$cookie_name];  
echo "Welcome back, " . $cookie_value . "! <br>
<br> You last visited this site is ". $last. ".";  
} else {  
echo "Welcome to our website , ". $cookie_value. "!";  
?>

</body>
</div>
</html>


Saturday, April 4, 2015

Search a Record Using Visual Basic 6 and MS Access

In this code I would like to show you how to search a record using Microsoft Visual Basic 6 as my programming language and Microsoft Access as my database. I wrote this code as one of the programming project of my client before. You will find the code is very easy to understand and use in your programming projects using Visual Basic 6.

Thank you very much and Happy Productive Programming. If you have some questions please 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 at my mobile number 09173084360.




Sample Program Output



Employees Commission System in Visual Basic 6

Here is a code that I wrote for a client in United Kingdom I called this program Employees Commission System written entirely in Microsoft Visual Basic 6 and Microsoft Access as my back end database. This program will save,navigate and compute the commission of the employees in a company.

Thank you very much and Happy Productive Programming.


If you have some questions please 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 at my mobile number 09173084360.





Sample Program Output


 

Prime Numbers in Visual Basic 6


One of the most fascinating inventions made by man is the computer. We use computers in our day to day activities such as in business, education, research, military applications, communications as well as entertainment. This computer becomes useful when there is software that runs on it. As we all know software is a collection of programs that makes our computer useful and interesting to work with.  There two classifications of software that we use in our computer system they are application software and system software. The first type of software is application software this type of software was designed to solve common problems that we encounter just like a word processing program like Microsoft Word we use this program to create and print our documents, computer games for instance is a good example of application software it was designed not only to entertain us but also it develops our thinking skills in making decisions and analysis of the situation. 

On the other hand system software was created to maintain the overall operation of our computer system examples of this is operating system that manages all the software and hardware components installed in our computer. Another example is your antivirus software which protects your computer against computer viruses that will damage our files and disable the normal operation of our computer in general.

In this article I will discuss about the program that I considered as application software by its nature I called this program Find the Prime Numbers.  Let me explain in the first place what is a prime number is  an number that is bigger than one and does not have a positive divisor other that one and itself.  We have learned the prime numbers during our elementary and high school days. Examples of prime numbers is  2,3,5,7,11,13,17,19, 23 and 29 for instance. In this program I will be using Visual Basic 6 as my programming language to illustrate of program Find Prime Number. I choose Visual Basic 6 because it is very easy to use and its ability to create sophisticated user interface compared to other programming language that you are the one who will write the statements for its design and layout stage. Having this advantage of Visual Basic 6 we can cut down big amount of our development time and we can focus on solving the problem on hand.

For our program the first thing that will do is to create the form and put a series of objects two command buttons, a list box where the list of prime number will be listed. The first command button is Find the Prime Number when the user click that button it will ask the user using a dialog box to enter the starting value of the number after the user give the initial values our program will ask the user to enter the last range or the maximum number which the generation of prime numbers will be stop.  When the user press the enter key the program will list the values of prime numbers from the given parameters earlier by our user.  Below is the command button cmdPrime for checking if the starting number and the end number by the user and then it will perform a series of computation to find the list of prime numbers. The result will be displayed in the list box adjacent to our command buttons.

Private Sub cmdPrime_Click()
    lstResults.Clear
    lblResults = "Results:"
    lngStart = InputBox("Enter the beginning number:", "Start Number")
    lngEnd = InputBox("Enter the ending number:", "End Number")
   
    lngStart = lngStart + 1
    Do Until lngStart = lngEnd
        If PrimeStatus(lngStart) = True Then
            lstResults.AddItem Str(lngStart)
            lngCount = lngCount + 1
        Else
         End If
        lngStart = lngStart + 1
    Loop
    lblResults = lblResults & " " & Str(lngCount)
    lngCount = 0
   
End Sub

This is the function that we have created to perform the computation and analysis of values of prime numbers in our program.

Function PrimeStatus(TestVal As Long) As Boolean
   Dim Lim As Integer
   PrimeStatus = True
   Lim = Sqr(TestVal)
   For I = 2 To Lim
      If TestVal Mod I = 0 Then
         PrimeStatus = False
         Exit For
      End If
        Next I
End Function
This is the general declaration of our variables it means we can use this variables anywhere in our program.
Public lngStart As Long
Public lngEnd As Long
Public lngCount As Long

Quit command button when the user click this button our program will be terminated and will return to our operating system.
Private Sub cmdExit_Click()
    End
End Sub

I just hope that you have learned something new about programming with this article Find the Prime Numbers using Visual Basic 6. If you have some comments, suggestions about this article feel free to email me I will be grad to answer your questions.

Thank you very much and Happy Productive Programming.


If you have some questions please 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 at my mobile number 09173084360





Sample Program Output



Word Count in Visual Basic 6

In  this simple article I would like to share with you a program that I wrote a long time ago in Microsoft Visual Basic 6 that will count the number of words in a given sentence I called this program word count program. The program is very simple and easy to understand it will give you some idea how to use visual basic 6 build in string functions to count the number of words in a given sentence by our user.


If you have some questions please 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 at my mobile number 09173084360





Sample Program Output