Skip to main content

Posts

Showing posts from December, 2015

How To Make Program to Corrupt File (Java)

Sometime we intentionally want our file to be corrupted e.g. to test software reliability. So, I made a program in Java that intentionally corrupt file. Please be careful to use this program as this program will make your file corrupt and cannot be reverted. Please backup your file before making it corrupt. OK, the logic is very simple. For each byte in the file, I simply put any random character (ASCII character is from 0 to 255). Here is the complete Java program: import java.io.RandomAccessFile; import java.util.Random; /**  *  * @author arwankhoiruddin  */ public class CorruptFile {     /**      * @param args the command line arguments      */     public static void main(String[] args) {         // TODO code application logic here         String FILEPATH = args[0];         System.out.println("File to corrupt: " + FILEPATH);         System.out.println("File corruption process started");               try {             RandomAccessFile file

Tips Berwisata di Saat Liburan Panjang bagi Pembenci Macet dan Keramaian

Saya adalah seorang yang tidak suka pada macet dan tempat wisata yang terlalu ramai. Saya tidak suka macet karena macet bikin waktu serasa cuma habis di jalan. Saya tidak suka tempat wisata yang terlalu ramai karena tujuan berwisata adalah menikmati alam dan menikmati quality time bersama keluarga. Di tempat wisata yang terlalu ramai, waktu biasanya akan dihabiskan untuk nyari tempat parkir, nyari tempat kosong untuk berteduh atau bermain, dan susah sekali untuk bisa menikmati tempat wisatanya sendiri karena justru yang terlihat adalah ramainya. Pada liburan panjang seperti ini (natal dan tahun baru di akhir minggu ditambah dengan liburan anak sekolah), kondisi jalan dan tempat wisata mainstream sungguh sangat tidak menarik. Di mana-mana jalanan macet, dan di tempat-tempat wisata, terlalu banyak orang yang berkunjung. Untuk menyiasati, ada beberapa hal yang bisa dilakukan: 1. Jangan lewat jalan yang biasa dilewati orang. Carilah jalan alternatif (lebih baik gunakan aplikasi peta s

Install Python 3 and use VirtualEnv (OS X)

Install xcode: $  xcode - select   -- install Install homebrew: $  ruby   - e   "$(curl -fsSL  https://raw.githubusercontent.com/Homebrew/install/master/install )" Create .bash_profile: $ touch ~/.bash_profile Put this line inside .bash_profile:  export  PATH = / usr / local / bin : $ PATH Install python3: $ brew install python3 Create virtual environment. To make it easily found, create it under home: $ cd ~ && pyvenv arwan Activate the virtual environment created: $ source arwan/bin/activate Now you can start working in the new virtual environment. Note that it is worth to look at requirements.txt to see required packages on certain projects.

Pull Older Version from Git

Clone the current repository: $ git clone Go to the cloned directory: $ cd Find the sha1 of the commit to pull. For stash, click on the commit and look at the address bar. It will be the last part of the url. For example, the sha1 for http://mystash.arwan.com/repos/arwanproj/commits/0b004fdb420838ca04c15b25ad2e0b66a5693963 will be  0b004fdb420838ca04c15b25ad2e0b66a5693963   Fetch the version based on the sha1 number found: $ git fetch origin Checkout: $ git checkout FETCH_HEAD