How to check state of firewall on CentOS 7?

First of all – be careful not to stop firewall permanently. Stopping firewall is great security risk, and always check if your firewall is up, running and properly configured. To check state of your firewall run next command: firewall-cmd –state If it’s running, you will get very simple message: running Next, if you wand to…

How to burn ISO image to DVD or CD

If you are using WIndows 10, follow next few steps to burn ISO file to DVD or CD: Insert a blank CD or DVD in your writable optical drive. Right-click on the ISO file, and select option “Burn disk image” It’s good practice to select checkbox “Verify disc after burning”, to make sure that ISO…

How to prevent SQL injection?

Important is that any parameter in a query needs to be parameterized. It doesn’t matter is your query is select, insert, update or delete kind of query, since every query can be used for injection. Let’s say that you want to have basic SELECT query, like: SELECT `column1` FROM `table1` WHERE `column2` = 11; You…

Read file, line by line

Simple code to read file, line by line File file = new File(ApplicationLocation, debitFile.toString()); //Log.e(“response”, “debitFile —–” + file); try { InputStream instream = new FileInputStream(“myFile.txt”); if (instream != null) { // prepare the file for reading InputStreamReader inputreader = new InputStreamReader(instream); BufferedReader buffreader = new BufferedReader(inputreader); String line = “”; // read every line…