Saturday, September 17, 2016

CRUD With Picture Upload in PHP and MySQL using BootStrap

This application we developed with my best friend, programming buddy and a fellow software engineer Mr. Dave Marcellana will allow the user to add, edit, view, delete and upload picture of the person in the database. We are here using Bootstrap to make our webpage more attractive and presentable. In this application we include the complete source code and the SQL dumb file. You can user our work in your programming project FREE of charge.  Thank you very much.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
 
My mobile number here in the Philippines is 09173084360
.










Sample Program Output






Friday, September 16, 2016

Consonants and Vowels Counter in Delphi

A simple program that I wrote in Delphi as my main programming language that will ask the user to give a string, word, sentence or phrase and then our program will count the number of consonants and vowels. The code is very short and very easy to understand. I hope you will like my work  and able to share my knowledge in Delphi programming.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
 
My mobile number here in the Philippines is 09173084360
.







Sample Program Output


Program Listing

unit vowels_consonants_counter;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    Button1: TButton;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Button2: TButton;
    Label6: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

var
    St : String[255];
    Location1,Location2 : integer;
    Count_Vowels, Count_Consonants : integer;

    Valid_Vowels     : Set of Char;
    Valid_Consonants : Set of Char;


procedure TForm1.Button1Click(Sender: TObject);
begin
    Count_Vowels     := 0;
    Count_Consonants := 0;
    st := edit1.text;
    Valid_Vowels := ['A', 'E', 'I', 'O', 'U', 'a', 'e', 'i', 'o', 'u'];

    Valid_Consonants := ['B', 'C', 'D','F', 'G', 'H', 'J', 'K',
                          'L', 'M', 'N', 'P', 'Q','R', 'S', 'T',
                          'V','W','X','Y','Z','b','c','d','f',
                          'g','h','j','k','l','m','n','p','q',
                          'r','s','t','v','w','x','y','z'];


     For Location1 := 1 to Length(st) Do
       If St[Location1] IN Valid_Vowels Then
             Count_Vowels := SUCC(Count_Vowels);
             label3.caption := 'The Number of Vowels is '
             + inttostr(Count_Vowels)+ '.';

     For Location2 := 1 to Length(st) Do
           If St[Location2] IN Valid_Consonants Then
             Count_Consonants := SUCC(Count_Consonants);
             label6.caption := 'The Number of Consonants is '
             + inttostr(Count_Consonants)+ '.';


end;

procedure TForm1.Button2Click(Sender: TObject);
begin
edit1.text := '';
label3.caption :='';
label6.caption :='';
edit1.setfocus;
end;

end.



Count Vowels in Delphi

A simple program that I wrote using Delphi as my programming language that will ask the user to give a string, phrase, sentence or word and then our program will count the number of vowels from the given word, string, phrase or sentence from the user. The code is very simple, short and easy to understand.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
 
My mobile number here in the Philippines is 09173084360
.





Program Sample Output



Program Listing

unit vowels_remove;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    Button1: TButton;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

var
   St, New: String[255];
    Location: integer;
    Count: integer;
    Valid_Ch: Set of Char;


procedure TForm1.Button1Click(Sender: TObject);
begin
    Count := 0;
    st := edit1.text;
    Valid_Ch := ['A', 'E', 'I', 'O', 'U', 'a', 'e', 'i', 'o', 'u'];
     For Location := 1 to Length(st) Do
       If St[Location] IN Valid_Ch Then Count := SUCC(Count);
             label3.caption := 'The Number of Vowels is ' + inttostr(count)+ '.';

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
edit1.text := '';
label3.caption :='';
edit1.setfocus;
end;

end.





Tuesday, September 13, 2016

Palindrome in Delphi

A simple program that I wrote using Delphi as my programming language that will ask the user to give a string or word and then our program will check if the given word is a Palindrome or Not. A word becomes a palindrome with you read it forward and backward the spelling of the word is still the same. I hope you will find my work useful in learning Delphi programming.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
 
My mobile number here in the Philippines is 09173084360
.





Sample Program Output


Program Listing


unit palin;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    Button1: TButton;
    Label3: TLabel;
    Button2: TButton;
    Label4: TLabel;
    Label5: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}
function IsPalindrome(const s: string): boolean;
var
  i, j: integer;
begin
  Result := false;
  j := Length(s);
  for i := 1 to Length(s) div 2 do begin
    if s[i] <> s[j] then
      Exit;
    Dec(j);
  end;
  Result := true;
end;

 var given_string : string;

procedure TForm1.Button1Click(Sender: TObject);
begin
    given_string := AnsiLowerCase(edit1.text);

    if   IsPalindrome(given_string) then
    begin
    label3.caption := 'The given string ' + AnsiUpperCase(edit1.text)
     + ' is a Palindrome.'
    end
    else
       begin
    label3.caption :=  'The given string ' + AnsiUpperCase(edit1.text)
     + ' is Not a Palindrome.'
    end
    
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
edit1.text     :='';
label3.caption :='';
edit1.setfocus;
end;

end.











Power of a Number in Delphi

Here is a sample program that I wrote in Delphi as my programming language that will ask the user to give the base and exponent value and then our program will compute the power of the number. I hope you will find my work useful I used the power function written by Jack Lyle in this program. The version of Delphi I used in this sample program is Delphi 4 Professional Edition.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
 
My mobile number here in the Philippines is 09173084360
.





Sample Program Output


Program Listing

power.pas

unit power;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    Label3: TLabel;
    Edit2: TEdit;
    Button1: TButton;
    Label4: TLabel;
    Button2: TButton;
    Label5: TLabel;
    Label6: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

{** A power function from Jack Lyle. Said to be more powerful than the
    Pow function that comes with Delphi. }
function Power2(Base, Exponent : Double) : Double;
{ raises the base to the exponent }
  CONST
    cTiny = 1e-15;

  VAR
    Power : Double; { Value before sign correction }

  BEGIN
    Power := 0;
    { Deal with the near zero special cases }
    IF (Abs(Base) < cTiny) THEN BEGIN
      Base := 0.0;
    END; { IF }
    IF (Abs(Exponent) < cTiny) THEN BEGIN
      Exponent := 0.0;
    END; { IF }

    { Deal with the exactly zero cases }
    IF (Base = 0.0) THEN BEGIN
      Power := 0.0;
    END; { IF }
    IF (Exponent = 0.0) THEN BEGIN
      Power := 1.0;
    END; { IF }

    { Cover everything else }
    IF ((Base < 0) AND (Exponent < 0)) THEN
        Power := 1/Exp(-Exponent*Ln(-Base))
    ELSE IF ((Base < 0) AND (Exponent >= 0)) THEN
        Power := Exp(Exponent*Ln(-Base))
    ELSE IF ((Base > 0) AND (Exponent < 0)) THEN
        Power := 1/Exp(-Exponent*Ln(Base))
    ELSE IF ((Base > 0) AND (Exponent >= 0)) THEN
        Power := Exp(Exponent*Ln(Base));

    { Correct the sign }
    IF ((Base < 0) AND (Frac(Exponent/2.0) <> 0.0)) THEN
      Result := -Power
    ELSE
      Result := Power;
  END; { FUNCTION Pow }

var base,exponent: integer;
var solve : double;

procedure TForm1.Button1Click(Sender: TObject);
begin
   base      := strtoint(Edit1.Text);
   exponent  := strtoint(Edit2.Text);
   solve     :=   Power2(base,exponent);

  label4.caption := 'The result is ' + floattostr(solve)+'.';

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
edit1.text     :='';
edit2.text     :='';
label4.caption := '';
edit1.setfocus;

end;

end.










Sunday, September 11, 2016

Prime Number Checker in Delphi

A program that I wrote using Delphi to accept a number from the user and then our program will check and determine if the given number is a Prime Number or Not.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
 
My mobile number here in the Philippines is 09173084360
.





Sample Program Output


Program Listing

unit prime;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    Button1: TButton;
    Label3: TLabel;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}


function ISPrime(const vlNumber: Integer): Boolean;
var
X: Integer;
vlPrime: Boolean;
begin
X := 2;
vlPrime := True;
While (X < vlNumber) and vlPrime do begin
vlPrime := ((vlNumber mod X) <> 0);
Inc(X);
end;
ISPrime := vlPrime;
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
      if edit1.text ='' then
      begin
     ShowMessage('Emtpy not allow');
        Edit1.text :='';
        Label3.Caption := '';
        Edit1.SetFocus;
   end
       else if    ISPrime( strtoint(Edit1.Text))  then
     Begin

           Label3.Caption:= 'The number  ' + Edit1.Text
      + ' is a Prime Number'+'.'
      end
      else
      
           Label3.Caption:= 'The number  ' + Edit1.Text
      + ' is Not a Prime Number'+'.'

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Edit1.text :='';
  Label3.Caption := '';
  Edit1.SetFocus;
end;

end.

Odd and Even Number Checker in C#

A simple program that I wrote using C# to check if the given number by our user is Odd or Even numbers.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.





Sample Program Output


Program Listing

// Odd and Even Number Checker in C#
// September 11, 2016 Sunday
// Written By: Mr. Jake R. Pomperada, MAED-IT

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        public static bool IsEven(int value)
        {
            return value % 2 == 0;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int number = 0;

            if (!int.TryParse(textBox1.Text, out number))
            {
                MessageBox.Show("I need just a number in the textbox.");
                textBox1.Text = "";
                label2.Text = "";
                textBox1.Focus();
            }

        else if (IsEven(number))
          {
              label2.Text = "The Number " + number + " is an Even Number.";

          }
          else
          {
              label2.Text = "The Number " + number+ " is an Odd Number.";
          }

        }

        private void button2_Click(object sender, EventArgs e)
        {
            textBox1.Text = "";
            label2.Text = "";
            textBox1.Focus();
        }
    }
}