Saturday, December 10, 2016

RANKING - OS162

Filled under:

----------------------------------------
RANKING ULASAN1/ULASAN2 PESERTA OS2016-2
----------------------------------------
01.[U1-20] http://keynekassapa13.blogspot.co.id/2016/12/review1-deadlock.html
02.[U1-18] http://catatanpartoba.blogspot.sg/2016/12/ulasan-1.html
03.[U2-12] http://keynekassapa13.blogspot.co.id/2016/12/review2-io-system-and-device-drivers.html
04.[U1-08] https://otonaenomichi.blogspot.co.id/2016/12/hybrid-cloud-infrastructure.html
05.[U1-02] https://johannestobing.blogspot.co.id/2016/11/ulasan1.html
06.[U1-17] http://dwitri-rizkydarmawan.blogspot.co.id/2016/12/ulasan-1.html
07.[U1-06] http://putrirmd.blogspot.co.id/2016/12/cloud-computing.html
08.[U2-01] https://johannestobing.blogspot.co.id/2016/11/ulasan2.html
09.[U2-07] http://pamelakareen.blogspot.co.id/2016/12/ulasan-2-principles-of-operating.html
10.[U1-15] http://harunakaze.blogspot.co.id/2016/12/zephyr-rtos.html
11.[U1-12] http://fascalgh.blogspot.co.id/2016/12/ulasan-1.html
12.[U2-02] http://vincent51-ulasan1.blogspot.co.id/2016/12/ulasan-2-servers.html
13.[U1-22] http://luthviar.blogspot.co.id/2016/11/ulasan-1-android-architecture.html
14.[U2-10] http://harunakaze.blogspot.co.id/2016/12/steamos.html
15.[U1-16] http://nadianurannisa7.blogspot.com/2016/12/ulasan-1-principles-of-operating-system.html
16.[U1-03] http://vincent51-ulasan1.blogspot.co.id/2016/11/ulasan-1-virtualization.html
17.[U2-12] http://keynekassapa13.blogspot.co.id/2016/12/review2-io-system-and-device-drivers.html
18.[U2-03] http://anissaedwita.blogspot.co.id/2016/11/ulasan2.html
19.[U2-05] http://indahp-os162-ulasan.blogspot.co.id/2016/12/understanding-switches.html
20.[U2-04] http://twobunny22.blogspot.co.id/2016/12/ulasan-2-operating-system.html
21.[U1-10] http://indahp-os162-ulasan.blogspot.co.id/2016/12/overview-active-directory-directory_4.html
22.[U1-14] https://muhammadnuim.blogspot.co.id/2016/12/file-sharing.html 
23.[U1-07] http://zetlogger.blogspot.co.id/2016/12/what-are-containers-and-why-are-they-so.html
24.[U2-11] http://muhammadiqbalnazulis.blogspot.co.id/2016/12/ulasan-2-pada-kesempatan-ini.html


Github account: novidaws
URL Ulasan blog: https://mathisgold.blogspot.com/2016/12/ranking-os162.html
Tanggal submisi revisi pertama: Tanggal submisi revisi kedua:

Posted By Novida11:08 PM

Introduction to Active Directory Directory Services Structure in Windows Server 2012

Filled under:

Assalamualaikum wr. wb.

Pada thread blog kali ini saya akan memberikan ulasan (ulasan 1) dari video berdurasi 46:30 menit dari alamat ini. Ini merupakan video yang diunggah oleh akun bernama “Eli the Computer Guy” dengan judul Introduction to Active Directory Directory Services Structure in Windows Server 2012. Konten di dalam video tersebut secara original telah dibuat oleh Eli. Konten dalam video ini mencakup teknologi informasi secara umum, dan mencakup Sistem Operasi secara khusus. 

Mengapa Active Directory Directory Services Structure sangat penting untuk dipelajari pada Windows environment, khususnya pada corporate network? active directry merupakan service pada server untuk keamanan server, khususnya pada windows environment. Active directory juga digunakan untuk membuat VPN pada corporate connection dan memungkinkan banyak orang untuk terhubung secara aman menggunakan internal connection. active directory service membuat pengguna yang login ke dalam komputernya mendapatkan izin untuk melakukan tindakan baik kepada komputernya sendiri maupun share folder/share point yang terdapat pada jaringan di dalam koneksinya. Selain itu, pengguna juga dimungkinkan untuk membuat suatu kebijakan melalui domain service dan memberlakukannya kepada seluruh komputer yang terhubung dengannya. Active directory dikontrol penuh oleh sebuah Domain Controller. Untuk itu, administrator pada perlu mendaftar pengguna mana dan komputer mana saja yang dapat mengakses domain controller, dua hal itu disebut 1) user account dan 2) computer account. Informasi-informasi tersebut nantinya akan disimpan ke dalam domain controller melalui media penyimpanan atau basis data yang disebut dengan Schema. Setiap user account terdiri dari minimal username dan password, kemudian informasi tambahan seperti email, nama perusahaan atau komunitas, dll. Schema akan membuat kinerja sebuah domain controller menjadi prima ketika ia bersifat extendable. Artinya, secara dinamis pengguna dapat menambahan data yang ingin disimpan kedalamnya secara dinamis. Melalui hal itu, active directory directory services akan mampu mengenali "Siapa yang memiliki hak akses kepada apa". Selanjutnya, untuk setiap user account dan computer account dapat dikelompokkan ke dalam Groups. Setiap group akan memiliki hak akses yang berbeda-beda pada sumber daya di dalam jaringan. Contohnya, pengguna dari accounting group akan diberikan akses kepada folder accounting, dan sistem akan memblokir selain accounting group untuk mengakses folder tersebut. Pada group yang berbeda-beda hak aksesnya, tetap dibutuhkan sebuah group yang memiliki semua hak akses. group akses tersebut adalah Organizational Unit (OU). Sehingga jika terdapat masalah, OU akan melakukan tindakan-tindakan dan menyelesaikannya melalui hak akses yang dimilikinya, karena masalah-masalahnya banyak timbul dari antar account yang berbeda group. Kumpulan dari user account dan computer account yang terhubung dengan domain controller melalui active directory directory services disebut sebagai Domain

Berbicara tentang Domain, mari kita ambil contohnya adalah Google. Google memiliki sebuah domain bernama Google.com. Google telah mengekspansi bisnisnya ke Asia, Australia, Eropa, Afrika dan tentu saja Amerika. Namun pada realitasnya, Eropa memiliki requirement yang spesifik tentang penggunaan domain ini dengan alasan keamanan. Sehingga Google membuat sebuah sub domain, yaitu europe.google.com. Sama dengan domain, sub domain juga memiliki Domain Controller, user account dan computer account. Sub domain ini dapat menggunakan schema dari domainnya. Domain membuat sub domain disebut dengan two ways transitive trust, yang berarti domain mempercayai sub domainnya dan sub domain mempercayai domainnya. Domain dapat memiliki lebih dari satu sub domain, dan setiap sub domain terhadap sub domain lainnya juga dapat saling mempercayai, hal itulah yang dimaksud dengan two ways transitive trust

Penyajian materi dalam video ini sangat bagus, karena selain penyampainnya yang banyak diulang-ulang sehingga membuat penonton mengerti benar akan konsep yang diterangkannya, juga disertai dengan ilustrasi gambar yang dibuat dari awal hingga kompleks sehingga membantu penonton untuk berimajinasi tentang konsep yang disampaikannya secara langsung dan benar. Konten yang disampaikan secara eksplisit mencakup materi yang umum, artinya tidak hanya konsep pada Windows Server 2012, tetapi sistem operasi yang lain. 


Berikut merupakan data pribadi saya yang bisa diakses:

Posted By Novida9:23 PM

Thread Fundamentals - Advanced .Net Threading

Filled under:


Assalamualaikum wr. wb.

Pada thread blog kali ini saya akan memberikan ulasan (ulasan 1) dari video berdurasi 1:11:46 jam dari alamat ini. Ini merupakan video yang diunggah oleh akun bernama “Learn Forever” dengan judul Advanced Net Threading – Part 1 – Thread Fundamentals. Konten di dalam video tersebut secara original telah dibuat oleh Jeffrey Richter dari Microsoft Virtual Academy dan diproduksi oleh Wintellect Now. Alasan untuk memilih topik ini, karena selain sebagai tugas mata kuliah Sistem Operasi sekaligus sebagai bahan dasar untuk melakukan eksplorasi .Net System Development di kantor tempat saya bekerja. Selain itu, konten dalam video ini mencakup teknologi informasi secara umum, dan mencakup Sistem Operasi secara khusus.


Sejarah keberadaan thread secara umum adalah berasal dari lemahnya eksekusi yang dilakukan sistem operasi terhadap aplikasi-aplikasi yang terdapat didalamnya. Salah satu contohnya adalah terjadinya infinite loop pada proses aplikasi yang dapat menyebabkan mesin berada pada kondisi Freeze. Hal ini sangat tidak User friendly untuk sebuah konsep User Experience pada Sistem Operasi. Kebanyakan orang menganggap bahwa thread akan meningkatkan kinerja dari sistem operasi, namun pada kenyatannya, thread digunakan untuk memvirtualisasikan memori pada komputer sehingga membuat komputer berjalan dengan lebih lambat. Masalah lain muncul kemudian, yaitu 1 CPU hanya dapat menjalankan 1 thread dalam satu waktu, selanjutnya disebut Quantum. Quantum berjalan dengan kecepatan 3milidetik setiap proses. Kemudian Microsoft akhirnya membangun Windows yang mendukung adanya 1+threads per proses. Hal ini akan mendukung Sistem Operasi untuk menjalankan proses yang Infinite loop. Jadi, pengguna dapat membuka task manager untuk melakukan kill terhadap aplikasi yang infinite loop tersebut serta me-release alamat memori yang digunakan oleh aplikasi yang infinite loop tadi dengan tanpa mematikan komputernya. Tujuan utama thread dibuat pada tahap ini adalah untuk alasan ketahanan, keresponsifan dan kereliabelan. Dengan kata lain, thread merupakan teknologi untuk memvirtualisasikan CPU, yang pada dasarnya memiliki sebuah overhead, dalam hal ini adalah waktu eksekusi dan ukuran alokasi memori. Setiap kali thread dipanggil oleh sistem operasi, ia akan membuat sebuah struktur data disebut thread kernel object untuk memenej waktu hidup alokasi memori. Struktur data ini menyimpan informasi tentang waktu pembuatan thread tersebut, penjadwalan, berapa banyak CPU time yang digunakan, posisi apa yang sedang thread kerjakan (create, wait, running atau terminating). thread kernel object terdiri dari context, Thread Local Storage (TLS), dan Graphics Devise Interface. Bagian terpenting di dalam thread adalah Stacks. Satu thread terdiri dari 2 Stacks, yaitu user mode stack dengan kapasitas memori 1MB, dan kernel mode stack dengan kapasitas memori 12KB atau 24KB tergantung besarnya bit sistem operasi yang digunakan. Kemudian hal penting berikutnya dalam thread overhead adalah time overhead yaitu waktu yang digunakan mengalokasi memori dan mendealokasi memori. Time overhead disimpan dalam bentuk DLL.

Kemudian, 2 alasan utama mengapa kita harus menggunakan thread dalam programming adalah 1) untuk mengisolasi suatu kode ke dalam kode yang lain, atau dengan kata lain untuk menciptakan kode yang reliabel dan mudah untuk dibuat, 2) untuk mengeksekusi lebih dari 1 proses dalam sekali waktu secara bersamaan, karena pada saat ini kebanyakan komputer telah mendukung multi-processor.  Benefit yang bisa didapatkan ketika menggunakan thread dalam membuat program adalah 1) menjaga agar CPU tetap sibuk, karena jika 1 CPU dan 1 thread selesai mengeksekusi suatu proses, context switch dapat menjadwalkan proses lain untuk dieksekusi selanjutnya, hal ini akan membuat efisiensi sumber daya yang ada di dalam komputer, misalnya daya baterai, 2) Dalam sekali menjalankan aplikasi, pengguna dapat melakukan eksekusi terhadap lebih dari satu fitur aplikasi, dan 3) Untuk membuat aplikasi yang reliabel, tanpa hangs, dapat ditunda, dan UI yang responsif atau user friendly. Contoh fungsi yang dapat dibuat dengan menggunakan thread adalah 1) file indexing untuk pencarian yang lebih cepat, 2) mengurutkan pengalamatan pada memori fisik untuk mempercepat pengaksesan I/O, 3) Spelling dan Grammar pada saat pengetikan kata di aplikasi pengolah kata.

Tujuan utama dari video ini sebenarnya adalah untuk mengajarkan bagaimana membuat thread dengan menggunakan bahasa pemrograman C#. Namun, penyaji lebih memilih untuk memberikan materi tentang fundamental atau dasar-dasar materi yang harus diketahui tentang threading dengan bahasa yang mudah dipahami dan lengkap terlebih dahulu. Itu berarti penyaji membiarkan pembacanya untuk benar-benar mengerti konsep threading pada C#, tidak hanya sekedar mengikuti apa yang dia buat atau kerjakan. Oleh karena itu saya pribadi sangat setuju dengan cara penyampainnya, walaupun ada bagian yang seharusnya dioptimalkan untuk membuat penggunanya cepat dan mudah memahaminya, yaitu dengan slide presentasi yang unik disertai gambar-gambar pendukung.




Berikut merupakan data pribadi saya yang bisa diakses:

Posted By Novida12:46 AM

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