Sunday, November 27, 2016

Create Simple Calculator using JAVA GUI

Filled under:

Here I give you a simple program to create Calculator using Java GUI. Please use this website as a reference link if you want to copy and paste this program.
If any question, don't be hesitate to leave a comment or contact my email.



package week09;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.LineBorder;

/**@author Novida Wayan Sari (1606954930)
 * @version 20161127 07:35PM
 * This class is Calculator class which is used to count a simple mathematics operation
 * such as plus, minus, multiply and divide.
 * This application is created to complete weekly task of Dasar-Dasar Pemrograman lecturing subject.
 * This application uses JPanel as for the main component of GUI
 * */

public class Calculator extends JPanel implements ActionListener {
    private static final int WIDTH = 420; //constant of frame width
    private static final int HEIGHT = 252; //constant of frame height
    private JMenuBar menuBar; //Menu Bar (File, Help) <-- I do not have any idea to fill up the content
    private JMenu fileMenu, helpMenu; //Referring Menu Bar, the content of menu bar
   
    //mainPanel is a JPanel contains of main components except Menu Bar
    //bottomPanel is a JPanel container of angkaPanel and operatorPanel
    //angkaPanel is a JPanel container of all number button and "+" and "-" [Grid Layout]
    //operatolPanel is a JPanel container of all operators button except "+" and "-" [Grid Layout]
    private JPanel mainPanel, bottomPanel, angkaPanel, operatorPanel;
    //-------------------------------------------------------------------------------------------------
    private JButton[] btnAngka; //Array of number button {"0","1","2","3","4","5","6","7","8","9"}
    private JButton[] btnControl; //Arrays of control button {"Backspace","C"}
    private JButton[] btnOperator; //Array of operator button {"+","-","/","*","="}
    private JTextField input; //Text field of input
    private Color bckColor, mainColor, inputColor, textColor; //Colors used to make background, foreground color in this application
    private float numb1 = 0; //variable which is used to save temporary value inputed by user
    private String oldOperator = ""; //variable which is used to save temporary operator inputed by user
    private boolean status = false; //the status to show if the operation is end
   
    /*constructor
     * */
    public Calculator(){
        this.bckColor = new Color(205,92,92); //Background Color
        this.mainColor = new Color(128,0,0); //Button Color
        this.inputColor = new Color(255,182,193); //Textfield background color
        this.textColor = new Color(255,182,193); //Text of text field color
       
        /*Main Panel uses Flow Layout which contains of Menu Bar and Main Panel*/
        super.setLayout(new FlowLayout());
        super.setPreferredSize(new Dimension(this.WIDTH, this.HEIGHT));
        super.setBackground(bckColor);
        super.setForeground(Color.WHITE);
       
        /*----------------- Menu Bar ------------------------------------------------*/
        this.menuBar = new JMenuBar();
        this.menuBar.setPreferredSize(new Dimension(this.WIDTH-20, 30));
        this.menuBar.setLocation(10, 0);
        this.menuBar.setBackground(bckColor);
        this.menuBar.setForeground(Color.white);
        this.fileMenu = new JMenu("File");
        this.helpMenu = new JMenu("Help");
        this.menuBar.add(fileMenu);
        this.menuBar.add(helpMenu);
        /*----------------- End of Menu Bar -----------------------------------------*/
       
        /*----------------- Input -----------------------------------------------------------------------------*/
        this.input = new JTextField();
        this.input.setPreferredSize(new Dimension(this.WIDTH-20, 30));
        this.input.setBackground(inputColor);
        this.input.setForeground(bckColor);
        this.input.setHorizontalAlignment(JLabel.RIGHT);
        this.input.setBorder(new LineBorder(bckColor));
        this.input.setBorder(BorderFactory.createCompoundBorder(this.input.getBorder(), BorderFactory.createEmptyBorder(5, 5, 5, 5)));
        this.input.setFont(new Font(this.input.getFont().getName(),Font.BOLD,this.input.getFont().getSize()));
        this.input.setEditable(false);
        this.input.setText("0");
        /*---------------- End of Input-------------------------------------------------------------------------*/
       
        /*---------------- Number Button -----------------------------------------------------------*/
        this.btnAngka = new JButton[10];
        this.btnControl = new JButton[2];
        this.btnOperator = new JButton[6];
       
        int colNum = 4;
        for(int i=0;i<10;i++){
            this.btnAngka[i] = new JButton(""+i);
            this.btnAngka[i].setPreferredSize(new Dimension((this.WIDTH-20)/colNum,30));
            this.btnAngka[i].setBackground(mainColor);
            this.btnAngka[i].setForeground(textColor);
            this.btnAngka[i].setBorder(new LineBorder(bckColor));
            this.btnAngka[i].addActionListener(this);
        }
        /*--------------- End of Number Button ----------------------------------------------------*/
       
        /*--------------- Control Button ----------------------------------------------------------*/
        this.btnControl[0] = new JButton("Backspace");
        this.btnControl[1] = new JButton("C");
       
        for(int i=0;i<2;i++){
            this.btnControl[i].setPreferredSize(new Dimension((this.WIDTH-20)/colNum,30));
            this.btnControl[i].setBackground(mainColor);
            this.btnControl[i].setForeground(textColor);
            this.btnControl[i].setBorder(new LineBorder(bckColor));
            this.btnControl[i].addActionListener(this);
        }
        /*--------------- End of Control Button ---------------------------------------------------*/
       
        /*--------------- Operator Button ---------------------------------------------------------*/
        this.btnOperator[0] = new JButton("+");
        this.btnOperator[1] = new JButton("-");
        this.btnOperator[2] = new JButton("/");
        this.btnOperator[3] = new JButton("*");
        this.btnOperator[4] = new JButton(".");
        this.btnOperator[5] = new JButton("=");
       
        for(int i=0;i<6;i++){
            this.btnOperator[i].setPreferredSize(new Dimension((this.WIDTH-20)/colNum,30));
            this.btnOperator[i].setBackground(mainColor);
            this.btnOperator[i].setForeground(textColor);
            this.btnOperator[i].setBorder(new LineBorder(bckColor));
            this.btnOperator[i].addActionListener(this);
        }
        /*-------------- End of Operator Button --------------------------------------------------*/
       
        //------------ BACKSPACE BUTTON -----------------------------------------------------------
        this.btnControl[0].setPreferredSize(new Dimension((2*(this.WIDTH-20))/colNum,30));
        this.btnControl[0].setLocation(10,70);
        this.btnControl[0].setBackground(mainColor);
        this.btnControl[0].setForeground(textColor);
        this.btnControl[0].setBorder(new LineBorder(bckColor));
        //------------ END OF BACKSPACE -----------------------------------------------------------
       
        //------------ C BUTTON -----------------------------------------------------------
        this.btnControl[1].setPreferredSize(new Dimension((this.WIDTH-20)/colNum,30));
        this.btnControl[1].setBackground(mainColor);
        this.btnControl[1].setForeground(textColor);
        this.btnControl[1].setBorder(new LineBorder(bckColor));
        //------------ END OF C BUTTON -----------------------------------------------------------
       
        /*------------ Bottom Panel -------------------------------------------------------------*/
        this.bottomPanel = new JPanel();
        this.bottomPanel.setPreferredSize(new Dimension(this.WIDTH-20,120));
        this.bottomPanel.setLayout(new BorderLayout());
        /*------------ of Bottom Panel ----------------------------------------------------------*/
       
        /*------------ Panel of number button -----------------------------------------------------*/
        this.angkaPanel = new JPanel();
        this.angkaPanel.setPreferredSize(new Dimension((3*(this.WIDTH-20))/4,120));
        this.angkaPanel.setLayout(new GridLayout(4,3));
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                this.angkaPanel.add(this.btnAngka[(2-i)*3+1+j]);
            }
        }
   
        this.angkaPanel.add(this.btnOperator[0]);
        this.angkaPanel.add(this.btnAngka[0]);
        this.angkaPanel.add(this.btnOperator[1]);
        /*------------ End of Panel of number button ---------------------------------------------------*/
       
        this.bottomPanel.add(this.angkaPanel, BorderLayout.WEST);
       
        this.operatorPanel = new JPanel();
        this.operatorPanel.setPreferredSize(new Dimension((this.WIDTH-20)/4,120));
        this.operatorPanel.setLayout(new GridLayout(4,1));
       
        for(int i=0;i<4;i++){
            this.operatorPanel.add(this.btnOperator[i+2]);
        }
       
        this.bottomPanel.add(this.operatorPanel, BorderLayout.EAST);
       
        /*------------ insert all components to main Panel and add it to this class ---------------------*/
        this.mainPanel = new JPanel();
        this.mainPanel.setLayout(new BorderLayout());
        this.mainPanel.setBackground(bckColor);
            /*---------------------- Main Panel uses Border Layout ------------*/
        this.mainPanel.add(this.input, BorderLayout.NORTH);
        this.mainPanel.add(this.btnControl[0], BorderLayout.WEST);
        this.mainPanel.add(this.btnControl[1], BorderLayout.EAST);
        this.mainPanel.add(this.bottomPanel, BorderLayout.SOUTH);
            /*-----------------------------------------------------------------*/
        super.add(menuBar);
        super.add(mainPanel);
        /*-----------------------------------------------------------------------------------------------*/
    }
   
   
    @Override
    public void actionPerformed(ActionEvent evt) {
        // TODO Auto-generated method stub
        if(evt.getSource() instanceof JButton){
            String btnText = ((JButton)evt.getSource()).getText();
            String pattern = "[0-9]|[.]";
            if(btnText == "Backspace"){
                /*If the button pressed is backspace, then it will erase the last digit of shown inputed number*/
                if(!this.input.getText().equals("")){
                    /*if there is digit in the last, then system should check if it is not zero (integer or decimal)*/
                    if(this.input.getText().equals("0.")){
                        this.input.setText("0");
                    }else{
                        /*if there is digit in the last, then system should check if previous digit is exist*/
                        if(this.input.getText().substring(0, this.input.getText().length()-1).equals("")){
                            this.input.setText("0");
                        }else{
                            this.input.setText(this.input.getText().substring(0, this.input.getText().length()-1));
                        }
                    }
                }
                this.status = false; //it shows that there is no temporary operation, backspace doesn't make any calculation process
            }else if(btnText == "C"){
                /*C will clear all shown number and change it into zero ------------------
                 * it also will clean up the history of number and operator inputed by the user
                 * */
                this.input.setText("0");
                this.numb1 = 0;
                this.oldOperator = "";
                this.status = false;
            }else if(btnText.matches(pattern)){
                if(btnText.equals(".") && this.input.getText().equals("0")){
                    /*If only zero shown in screen, and the user presses point to input decimal number -------------*/
                    this.input.setText("0.");
                }else{
                    if(this.status == false){
                        if(this.input.getText().equals("0")){
                            /*If only zero show in screen, and the user presses any number, the zero in the first character shouldn't be shown*/
                            this.input.setText(btnText);
                        }else{
                            /*If the first number isn't zero, then the system only append pressed number*/
                            this.input.setText(this.input.getText()+btnText);
                        }
                    }else{
                        this.input.setText(btnText);
                    }
                }
               
                this.status = false;
            }else{
                try{
                    /*Every single time the user presses operator button, then the system should do calculation based on
                     *history of number and operator user pressed
                     **/
                    float result = this.count();
                    if(result == Math.floor(result)){
                        /*If the result of calculation can be figured out into integer form, then the system prioritize it first */
                        this.input.setText(""+(int)result);
                    }else{
                        this.input.setText(""+result);
                    }
                    this.status = true;
                }catch(NumberFormatException e){
                    JOptionPane.showMessageDialog(null, "There was an error occured. Please restart the application and then try again!");
                }
               
                if(btnText.equals("=")){
                    /*= button will shows the result and erase the history of number and operator inputed by the user such C button does */
                    this.oldOperator = "";
                    this.numb1 = 0;
                }else{
                    /*The system saves the operator as temporary operator to be executed in next operator pressed*/
                    this.oldOperator = btnText;
                }
            }
        }
    }
   
    public float count(){
        switch(this.oldOperator){
            case "+":this.numb1=this.numb1+Float.valueOf((this.input.getText()));break;
            case "-":this.numb1=this.numb1-Float.valueOf((this.input.getText()));break;
            case "/":this.numb1=this.numb1/Float.valueOf((this.input.getText()));break;
            case "*":this.numb1=this.numb1*Float.valueOf((this.input.getText()));break;
            case "":this.numb1=Float.valueOf((this.input.getText()));break;
        }
        return this.numb1;
    }
   
    public static void main(String[] arg){
        JFrame frame = new JFrame("Calculator");
        frame.setSize(Calculator.WIDTH, Calculator.HEIGHT);
        frame.setLocation(150, 150);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       
        Calculator calc = new Calculator();
        frame.add(calc);
        frame.setVisible(true);
    }

}

Posted By Novida10:33 PM

Tuesday, November 15, 2016

How to install Eclipse in Ubuntu

Filled under:

Hallo, guys!
it's been long time I didn't update this blog and here I will share you how to install Eclipse using Ubuntu. This is my first experience in using Operating System except Windows. We all know well that to install application in windows is not a big issue, since the user can easily install it by hit 'next' or 'OK' button. Haha.

Let's download eclipse installer package in eclipse website. In this case, please use tar.gz eclipse installer file.

  1. go to the folder in which the tar.gz file is stored, in this case you have to go to Downloads folder cd Downloads
  2. lets unzip tar file using tar -zxvf [eclipse file name]
  3. Extract the file and copy to /opt folder sudo mv [extracted eclipse file] /opt
  4. Create desktop file and install it gedit eclipse.desktop
  5. Copy the following eclipse dekstop configuration file:
    [Desktop Entry]
    Name=Eclipse 
    Type=Application
    Exec=env UBUNTU_MENUPROXY=0 eclipse44
    Terminal=false
    Icon=eclipse
    Comment=Integrated Development Environment
    NoDisplay=false
    Categories=Development;IDE;
    Name[en]=Eclipse
    
     

Posted By Novida5:57 PM

Tuesday, September 6, 2016

BACK UP AND RESTORE DATABASE USING COMMAND LINE IN PHP SCRIPT

Filled under:

1. BACK UP DATABASE
This line bellow is used to back up database existing in MySQL database engine. This standart coding is using XAMPP Server and running in Windows Operating System. Before executing this line in browser, you have to try it in the Windows Command Prompt with your own system privileges.
a. Go to cmd.exe as an Administrator and run this command line:
C:\xampp\mysql\bin>mysqldump –h[hostname] –u[username] –p[password] [databasename] > [database back up file].[extension]
This is the example of the real code:
C:\ xampp\mysql\bin\mysqldump -u root spisy_kpe > spisy_kpe.sql
Never use –p if you don’t use password to encrypt the database. The above example is not using password, so there is no –p command.
b. Executing the command line with PHP Script:
Try to make program with php extension saved in the folder  in the htdocs and type this code bellow:
<?php
$command = "c:/xampp/mysql/bin/mysqldump -u root spisy_kpe > spisy_kpe3.sql";
exec($command);
echo "finished to backup database";
?>

Run the script using browser and find the backup file in the folder used to save this script program file.
2. CREATE DATABASE
a. Go to cmd.exe as an Administrator and run this command line:
C:\xampp\mysql\bin>mysql –h[hostname] –u[username] –p[password] –e “create database spisy;”

This is the example of the real code:
C:\ xampp\mysql\bin\mysql –h localhost -u root –e “create database spisy;”
Never use –p if you don’t use password to encrypt the database. The above example is not using password, so there is no –p command.
b. Executing the command line with PHP Script:
Try to make program with php extension saved in the folder  in the htdocs and type this code bellow:
<?php
$command = "c:/xampp/mysql/bin/mysql –h localhost -u root -e "create database spisy;";
exec($command);
echo "finished to create database";
?>

Try to open phpmyadmin through the browser and look at the database collection. The database you created will exist there.
3. RESTORE DATABASE
a. Go to cmd.exe as an Administrator and run this command line:
C:\xampp\mysql\bin>mysql –h [hostname] -u root –p [password] [restored database name] < [database file name].[extension]”

This is the example of the real code:
C:\xampp\mysql\bin>mysql –h localhost -u root spisy < spisy-kpe3.sql”
Never use –p if you don’t use password to encrypt the database. The above example is not using password, so there is no –p command.
b. Executing the command line with PHP Script:
Try to make program with php extension saved in the folder  in the htdocs and type this code bellow:
<?php
$command = "c:/xampp/mysql/bin/mysql –h localhost -u root spisy < spisy-kpe3.sql";
exec($command);
echo "finished to restore database";
?>

4. MERGING THE PROGRAM
Now, we can use all of program to back up, create and restore database in same time. The program look like bellow:
<?php
$command = "c:/xampp/mysql/bin/mysqldump -u root spisy-kpe > spisy-kpe3.sql";

exec($command);

echo "finished to backup database";

exec('c:/xampp/mysql/bin/mysql -u root -e "create database spisy;"');

exec('c:/xampp/mysql/bin/mysql -u root spisy < spisy-kpe3.sql');

echo "finished to restore database";
exec(exit);
?>

Posted By Novida2:36 PM

BACK UP AND RESTORE DATABASE USING COMMAND LINE IN PHP SCRIPT

Filled under:

1. BACK UP DATABASE
This line bellow is used to back up database existing in MySQL database engine. This standart coding is using XAMPP Server and running in Windows Operating System. Before executing this line in browser, you have to try it in the Windows Command Prompt with your own system privileges.
a. Go to cmd.exe as an Administrator and run this command line:
C:\xampp\mysql\bin>mysqldump –h[hostname] –u[username] –p[password] [databasename] > [database back up file].[extension]
This is the example of the real code:
C:\ xampp\mysql\bin\mysqldump -u root spisy_kpe > spisy_kpe.sql
Never use –p if you don’t use password to encrypt the database. The above example is not using password, so there is no –p command.
b. Executing the command line with PHP Script:
Try to make program with php extension saved in the folder  in the htdocs and type this code bellow:
<?php
$command = "c:/xampp/mysql/bin/mysqldump -u root spisy_kpe > spisy_kpe3.sql";
exec($command);
echo "finished to backup database";
?>

Run the script using browser and find the backup file in the folder used to save this script program file.
2. CREATE DATABASE
a. Go to cmd.exe as an Administrator and run this command line:
C:\xampp\mysql\bin>mysql –h[hostname] –u[username] –p[password] –e “create database spisy;”

This is the example of the real code:
C:\ xampp\mysql\bin\mysql –h localhost -u root –e “create database spisy;”
Never use –p if you don’t use password to encrypt the database. The above example is not using password, so there is no –p command.
b. Executing the command line with PHP Script:
Try to make program with php extension saved in the folder  in the htdocs and type this code bellow:
<?php
$command = "c:/xampp/mysql/bin/mysql –h localhost -u root -e "create database spisy;";
exec($command);
echo "finished to create database";
?>

Try to open phpmyadmin through the browser and look at the database collection. The database you created will exist there.
3. RESTORE DATABASE
a. Go to cmd.exe as an Administrator and run this command line:
C:\xampp\mysql\bin>mysql –h [hostname] -u root –p [password] [restored database name] < [database file name].[extension]”

This is the example of the real code:
C:\xampp\mysql\bin>mysql –h localhost -u root spisy < spisy-kpe3.sql”
Never use –p if you don’t use password to encrypt the database. The above example is not using password, so there is no –p command.
b. Executing the command line with PHP Script:
Try to make program with php extension saved in the folder  in the htdocs and type this code bellow:
<?php
$command = "c:/xampp/mysql/bin/mysql –h localhost -u root spisy < spisy-kpe3.sql";
exec($command);
echo "finished to restore database";
?>

4. MERGING THE PROGRAM
Now, we can use all of program to back up, create and restore database in same time. The program look like bellow:
<?php
$command = "c:/xampp/mysql/bin/mysqldump -u root spisy-kpe > spisy-kpe3.sql";

exec($command);

echo "finished to backup database";

exec('c:/xampp/mysql/bin/mysql -u root -e "create database spisy;"');

exec('c:/xampp/mysql/bin/mysql -u root spisy < spisy-kpe3.sql');

echo "finished to restore database";
exec(exit);
?>

Posted By Novida2:36 PM

Sunday, August 21, 2016

Python - Inconsistent use of tabs and spaces in indentation - Notepad++

Filled under:

I am trying to making Python 3.4 application using Notepad++ and windows command prompt.
I want to make main() function code block and call it in the __name__.
The line is looking like bellow:
#!\Python34\python
import os;

def main():
 bahasa = ['Python','Perl'];
 for b in bahasa:
  print(b);
 os.system("pause");

if __name__ == "__main__":
 main();
I saved syntax above in D:\PythonProject and named hello.py when I run the script using windows command prompt by typing
D:\PythonProject>python hello.py
I get error warning : TabError: inconsistent use of tabs and spaces in indentation I set Notepad++ tabs configuration by going to Setting --> Preference --> Language Menu then I choose Python, and I go to Tab Settings then I choose Python. It will automatically change the setting of our text editor from tabs into tab-space. It runs successfully.

Posted By Novida7:48 PM

Tuesday, July 19, 2016

Install Redmine using XAMPP, MySQL, Ruby on Rails

Filled under:

bellow are the requirement that we use to install redmine.

  • XAMPP v3.2.1
  • Ruby 2.2.4
  • Redmine 3.0.4
  • DevKit 4.7.2

1.        XAMPP Bitnami Installation

1.1.       Install XAMPP Bitnami dengan menggunakan xampp-win32-1.8.2-1-VC9-installer.exe. Before run the application, please turn off the antivirus which is running on PC.
1.2.       Please ignore the warning and continue the installation by clicking OK

Figure 1 Bitnami Installation warning

1.3.       Follow the instruction by only clicking Next tombol
1.4.       Make sure that the application path is already exist in the system drive by going to C:/xampp/htdocs
1.5.       Create folder dev-ruby inside htdocs
1.6.       Put redmine folder from bundle inside dev-ruby folder and just use the simple name for redmine folder by removing version number

Figure 2 Redmine folder in the xampp application

1.7.       After the installation completed, please open XAMPP Control Panel and you will see the following layout

Figure 3 XAMPP Control Panel v3.2.1
1.8.       Before start Apache and MySQL Service, please open the configuration file by clicking Config and choose Apache (http.conf)
1.9.       Please find Listen 80 line in the file and add Listen 3000 as the Ruby and Rails port.

Figure 4 Port Listening



1.10.   Add the following syntax at the end of file to create Virtual Host for Ruby and Rails
<VirtualHost *:3000>
   ServerName localhost
   DocumentRoot “C:/xampp/htdocs/dev-ruby/redmine/public”
<Directory “C:/xampp/htdocs/dev-ruby/redmine/”>
     Option Indexes FollowSymLinks Includes ExecCGI
     AllowOverride none
     Require all granted
<Directory>
</VirtualHost>

Use path which is defined in step 1.5 and step 1.6 to replace ~/dev-ruby/redmine

1.11.   Open Xampp control panel and Start Apache and MySql by clicking Start tombol and make sure that port 3000 is listed between Apache and Start tombol, and port 3306 is listed between MySQL and Start tombol

Figure 5 Starting Apache and MySQL


1.12.   Create redmine database in phpmyadmin by going to localhost/xampp (in this case I use port 90 for phpmyadmin, so I use localhost:90/xampp)

Figure 6 Creating Redmine Database

1.13.   Please go to the browser and go to URL : localhost:3000. Make sure that the redmine file will be listed in the homepage.

Figure 7 Listen localhost:3000
1.14.   if you get the above result, it means that the virtual host for Ruby and rails is ready to be used.


2.        Ruby on Rails Installation

2.1.       Install ruby installer using rubyinstaller-2.2.4-x64.exe in the bundle. Please follow the instruction and make sure you check Add Ruby executables to your PATH such the following picture and click Install

Figure 8 Installing Ruby
2.2.       Make sure that Ruby is already installed in the System, then put DevKit folder from bundle to the System parallel with installed Ruby22-64 folder

Figure 9 DevKit Folder

2.3.       Copy libmysqld.lib from C:\xampp\mysql\lib into C:\Ruby22-x64\lib\ruby\gems\2.2.0\gems\mysql2-0.4.4-x64-mingw32\vendor
2.4.       Open DevKit folder and run msys.bat
2.5.       On msys.bat run the following command:
cd C:/DevKit
ruby db.rk init
ruby db.rk install
2.6.       Close the msys.bat and open command prompt as administrator
2.7.       Check Ruby version
ruby -v
expected result:

Figure 10 Checking Ruby Version
2.8.       Check Gem version
gem -v

Figure 11 Checking Gem Version
2.9.       Install Ruby on rails in the folder which is defined in Step 1.5, in this case we use dev-ruby folder with the following syntax:
cd C:/xampp/htdocs/dev-ruby
gem install bundler
gem install rake
gem install rails -v=4.2.6
gem install mongrel -v 1.2.0.pre2 -- --with-cflags=\"-02 -pipe -march=native -w\"
gem install mongrel --pre
gem install mysql2
2.10.   If there is at least one line couldn’t be run, please type bundle install --without rmagick
2.11.   Open redmine folder C:\xampp\htdocs\dev-ruby\redmine\config, and Copy-paste database.yml.example, rename it tobe database.yml and then open it by using text editor such notepad.
2.12.   Only use the following code in the database.yml file:
development:
  adapter: mysql2
  database: redmine
  host: localhost
  username: root
  password: ""
  encoding: utf8
port: 3306


Figure 12 Configuring database.yml in redmine

2.13.   Open the command prompt again and go to redmine folder, then migrate the database into phpmyadmin by typing rake db:migrate
2.14.   Open the command prompt again and go to redmine folder, then type rails server

Figure 13 Start Redmine Service


2.15.   Go to URL: localhost:3000 from your local computer, but if you want to make this redmine readable from another computer, just simply type rails s -b 192.168.1.74 -p 3000 and Go to URL: 192.168.1.74:3000 and Enjoy Redmine!

Posted By Novida12:30 PM

Thursday, April 14, 2016

Mudahnya Mengurus Visa Kunjungan Bisnis Jepang

Filled under:

Assalamualaykum warrahmatullah wabarakatuh.
Konbanwa, minna san!
Alhamdulillah, sebulan yang lalu, tepat tanggal 22 Maret 2016, saya bisa berangkat ke Jepang untuk tujuan bisnis. Namun bukannya dengan tanpa halangan, pengurusan persiapannya benar-benar sangat panjang dan menelan sedikit emosi. Maklum, karena ini merupakan pengurusan passport dan visa untuk pertama kalinya.
Sebelum dapat mengajukan Visa kepada komjen Jepang, kita terlebih dahulu harus memiliki Passport. Kebetulan di tahun 2016, sudah terbit e-Passport atau electorin-Passport. Seperti yang kita tahu bahwa passport merupakan surat penyimpan informasi biometrik yang mengautentikasikan identitas seseorang. Jika di dalam negri, kita menggunakan KTP, maka identitas untuk di luar negri adalah passport. Hanya saja bedanya, e-passport telah dilengkapi dengan microprocessor chip (computer chip) dan antenna. Karena itulah kover buku passport dari e-passport lebih tebal dan menggunakan logo biometrik. Salah satu fungsi e-passport bagi kita yang sering sekali pergi ke Jepang adalah kita tidak perlu berulang kali mendaftarkan visa (Single Entry) jika bolak-balik pergi dan meninggalkan Jepang. Kemudian kita juga tidak perlu membayar biasa pembuatan visa alias gratis. Untuk passport biasa kita perlu merogoh koceh sebesar Rp 335 ribu, namun untuk sekali pengajuan visa Kunjungan sementara Jepang, kita perlu merogoh koceh sebesar Rp 330 ribu. Sedangkan untuk e-passport kita perlu merogoh koceh sebesar Rp 655 ribu, dan tidak perlu membayar biaya pengajuan visa. Untuk bagaimana mengajukan passport baik biasa dan elektronik, anda bisa kesini. Saya perlu mengingatkan bahwa bagi anda yang alamat KTP di luar Kantor Imigrasi pembuatan passport, anda perlu mencantumkan Surat Rekomendasi yang menjamin anda bahwa anda tidak akan menyalahgunakan data-data yang dipercayakan kantor imigrasi dan digunakan sebagaimana mestinya. Kebetulan saya beralamat KTP di Lumajang, Jawa Timur. Dan membuat passport di Kantor Imigrasi Kelas I - Jakarta Timur. Oleh karena tujuan saya ke Jepang kali ini untuk kunjungan bisnis, maka surat rekomendasi bisa dibuat oleh kantor tempat saya bekerja. Setelah semua surat lengkap dan beres, kemudian ada wawancara sedikit oleh pihak registrasi, anda hanya perlu mengikuti prosedur di Kantor Imigrasi dengan urut dan antri. Prosesnya hanya memakan waktu sehari. Namun, harus anda tahu bahwa pembuatan passport harus perlu mendaftar nomor antrian terlebih dahulu. Dan nomor antrian akan otomatis di-close oleh sistem terintegrasi yang ada di dalam Kanim pada pukul 09:00. Jadi saya sarankan agar anda sudah berada di Kanim sebelum jam tersebut. Karena untuk satu hari, jumlah pendaftar bisa mencapai ratusan orang dengan jumlah pengurus hanya sekitar 10 bilik saja.

Nah bagaimana dengan pengajuan visa Jepang?
Untuk proses sendiri sebenarnya tidak serumit dan selama pengurusan passport. Namun pengurusan visa tidak bisa sefleksibel passport. Pengurusan visa dilakukan di komjen atau kantor kedutaan Jepang, dan setiap daerah di Indonesia sudah dibagi kepada beberapa yurisdiksi. Jadi, tidak bisa sembarang kantor kedutaan bisa kita masuki untuk pengajuan visa.
Berikut adalah daftar yurisdiksi Konsulat Jendral Jepang di Indonesia:

  1. Bagian Konsuler Kedutaan Jepang di Jakarta memiliki wilayah yurisdiksi Jakarta, Banten, Jawa Barat, Jawa Tengah, Yogyakarta, Kalimantan Tengah, Kalimantan Barat, Sumatera Selatan, Bangka Belitung, Bengkulu, Lampung.
  2. Bagian Konsuler Kedutaan Jepang di Makasar memiliki wilayah yurisdiksi Sulawesi Utara, Gorontalo, Sulawesi Tengah, Sulawesi Tenggara, Sulawesi Selatan, Sulawesi Barat, Maluku Utara, Maluku, Papua (Irian Jaya), Papua Barat
  3. Bagian Konsuler Kedutaan Jepang di Surabaya memiliki wilayah yurisdiksi Jawa Timur, Kalimantan Timur, Kalimantan Utara, Kalimantan Selatan
  4. Bagian Konsuler Kedutaan Jepang di Denpasar memiliki wilayah yurisdiksi Bali, Nusa Tenggara Barat, Nusa Tenggara Timur 
  5. Bagian Konsuler Kedutaan Jepang di Medan memiliki wilayah yurisdiksi Aceh Nangroe Darusalam, Sumatera Utara, Sumatera Barat, Jambi, Riau, Kepulauan Riau
Jadi bagi kita yang kebetulan beralamat KTP di Surabaya kemudian berdomisili di Jakarta dan mengurus passport di Jakarta, tetap saja harus kembali ke tempat asal yurisdiksi untuk dapat mengajukan visa Jepang. Saya sendiri beralamat KTP di Lumajang (Jawa Timur), walaupun telah membuat passport di Kanim Kelas I Jakarta Timur, saya tetap harus pergi ke Kantor Konsulat Jendral Jepang yang berada di Surabaya. Jika penasaran anda boleh mencoba untuk tetap mengajuakan dengan alamat berbeda dari yurisdiksi yang sudah ditentukan, karena sampai kapanpun mereka tidak akan menerima permohonan anda. FYI saja bahwa Konjen Jepang sangat anti dengan penyogokan atau segala bentuk suap. Karena sepengalaman saya bahwa pengajuan visa bisa saja di tolak. Sistem pengajuan visa memang sedikit membingungkan, namun menurut saya ini sudah tidak se-membingungkan jaman dulu. Jika alamat KTP dan alamat Passport berbeda, maka sebelum dapat mengajukan visa, alamat passport harus dimutasi terlebih dahulu sesuai dengan alamat KTP, atau sebaliknya. Namun kita tidak perlu khawatir jika kita sangat kesusahan untuk mengurus visa di luar kota/provinsi/pulau, karena pengurusan visa dapat diwakilkan oleh orang lain, dengan syarat menyertakan surat kuasa atau Surat Tugas (jika keperluan bisnis). Pada kasus saya ini, saya meminta bantuan teman saya yang berdomisili di Surabaya untuk mengurus visa tersebut.
Adapun syarat untuk mengajukan visa kunjungan sementara untuk bisnis dapat dilihat disini. Dan lama pembuatan hanya memakan waktu 4 hari kerja.
Catatan lainnya yaitu jika anda ingin mengunjungi Jepang atau bahkan luar negri yang lain, anda harus telah benar-benar matang dalam perencanaan apa yang akan dilakukan disana dan dimana anda akan tinggal, karena pemerintah Jepang sangat teliti dan detil akan data yang kita ajukan. Namun tidak perlu khawatir, untuk template dokumen tambahan seperti jadwal perjalanan, surat undangan, mereka sangat fleksibel. Anda dapat mencari template-template yang sudah valid dan lolos di internet. Bagi anda yang dijamin segala biaya oleh perusahaan tempat anda bekerja, maka anda tidak perlu memberikan keterangan jumlah tabungan yang anda miliki, dan cukup meminta perusahaan tempat anda bekerja untuk membuatkan surat jaminan yang disertai dengan materai. Tetapi walau bagaimana, setelah anda sampai di terminal Bandara tempat pertama kali anda memasuki Jepang, anda akan tetap ditanya berapa banyak uang yang anda bawa. Pada saat itu saya hanya membawa sedikit uang dalam mata uang JPY sebesar 30.000 Y, sisanya saya membawa uang dalam mata uang IDR.

Posted By Unknown12:11 PM