Category Archives: Java

JSON remove new lines via Linux and use it as string variable and as param in cURL POST request

Today I had to parse a JSON response in a JUnit test and then reuse it in a cURL command line call. Unfortunately I could not read the JSON response from a file or from an HTTP request, so I … Continue reading

Posted in Java, Linux, Mint, Ubuntu | Tagged , , , , , , , | Leave a comment

Solr fix corrupted index using Lucene

A few days ago, a Solr server in our SolrCloud installation stopped unexpectedly. After examining solr.log file I spotted that it could not start again because index.20140510031827076 file was corrupted. After some searching I found this Lucidworks article which described … Continue reading

Posted in Apache, Java, Linux, Lucene, Solr, Windows | Tagged , , , , , , , , , , , , | 1 Comment

Read SMS directly from Sqlite database in Android

Today I wanted to extract the SMS content out of the android SMS application SQLite database using ADB. NOTE: The whole procedure was tested on a rooted phone running Cyanogenmod Android. It may not work on unrooted phones So I … Continue reading

Posted in Android, Databases, Linux, SQLite | Tagged , , , , , , , , , , , , | 28 Comments

Java send smtp mail using Gmail

Today I wanted to make a mail notification mechanism for a project of mine. After some web searching I stumbled upon a tutorial where he uses SMTP with Java Mail API to send emails via Gmail. I modified the … Continue reading

Posted in Java, Networking, smtp | Tagged , , , , , , | Leave a comment

Java String Util Class

Unfortunately, Java does not include a proper String manipulation class in its Java SE SDK. I really do not understand why… However, we see so many implementations and libraries including the distinguished Apache Commons Lang and android.text package. If your … Continue reading

Posted in Android, Java | Tagged , , , , , , | Leave a comment

Java Calculate Orthodox Easter Date

Today I wondered if there is an algorithm to calculate the date of Orthodox Easter. After some searching in the web I found the algorithm and converted it to Java code.

Posted in Android, Java | Tagged , , , | Leave a comment

Java get file size and download using HTTP

Today I wanted to download a file using Http protocol but before that determine its size. First aff all I open an Http connection and get file size using Content-Length header (see getFileSize method). Then I download the binary file. … Continue reading

Posted in Java | Tagged , , , , | Leave a comment