Wednesday, December 16, 2020

Failed to transfer file: http://repo1.maven.org/maven2. Return code is: 501 , ReasonPhrase:HTTPS Required


If you are getting the following error when you are building your Java project using maven or gradle:

Failed to transfer file: http://repo1.maven.org/maven2. 
Return code is: 501 , ReasonPhrase:HTTPS Required

And you are thinking what happened, I haven’t changed anything in my project, no new dependencies, or repositories. The answer is that you haven’t changed anything. 

Do not panic! Effective January 15, 2020, the Central Repository is not longer supporting communication over HTTP and it requires requests to the repository must be over HTTPS.

Monday, August 31, 2020

Latency for sharing data while using Hazelcast on Virtual Machine


A few days back we found out one old app which was running on multiple nodes while having in-memory cache usage. So, as a result, there was a case when the request came to the first node and the second node didn't get that data, and the app wasn't functioning properly. 

So, as always first thing which we considered to use Redis. However, we don't have ready to use the Redis cluster and we started looking for other solutions in a market. Finally, I saw there is a Hazelcast which allows sharing data between nodes even without having the Hazelcast cluster. Of course, it is working when you are running in the same network. So, nodes should be able to multicast and make a proper cluster.

Wednesday, November 13, 2019

Java List vs List<?> vs List<Object>

Before generics were introduced developers used lists as List which means you can store any type of objects including null inside it and when you read it you need to cast it
List list = new ArrayList();
list.add("String test");
list.add(new Date());

String s = (String) list.get(0);
From code above you can expect ClassCastException because if you try to assign 2nd item to String it will not succeed and you will get an exception during runtime. To prevent it you need to check if your type is correct and then cast as below

Friday, May 3, 2019

What kind of benefits you can expect in Poland

Hey, 

I relocated to Poland(Krakow) in 2017 and I'm very happy to be here. I just regret that why I didn't do it 5-10 years ago :) 

Except nice and kind people, beautiful, old and safe city you can even expect a lot of benefits from the government and companies. Today I want to share all kind of benefits which I know and use here. If you know additional ones please feel free to leave them in the comment, I'll be happy to check it and add to the list :)

Thursday, August 23, 2018

How to hibernate from the lock screen on Ubuntu 18


By default Ubuntu doesnt support hibernate option. Even when u enable it using "pm-utils" during resume(wake-up) your laptop will not require password. 
And this is very risky moment. 

In my case, I created a keyboard shortcut which enables hibernate and lock. 
Today I will share steps how you also can do it for your laptop/pc.



Monday, April 16, 2018

How to change Google Play Country on Android


As you know, Google Play filters some apps on a per country and/or per region basis. And I also when relocated to Poland wasn't able to download and use Poland based apps.

Long history, in short, most of the time developers or companies (bank and government organizations i.e.) put apps on the market which are allowed to download only by the account/user which belongs to that country. 


Today, when I need to change my account to use Poland as a country wasn't easy as expected :) That is why I decided to share easy steps how I did it with you.

Sunday, April 15, 2018

Unable to Find Valid Certification Path to Requested Target while using Java on Server

SSL Certificates are small data files that digitally bind a cryptographic key to an organization’s details. 
When installed on a web server, it activates the padlock and the https protocol and allows secure connections from a web server to a browser. 

Typically, SSL is used to secure credit card transactions, data transfer, and logins, and more recently is becoming the norm when securing browsing of social media sites.

Even now, most the browsers show sites as "Not Secure" when they don't have SSL certificates

Maybe you also faced an issue like below:

Tuesday, June 7, 2016

Openfire Custom database integration steps

Instant messaging (IM) has enjoyed phenomenal success as a person-to-person communication tool; in some instances, it has supplanted email as the preferred means of online communication. Now, developers are using this technology for application-to-person and application-to-application communication.

There are too many IM servers which work with XMPP protocol. Some of them are paid/Enterprise and some of them are OpenSource.

We are using "Openfire" as a IM server for our projects. It is free, open source and java based. Except this advantages it has too many plugins which you can use for free. Openfire is a XMPP server and it has own client application with name "Spark".

Wednesday, June 1, 2016

Youtube/Shazam mp3/mp4 downloader for Android


Do you know how to download music or video from Youtube? Or do you know how to download music/mp3 from shazam on your android device?
If you don't know how download music from youtube or shazam on android then you should read this post :)


We have developed 2 applications by name YouMp34 and ShazaMusic which allow you to download from youtube and shazam for free.
Both of this applications is free and only for android users. You can view and download it from our official web site www.yoump34.com


We'll be happy to grow together :)

Thursday, March 26, 2015

JDBC URL to connect RAC database or How add multiple hosts in jdbc url

Today I will share new problem which I have solved.

In my last project I was connected to Oracle database (RAC) database using multiple hosts and I want to share oracle connection string which uses multiple hosts.

So while you are connecting from oracle clients (as PL/SQL developer) it is easy to define multiple hosts in tnsnames.ora




Thursday, September 25, 2014

Oracle JDBC problem - Locale not recognized on Glassfish

When you create JDBC connection pool for oracle you may seen error like below:

Ping Connection Pool failed for DBNAME. Connection could not be allocated because: Locale not recognized Please check the server.log for more details.

Solution of this problem is so simple. How we can solve this problem???

Tuesday, September 17, 2013

Shuffle an Array in Java with Easy or Fast way


Objects are a powerful software engineering construct, and Java uses them extensively. While developing Android applications you need fast way of doing something. For example:
Often u need randomized Array which u will save state of stage or something.
In that case how you change order of Array randomly???


There are 2 famous way for this:

Thursday, July 18, 2013

SOLVED: Unknown type '246 in column 2 of 3 in binary-encoded result set


Today at our firm was problem like as "Unknown type '246 in column 2 of 3 in binary-encoded result set" when selected table has column as decimal(10, 2) type. This errors cause because we use old version of mysql jdbc driver. Solution for this problem is:
  1. Download new version of driver
  2. Convert double column to char on selection.
    SELECT CAST(your_column AS char(15)) your_column FROM your_table;
    So in this case on java side u can get it as Double again.

Saturday, March 16, 2013

Create your web services with Spring

In this post I will show "Spring way" to build RESTful web services. It also explained how to produce multiple representations (JSON, XML and etc.), which is an important feature for RESTful web services.
This article explains another way to produce multiple representations using HttpMessageConverter, and examples in the article show how to use RestTemplate with HttpMessageConverter to communicate with services. HTTP requests and responses are text based, meaning a browser and server communicate by exchanging raw texts. With Spring, however, methods in the controller class return pure 'String' type and domain models (or other Java built-in objects). How can Spring serialize/de-serialize the objects to raw texts? This is handled by HttpMessageConverter. Spring has bundled implementations that can meet your common needs. Table 1 shows some examples.

Tuesday, December 25, 2012

Read data from SSL X.509 Certificates

According to X.509, you can create certificates with either RSA or DSA key pairs. But only RSA key pairs are capable of exchanging keys when starting a new SSL connection with a SSL server. You can only use RSA key pairs as your server certificates. On the other hand, CAs do not have to exchange keys. They only issue other certificates. You can use either RSA or DSA key pair as your CAs. But, some SSL programs do not support the DSA algorithm yet.

Sometimes u need check certificate valid date on server. U can do this in java simple:

Monday, November 19, 2012

Captcha for Java

       A CAPTCHA is a program that protects websites against bots by generating and grading tests that humans can pass but current computer programs cannot. For example, humans can read distorted text as the one shown on image, but current computer programs can't.
       The term CAPTCHA (for Completely Automated Public Turing Test To Tell Computers and Humans Apart) was coined in 2000 by Luis von Ahn, Manuel Blum, Nicholas Hopper and John Langford of Carnegie Mellon University.
       When u create web project sometimes u need captcha with colors of your site. That cases u can create captcha yourself as following:

Sunday, November 4, 2012

Parse XML and Properties config files

       .xml(Extensible Markup Language) and .properties is a file extension for files mainly used in Java related technologies to store the configurable parameters of an application.(.properties files can also be used for storing strings for Internationalization and localization - these are known as Property Resource Bundles.)

       Let's first start with XML config files. There are many XML parser technologies, but I will show how u can use Apache Commons Configuration library to parse and use XML config files.

       The Commons Configuration software library provides a generic configuration interface which enables a Java application to read configuration data from a variety of sources:

Thursday, October 18, 2012

Power of Spring's @ModelAttribute and @SessionAttributes

The Spring Framework is an open source application framework that aims to make J2EE development easier. Unlike single-tier frameworks, such as Struts or Hibernate, Spring aims to help structure whole applications in a consistent, productive manner, pulling together best-of-breed single-tier frameworks to create a coherent architecture.

How does @ModelAttribute work?
@ModelAttribute is a Spring-MVC specific annotation used for preparing the model data. It is also used to define the command object that would be bound with the HTTP request data. The annotation works only if the class is a Controller class (i.e. annotated with @Controller).

ModelAttribute can be applied on both methods as well as method-parameters. It accepts an optional "value", which indicates the name of the attribute. If no value is supplied to the annotation, then the value would be defaulted to the return type name in case of methods and parameter type name in case of method-parameters.

Tuesday, September 18, 2012

Spring 3 MVC Internationalization & Localization (i18n & l10N) and Reloader

In this post I will discuss about Internationalization (I18N) and Localization (L10N) in Spring 3.0 MVC. 

What is i18n and L10n?

In computing, internationalization and localization are means of adapting computer software to different languages and regional differences. Internationalization is the process of designing a software application so that it can be adapted to various languages and regions without engineering changes. Localization is the process of adapting internationalized software for a specific region or language by adding locale-specific components and translating text.
The terms are frequently abbreviated to the numeronyms i18n (where 18 stands for the number of letters between the first i and last n in internationalization) and L10n respectively, due to the length of the words. The capital L in L10n helps to distinguish it from the lowercase i in i18n. Let's begin:

Thursday, September 13, 2012

Intercepting requests (annotation based request mapping)

       Spring Interceptors has the ability to pre-handle and post-handle the web requests. Each interceptor class should extend the HandlerInterceptorAdapter class. Here we will create a Login Interceptor by extending the HandlerInterceptorAdapter class. You can override any of the three callback methods preHandle(), postHandle() and afterCompletion(). As the names indicate the preHandle() method will be called before handling the request, the postHandle() method will be called after handling the request and the afterCompletion() method will be called after rendering the view.