hostgator coupon code

Sabtu, 31 Maret 2012

Menu, Submenu and Timer in Delphi Programming Language

In my post this time I will share to you about menu, submenu and timer on Delphi Programming Language.



1.There is two types of menu, which main menu and pop-up menu.

Main menu is one of the components contained in Delphi palette. With a menu we can call, save, and run the program, remove program, etc. Menu helps us to run commands much easier. Delphi menu designer allow us to add a menu to the form. To create a main menu all we have to do is click the icon on the Delphi palette standard tab. Main menu usually located in the upper left corner of an application, such as file , insert, about, help, etc, that we usually see in almost every application.


pop up menu is a menu that appears when users right click on a form or on a component on Delphi




2. SubMenu

Submenu is an additional component that is used to save space for the additional options from the menu. Some applications have a
drop down menu  list that appears on the right side of a menu items.


Here's an example program using the menu:







The program above uses 2 forms, This is first form code list    :


unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Timer1: TTimer;
    Label1: TLabel;
    MainMenu1: TMainMenu;
    Menu1: TMenuItem;
    form21: TMenuItem;
    exit1: TMenuItem;
    color1: TMenuItem;
    Hijau1: TMenuItem;
    Biru1: TMenuItem;
    Merah1: TMenuItem;
    Default1: TMenuItem;
    procedure Timer1Timer(Sender: TObject);
    procedure form21Click(Sender: TObject);
    procedure exit1Click(Sender: TObject);
    procedure Hijau1Click(Sender: TObject);
    procedure Biru1Click(Sender: TObject);
    procedure Merah1Click(Sender: TObject);
    procedure Default1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses Unit2;

{$R *.dfm}

procedure TForm1.Timer1Timer(Sender: TObject);
begin
if label1.left=1 then label1.left:=50;
label1.left:=label1.left-1;

end;

procedure TForm1.form21Click(Sender: TObject);
begin
form1.Hide;
form2.show;

end;

procedure TForm1.exit1Click(Sender: TObject);
begin
application.terminate;
end;

procedure TForm1.Hijau1Click(Sender: TObject);
begin
label1.Font.Color:=clgreen;
end;

procedure TForm1.Biru1Click(Sender: TObject);
begin
label1.Font.Color:=clblue;
end;

procedure TForm1.Merah1Click(Sender: TObject);
begin
label1.font.Color:=clred;
end;

procedure TForm1.Default1Click(Sender: TObject);
begin
label1.font.color:=clblack;
end;

end.








This is the second form code list    :




unit Unit2;

interface

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

type
  TForm2 = class(TForm)
    Button1: TButton;
    Timer1: TTimer;
    Label1: TLabel;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

uses Unit1;

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);
begin
application.terminate;
end;

procedure TForm2.Timer1Timer(Sender: TObject);
begin
label1.caption:=formatdatetime('"time      : "hh:mm:ss',now)+chr(13)+formatdatetime('"date     : "dd/mm/yyyy',now);
end;

procedure TForm2.Button2Click(Sender: TObject);
begin
form2.Hide;
form1.show;
end;

end.







TO DOWNLOAD THE PROGRAM IN .exe CLICK HERE


If your antivirus detect this as virus just ignore it because it's save




Sabtu, 24 Maret 2012

Looping and Branching in Delphi

In this article I will share About Looping and Branching in Delphi 7.

Looping is repeating one or a set of commands to achieve certain conditions.  
Branching is one of the control structure that allows the selection of the command to be executed.

Looping Statements in Delphi 7  :
1. For To Do
This loop runs by using a counter variable that will be added automatically when a command has been completed. The general form of this loop  :
For counter: = value end of the initial value To Do
Begin
command;
command;
end;

2. For downto Do
The loop is the same as using a For loop with a To Do, but reduced the content of the counter (back / down).
The general form of this loop is:
For counter: = begin value downto end value Do
Begin
command;
command;
end;

3. Repeat Until  
The loop is working until the desired condition is reached. This loop can be used as a loop that uses a lot of conditions (multi-loop condition).
The general form:
repeat
command;
command;
Until conditions;

4. Do While
The loop is similar to Repeat Until but the checking prosses run before performing an iterative process. This loop runs as long as the value condition are true. If the condition has false value then the loop will stop.  
Do while general form  :
While conditions do
Begin
command;
command;
end;

Branching Statements in Delphi  :
1. If ... Then ... Else  
A command that serves to make decisions on some condition. Branching form is often used for conditions that are not too many.The selection of a conditional used only to perform an action when the condition of the command syntax are true. Bentuk conditional is:
if then
Begin
... {action-1}
end;

2. IF ... THEN ... ELSE: Selection of two cases
If  ... then ... else is generally used to perform simple bifurcation (between 2 or 3 branches). Or for a lot of branching, which is the prerequisite conditions involving more than one parameter. Conditional form of the command syntax is:
if then
Begin
... {action-1}
end
else
Begin
... {action}-2
end;

IF ... THEN ... ELSE: Selection of N cases
if then
Begin
... {action-1}
end
If then else
Begin
... {action}-2
end
else
Begin
... {action}-3
end;
 

Jumat, 16 Maret 2012

Delphi Programming Language

What is Delphi? Delphi is an object oriented programming (OOP) and an Integrated Development Environtment (IDE). Delphi Developed by Borland corporation which before was known as Inprise. Delphi actually is object oriented programming (OOP) version of Pascal. Pascal itself is a procedural programming language. So we can conlude that delphi syntax was adopted from pascal programming language.
Delphi is generally more widely used for desktop application development and enterprise-based database, but as an Integrated Development Environtmen (IDE) Delphi is also capable of various types software development projects. Delphi known as the one who brought RAD tool (Rapid Application Development).
When released in 1995 for 16-bit windows. Delphi 2, released a year later, it supports 32-bit Windows environments, and the version of c + +, and C + + Builder. In 2001 a Linux version known as Kylix available. With a new release every year, in 2002 the support for Linux (through Kylix and CLX component library) were added, and in 2003  .NET became supported by the release of 
Delphi.Net (Delphi 8).
 

The advantages of using Delphi: 
  • Large user community on Usenet and the web.
  • Can compile a single executable (portable applications), ease of distribution and minimize the problems associated with versioning.
  • Overwhelming support from a third party against the VCL (usually available the following source code) or other supporting tools (documentation, debugging tools).
  • Compiler optimization is quite fast.
  • Supports multiple platforms from the same source code.
  • To run the Embarcadero, Delphi can be run on the multiflatform windows, linux, android, IOS.

 
Disadvantages of using Delphi:
 
  • Partial single vendor lock-in (Borland can set the language standard, compatibility must be followed)
  • Access to the platform and third-party library header files need to be translated into the language pascal
  • Documentation on the platform and the accompanying techniques are hard to find in Pascal language (eg access to COM and Win32)





Delphi Program Example click HERE




Delphi Tutorial Click HERE











Source              :   www.wikipedia.org
                              www.delphi.com
                              www.embarcadero.com

Sabtu, 10 Maret 2012

Compile JAVA with Notepad or Notepad++

In the previous post I posted about Java programming language. JAVA can be compiled in 2 ways. The first way is to use IDE (Integrated Development Environtment) for example Netbeans. The second way is to use a text editor such as Notepad or Notepad + + and then the code will be compiled by using the commands in the Command Promt (CMD).

On this post I will share how to compile Java programs using a text editor. First we write java code in Notepad or Notepad + + and then save in any location with the same name as the class that was created, dont forget to save in .Java Extension. For example, save the name coba.java

After that go to the command prompt by clicking start, accesories, and then select the command prompt or by typing cmd in the run window. Type the command javac coba.java, and it will be  :






Why does this happen? This will happen when we put the java program outside the bin folder
of java. Then how to compile java using a text editor by write the command in cmd? Read this carefully         :
1. Right click on My Computer and click Properties and select Advanced System Settings
(win7)





2. In the System Properties click environtment variables tab, and so another window will pop up





 3. Edit the Path variable by clicking the edit command button on the variable path and enter
     the location of your java bin files.
     For example this is my java bin files location
   :      
     C: \ Program Files (x86) \ Java \ jdk1.6.0_10 \ bin;

4. After changing the path let's try again compiling via commandprompt. Suppose we write java code in notepad and we store it in mydocuments, and the file name is coba.java (the file name must has the same name as the class name).

5. The result will be like this
                                   :

 


To download notepad++ click HERE


To download my java program example click HERE 


The file is .txt format. Open, click save as, and save it in .java format (but don't change the file name)

Senin, 05 Maret 2012

JAVA Programming Language

Almost every gadgets that we use is the product of JAVA. Be it mobile phones, microwave, Android, Iphone, etc. Well on this occasion I will share what I know about the Java programming language.
 
 
As a programming language, Java can create all forms of application, desktop, web etc,  as well as other Programming Languages.
 

JAVA is an object-oriented programming language (OOP) and can run on various operating system platforms. The development of Java is not only focused on one operating system, but developed for a variety of operating systems.
Applications with Java technology in general can run on all machines that have the Java Runtime Environment (JRE).
 

There are two main components of the Deployment Environment. The first is the JRE, J2SDK contained in the package, containing classes for all the Java technology package that includes a base class of JAVA, GUI components etc. Almost all af commercial Web Browsers provide interpreter and runtime environment of Java technology.
 

Features found in Java Programming Language:
 

  • Java Virtual Machine (JVM)JVM is an virtual machine that works with applications like on a real machine. JVM provides a hardware specifications and platform where the Java compilation occurs. This specification is the factor that makes JAVA-based applications become free from any platform because the compilation process completed by the JVM.
     
  • GarbageCollection                                                                                                This facility reduces the burden of memory management because the program doesn't need to remove unused object manually.                  



 

JAVA is a programming language that is widely used by many Programmers in the world today. JAVA Adopt the syntax from C + + Programming Language.
 

There are two ways to compile and run (run) JAVA program. The firstusing the console and text editor. While the second way is byusing the NetBeans Integrated Development Environment that isor the so-called IDE.
 

IDE is some tools that are integrated into the programming software applications that support GUI, code writing, compiler and debugger.

NetBeans 7.0.1

 
 
To download Java tutorial for beginner click here

 
 
 
 
 
 
Sources: Naughton, Patrick, Java Handbook
                Gary Cornell dan Cay S.Horstmann, Core Java
                www.wikipedia.org

                www.java.com