Cross-Platform, Java

Get URL contents with Java

It is very easy to download url contents using a few lines of java code: The source code below is licensed under GPLv3. GetURLContents.java (GetURLContents) import java.io.*; import java.net.*;   public class GetURLContents {   public static void main (String[] args) { URL url; InputStream input = null; BufferedReader inputs; String str;   try { …

Browsers, Ubuntu

Installing Opera on Ubuntu

If you like Opera, like i do, then you are a few steps away from installing it on Ubuntu! 1. Keep a backup for file /etc/apt/sources.list 2. Append to this file the lines below: #opera deb http://deb.opera.com/opera/ stable non-free 3. Add the Opera PGP Key wget -qO – http://deb.opera.com/archive.key | sudo apt-key add – 4. …

C#, Microsoft Windows

Hashing text with SHA-256 in C#

A simple c# method to produce hashes from plain text using SHA-256 algorithm in visual c#! 1 2 3 4 5 6 public String Hash_SHA256(String plainText) {             byte[] inputBytes = Encoding.UTF8.GetBytes(plainText);             byte[] hashedBytes = (new SHA256CryptoServiceProvider()).ComputeHash(inputBytes);             return BitConverter.ToString(hashedBytes).Replace("-", string.Empty).ToLower(); }public String Hash_SHA256(String plainText) {             byte[] inputBytes = Encoding.UTF8.GetBytes(plainText);             byte[] hashedBytes …

PHP

Preventing MySQL Injection in PHP

Security issues like MySQL injection can only be corrected by using two functions mysql_real_escape_string (php manual) and stripslashes (php manual).   Example: $safe_string = mysql_real_escape_string(stripslashes($tainted_string));$safe_string = mysql_real_escape_string(stripslashes($tainted_string));   To make your life a little easier just create a suitable function for this line of code: function checkString($value) {       return mysql_real_escape_string(stripslashes($value));   }function checkString($value) …

Tor

How to surf the web anonymously

One of the easiest and most effective ways to keep your identity secret while you are surfing the internet is by using the TOR network. Tor tools are available for Windows, Linux, BSD, Unix, Mac OS X, Android, iOS and Maemo. The great thing about Tor except from its effectiveness, you really surf the web …