Welcome to Knowledge Basement

Linux, Java, Open Source related how-to articles

Referencing a Child Object to a Variable of Type Parent in Java

Referencing a child object to a variable of type parent in Java can be real confusing. Here is an example of two classes Person and Student and an overriden method whatAmI: class Person { String it = “It is a Person.”; public void whatAmI(Object x) { System.out.print(“Person’s object… ” + it); } } class Student… read more »

Working with Time and Date in Java

Working with time and date in Java is essential to any project. There are three important classes you can use: java.time.LocalTime – working only with time. java.time.LocalDate – working only with date. java.time.LocalDateTime – working with time and date both. All three classes provide two essential methods: of(arguments) – accepting arguments for the time/date/datetime values…. read more »

How to Parse Time in Java

To parse time in Java, the most trouble-free and programatic way is using the parse method of the LocalTime class like this: import java.time.LocalTime; import java.time.format.DateTimeFormatter; public class TimeParse { public static void main(String[] args) { String inputStr = “Time is 11 minutes past 11PM.”; String pattern = “‘Time is ‘m’ minutes past ‘ha.”; DateTimeFormatter… read more »

How to Install and Configure SuPHP

Notice: This article was written when  SuPHP was the most popular choice for running multiple PHP sites on the same Apache server. Now, php-fpm with different users is a better choice. But still, if you need this article, here it is… In short, SuPHP runs the PHP web scripts as a  predefined system user, respecting… read more »

How To Secure Your MongoDB Database Server on Ubuntu 14.04

The MongoDB database server is well-known for its unmatched capabilities for processing large NoSQL data. Its latest performance improvements are always under the spotlights and probably not a single MongoDB user has missed the recent news about the change of its default storage engine to the more powerful WiredTiger. At the same time, its security… read more »

How To Configure SSL In Tomcat

To secure the communication and increase the level of privacy to and from your Tomcat servlet container you should use SSL. Usually there’s an Apache or Nginx in front of Tomcat to serve external clients’ request and this web front server is also supposed to provide SSL connectivity. However, this is not always the case… read more »

How To Create SSH Tunnel With Putty

SSH tunneling is very useful when the network access to a remote network is restricted. Thus, to gain remote network access you can use a tunnel to a remote host which would act as an intermediary. Here’s an example. Imagine, there’s a remote host which runs a Tomcat app servlet on TCP port 8080. The… read more »

Introduction to Anonymity, Data Protection and Privacy

Almost every piece of information contains sensitive and private data. Exposing publicly such data could lead to serious financial losses, legal issues and personal inconveniences. That’s why data protection and privacy are essential tasks in any data processing project. When data cannot (public records) or should not (useful information for scientific research) remain private, anonymity… read more »

How to Install Azure Python Package

You can install Azure Python package either for Python 2 or Python 3 using pip (Python package index). Before you are able to install it though you have to: First, make sure pip is installed, of course. It’s available on most Linux distributions such as python-pip (for Python 2) or python3-pip (for Python 3). Second,… read more »

How to Change JVM Xms and Xmx for Tomcat on Windows

Changing Tomcat’s initial (Xms) and maximum (Xmx) memory turns out to be counter-intuitive on Windows, especially when Tomcat is installed as a service. That’s because when running under a service on Windows, Tomcat does not read initial runtime configure files such as setenv.bat (or setenv.sh for Linux) and thus you cannot define variables there. So… read more »