Solution for: browser won’t load certain websites on a Mac

In many cases, this problem occurs, when a browser can’t resolve a host. I.e. it cannot find an IP address for a certain domain name in DNS servers. This happens, when your provider is too slow in updating DNS entries from all over the world when they are changed by administrators of web sites.

In case your browser won’t load certain websites, you can try to add DNS entries for those sites manually in your hosts file. To do this do the following:

1. In Terminal type the following:

so that you begin to edit your hosts file

2. Enter the password for your admin user on your mac.

3. Press “I” to enter Insert mode in Vim.

4. Go to the end of file and type IP addresses and corresponding domain names:

5. Press Esc. And type “:wq” to save and exit from vim.

6. Ready! You can now try to open your web sites.

If you don’t know IP address for your site, you can ping it on some other computer to determine the IP address or use web sites for this purpose to determine IP by domain name. For example, this one.

On TextView Hints and StringUtils.isBlank

I had a problem caused by setting empty or blank strings to the TextView and AutoCompleteTextView – hints were invisible after that. So I decided to check strings, that are set, if they were not only empty, but also not blank. I used StringUtils.isBlank instead of StringUtils.isEmpty: it works much better now, and hints are always visible. If you don’t still use StringUtils, I highly recommend you to do. This is a Gradle import for a library that contains them:

And another example with AutoCompleteTextView:

Here is some information on how isNotEmpty and isNotBlank are working.

Title of this article: On Android TextView and AutoCompleteTextView Hint and StringUtils.isBlank and .isEmpty

How to find an e-mail in Ubuntu, that appears in logs

I had a problem on Ubuntu server. Some guy has added his e-mail somewhere and the server tried to send him e-mails. So Google responded, that it was spam and blocked them. I have searched using grep in logs this way:

And got this kind of entries in mail.log and others:

For a while I couldn’t find a problem place and didn’t know, where to fix. I tried to list cron jobs:

But without a success.

Finally, I did search using grep recursively and found some files, where this e-mail appeared:

Because it was in *.db files, I couldn’t fix it by just editing config files in PostFix.

And because PostFix is not used in the server, I just removed it:

To install e-mail server on Ubuntu or just to use web mail services?

My goal was to create e-mails like and use these e-mails outside the server, by accessing them using IMAP and SMTP protocols.

Unfortunately, instead of trying to find the most beautiful, fast and feature-rich solution, I decided to setup an e-mail server on Ubuntu on the basis of PostFix (running on a v-server at Hetzner hosting). It is a private server, that doesn’t support e-mail serving by default – you have to setup it yourself. Trying to create something great on Ubuntu for a not red eye Linux geek is like trying to build Boeing 747 by yourself. But I decided to accept this challenge without thinking much and wasted a ton of time as a result. I tried hard for 2 days and all that I had achieved is e-mail forwarding from my server to the Google e-mail.

I tried to use DoveCot and Courier to enable IMAP or POP, but without a success. I couldn’t connect Apple Mail to the resulting e-mail server and make it work. I worked with a lot of configuration files, tried to setup correctly SASL, etc. but at the end I understood, that this is a too hard work to create just an e-mail server. I understood that this must not be a correct way to go. Look for instance at this tutorial. Of course, it is a possiblity, but it works with a very little features and very hard to achieve good functionality. Look at these terrible configs:

I didn’t want to become a Linux geek with red eyes, but I did… The way of creating e-mail server on Ubuntu from scratch appeared to be absolutely unproductive because of tons of problems during configuration and a little number of features at the result. After some time I decided to look at Yandex and Google e-mail services for corporate businesses, when you use their e-mail servers by redirecting from your own domain. And I am glad, I decided to try! At the end, I created the goal e-mail server using Yandex. Yandex service is called a Mail for domain.

All I had to do – is to setup DNS entries, MX entries particularly and put one file to the root folder of the site.

Look, how nicely it works now both on Apple Mail and via Web Interface on Yandex:


And here is how to setup IMAP and SMTP on Apple Mail or any other E-mail client.

Shell scripts that copy, rename files and resize, crop images

I have written a bunch of shell scripts for my Mac, that do a lot of work automatically.

First script renames all files in a folder sequentially and gives the names with numbers starting from 64:

The second script creates copies of those files and adds “_mini” to the file name. It creates future miniatures of images.

The third script deletes all files in a folder that do not match a pattern with “_mini” word:

And the last script crops images to the given size:

It is also possible to resize images in other ways, for example percentage:

Here are the full instructions for ImageMagick.

Here is an information on copying files.

And here is an information on deleting by pattern.

Finally we get something like this:
Снимок экрана 2014-08-15 в 0.15.56

Final script:

This script rename files with spaces in their file names:

Here you can read more about treating spaces in file names in bash scripts.

Apache config file with multiple VirtualHosts

I wanted to be able to open sites like * and * besides main sites and This is how I solved this problem – by editing Apache config file, making it much simpler and by using ServerNames instead of ServerAliases.

And this is how the tree looks like:
Снимок экрана 2014-08-13 в 16.57.17

Do not forget to reload Apache after editing conf file, which lies here: /etc/apache2/sites-available:

So, now the following sites are working:

I am now a Friend of Eclipse

I was awarded a status of a Friend of Eclipse.

I like Eclipse, since it is free and powerful. I was using it for Android development for free and created a lot of staff, that is why I decided to help Eclipse team. Although I have moved to Android Studio recently, currently I use Eclipse Luna for developing web applications for Google App Engine.

Solving Google App Engine : 500 Server Error

I started to learn Google App Engine. Everything was perfect – tutorials, easiness of testing on development server before I wanted to deploy it on server. I knew that I had to use Java 7 instead of Java 8, which is currently supported by App Engine, but didn’t know, where I should change it easily to make this happen, since I used Maven.

This error happened to me:
Server Error The server encountered an error and could not complete your request. Please try again in 30 seconds.

In errors of my app on App Engine Console I saw this:
Uncaught exception from servlet java.lang.UnsupportedClassVersionError: org/apache/jsp/guestbook_jsp : Unsupported major.minor version 52.0 at com.go

You can see logs this way:

You can check your java version:

This is solution:

Then go to profile:

And change your JAVA_HOME variable:

Update that variable:

And now rebuild your AppEngine project and redeploy it on server:

Now check your application on browser:

Gradle build file for a project with Android Annotations

There is a sample Gradle build file for a project with Android Annotations. This is pretty complicated stuff, that was achieved with a lot of my blood, so I decided to post it here, so that you can use it to try to find your mistakes. Android Annotations library is loaded with apt. The position of every setting is important. There is also a trick to avoid Lint errors and a custom task to run app via command line.

I used Gradle 1.12 and Android Studio 0.8.4 with Android SDK 20, Android Build Tools 20.0 and Android Plugin 0.12.+.