-
Starting With MeteorJS
Recently I started to switch my projects to javascript programs. I discovered meteorJS which seems a good option to develop web apps. Installing meteorjs Linux/OSx: Run the command: curl https://install.meteor.com/ | sh Win: Download the installer and install it Starting a new project Type "meteor create appname" in your desired folder. The project consist of […]
-
Adding dependencies from local Maven repositories to Activator projects
As I’m using in my Activator/Play Framework project a few jars which I build separately using maven, I want to the activator build tool to search for the dependencies in my maven local repositories. In order to do so, include the following lines in build.sbt tool: resolvers ++= Seq ( Resolver.mavenLocal ) Once you build […]
-
Retrieving Files Recursively in Java
Sometimes I need to read recursively all the files from a directory. I kept using DirectoryScanner class from the Apache(located in ant.jar in my case). It has the advantage that it can filter through files based on the well-known asterisk matching. Recently I had to look-up in a directory containing lots and lots of files […]
-
How To Rename A Remote Branch in Git
In order to rename the remote branch we need to rename it locally, to remove the old name of branch from remote repository and then to push the branch renamed with the new name to the remote repository:
-
Getting sun.security.provider.certpath. SunCertPathBuilderException when sending mail from Java via SSL?
Do you get sun.security.provider.certpath. SunCertPathBuilderException: unable to find valid certification path to requested target when you try to send a mail from java via smtp(TLS and SSL)? There are 2 possible problems: One option could be from the antivirus/firewall which prevent the communication for a specific port(default 465 for SSL and 587 for TSL) or […]
-
How To Resize/Convert Images In Java
Java comes by default with some classes to manipulate images. Those classes are located in java.awt package and are intended to be used for awt applications. For this reason they are not too rich in functionality to have enough options to control the resize quality. In the following snippet BufferedImage and ImageIO can be used […]
-
How to Obtain the IP Address and DNS Details for a domain in java
In the following snippet you can find out how to use the InetAddress class to obtain the ip of the server where a domain is hosted along with the DNS information. Using this class you’ll obtain only the technical DNS details(name server, SOA & MX records), not the emails or the names of the domain […]
-
Date Time Manipulation In Java
There are 2 useful classes in java to manipulate dates: java.util.Date and java.util.Calendar. Another useful class to format and parse string dates is java.text.SimpleDateFormat.
-
How To Use JDBC addBatch Method with MySQL for Improved Performance
[tweet-dzone]When you have to deal with a large amount of data to be operated on mySQL databases, the performance can be dramatically improved using a few simple tweaks. First of all you have to use Statement.addBatch/executeBatch instead of simple execute methods. For each added batch, the jdbc driver will store in local memory and when […]
-
How To Download a File in Java
Here is a snippet that shows how to download a file in java. The snippet is tested and works just fine: static public void download(String address, String localFileName) throws MalformedURLException , FileNotFoundException , IOException { URL url = new URL(address); OutputStream out = new BufferedOutputStream( new FileOutputStream(localFileName)); URLConnection conn = url.openConnection(); InputStream in = conn.getInputStream(); […]