Thursday, June 21, 2018

How to use property file in Java

property file is use for store data which need to change outside of the project.This is an example for use property file.

the property file is saved in "setting/setting.properties"

property file

setting.properties
# To change this license header, choose License Headers in Project Properties. 
# To change this template file, choose Tools | Templates # and open the template in the editor.  
ip=127.0.0.1 
port=6262 


Code


Main.java
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package rubictron.main;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.application.Application;
import javafx.stage.Stage;

/**
 *
 * @author rubictron
 */
public class Main extends Application {
    
    @Override
    public void start(Stage primaryStage) {
        FileReader reader=null;
        try {

            Properties setting=new Properties();//create new property

            File file=new File("setting/setting.properties");//get file
            reader = new FileReader(file);//read file
            setting.load(reader);//load file to property
            System.out.println("ip= "+setting.getProperty("ip"));
            System.out.println("port= "+setting.getProperty("port"));
            
            
        } catch (FileNotFoundException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        } finally {
            try {
                reader.close();
            } catch (IOException ex) {
                Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }
    
}




Friday, June 8, 2018

Complete PHP login system

This is my github repository for complete Login system using PHP , HTML , JS , CSS . The System has feature to login exist user and register new user . The username and passwords are stored in the database.the password is stored with encrypted. In every page check the users login status using session.redirect to the login page when seesion is time out. .You can this login system to your php website simply copy and past the directory and change the file path of home page and dashboard.

Please Don't Infringe CopyRight.







Monday, June 4, 2018

how to install nasm and do nothing program using assembly

install nasm using this command
install nasm
$ sudo apt-get install nasm  


create directory and files as i shown in figures

edit code on nasm01.asm as showen below
nasm01.asm
section .data ;initialized allocation section 
section .bss  ; Un-initialized memory allocation section  
;------------ 
;code section 
;------------  
section .text   
global _start _start:  
;------------------- 
;begining of program 
;-------------------  
;program  
;-------------- 
;end of program 
;-------------- 
mov ebx ,0  
mov eax,1 
int 0x80      

create object and list file using below commands
compile nasm file
$ nasm -f elf64 -g -F stabs -o obj.o -l lst.l nasm01.asm $ ld -o exe.x obj.o  


how to write nasm hello-word will be on my next blog post