Posts

Importing / Indexing MySQL data into Solr

Apache Solr is a fast, full featured, open-source Java search server. It enables you to easily create search engines which index, search & analyze data from websites, databases or files. Before we proceed further I presume that you have already configured Solr server without data or refer to Solr in 5 minutes tutorial to configure your Solr server first. Configure your Solr server Step 1: To index your data firstly you need to define schema by editing file called  schema.xml  present at  <SOLR_HOME>/example/solr/conf/ Schema.xml in solr serves the similar purpose that table does in mysql In schema.xml file you have to define the Fields with there field type Field which should be used as unique key Which fields are required, indexed Default search field (deprecated in new versions) Default search operator (AND | OR deprecated in new versions) ​ **indexed fields are fields which undergo an analysis phase, and are added

Google: Sign-in attempt prevented while using STMP

Oflate if you are facing authentication issues while sending your emails via google STMP connection and getting emails like Subject:  Sign-in attempt prevented Hi, Someone just tried to sign in to your Google Account abc developrs@gmail.com from an app that doesn't meet modern security standards. Details: Thursday, January 21, 2016 12:17 PM (Eastern Standard Time) Bridgeport, CT, USA* We strongly recommend that you use a secure app, like Gmail, to access your account. All apps made by Google meet these security standards. Using a less secure app, on the other hand, could leave your account vulnerable. Learn more . Use this setting to make is accessible https://www.google.com/settings/u/0/security/lesssecureapps

Changing your YouTube video preview thumbnail

Image
To change preview thumbnail of your youtube video Option 1 You can choose a thumbnail from the three options that youtube automatically generates  Go to  Video Manager  by clicking on your  username  in the upper right corner. On the My Videos/Upload Page, click  Edit  for the corresponding video you'd like to change. Once you are on Edit Video Page you can choose from the three options provided by YouTube as highlighted in the screen grab below. Option 2 If don't find any image suitable for your video in the options provided by YouTube then you can also add a "Custom Thumbnail" for your video. Please note you will be able to see this option only if your YouTube account is a verified account . If you are already viewing the Custom Thumbnail option you can simply upload a image of your choice and set it as your video preview thumbnail. P.S. I would recommend to keep 16:9 ratio as it's the most used in YouTube Players and

Making PDF files SEO friendly

Image
Are you trying to figure out a way to get search engines to drill down your online PDF files and improve its ranking? If that is the case then you have a reason to cheer up :), this post will guide you to follow few very basic steps to improve your PDFs online visibility. Best Practices in SEO for PDF files Smartly name your PDFs -  Typically, the PDF filename will become part of the URL, so give your document a good key-word rich filename.  Set the PDF title - Yes, most of us just don't set PDF title properties, but the matter of fact is  that the title tag is a huge ranking factor. To set title of a PDF file, open it in Adobe Acrobat or any other PDF creator and go to, File --> Properties Set the other document properties too - don't  just  ignore the other properties provide a good Subject (Description) and Keywords as you do it for your HTMLs Prefer text-based PDFs over image-dominated PDFs Set "alt" text for all the images - this will also

Custom PagingNavigator for SEO friendly URL

Apache Wickets biggest strength is its focus on  components  - Among a very large set of components is PagingNavigator component. It is a Wicket Panel component to draw and maintain a complete page navigation. I found this component very useful but the only problem that compelled me to write my own CustomPagingNavigator is the wicket URLs that are being created by clicking the page links.  The Java Part... public class CustomPaginationLinksPanel<T> extends Panel{   private static final long serialVersionUID = 10002L;   /** Pageable List View to be displayed  */   private PageableListView<T> mainView ;   /** Max count of links  default  value = 5 */   private int linksPerPage = 5;   /**  Page Number currently visible */   private int    currPgNum ;     /** first page number */   private int firstNum ;   /** last page number */   private int lastNum ;   //Calculated on the basic of List size   private int maxPages ;

sorting a List containing Object[] elements

Problem Statement:  How can we  sort a List containing Object[] elements? The Solution: Ever wondered how to sort a list full of Object[]? The answer is to use a Comparator I have used an anonymous class which implements compare method to sort the List of Object[] package  example.collections; import  java.util.ArrayList; import  java.util.Collections; import  java.util.Comparator; import  java.util.List; public   class  Sorting {         public   static   void  main(String[] args) {               List<Object[]> list =  new  ArrayList<Object[]>();                             list.add( new  Object[]{123,  "abc" , 212});               list.add( new  Object[]{423,  "qwert" , 2131});               list.add( new  Object[]{656,  "asda" , 45});               list.add( new  Object[]{111,  "zxcz" , 43});               list.add( new  Object[]{10,  "poiu" , 890});               Collect

Showing tool-tip on a component in Wicket

Few days back I was working on an application which was using Apache Wicket and there was a requirement to show tool-tip on a component. After googling it for hours I found this really easy solution for my requirement.  The following code snippet shows how you can add a tool tip on a Label component. ... Label lbl = new Label( "myLable" , "My Label Value" ); lbl.add( new  AttributeModifier( "title" , true , new Model<String>( "My Tool-Tip" )));  ...

Enabling HTTPS request on Tomcat Server

Enabling HTTPS Request on Tomcat If you are developing a web application which is handling some sensitive data then you may want to use a secure medium for transferring the sensitive data between the web browser and your web server. SSL or Secure Socket Layer is an easy way to offer security to your users. SSL allows web browsers and web servers to encrypt all information and communicate it over a secured connection.  Hypertext Transfer Protocol Secure ( HTTPS ) is a widely used communication protocol for secure communication over the Internet. It is simply layering of HTTP over SSL protocol. When we say we are using HTTPS for secure connection, we mean to say that the information (request) is first encrypted using SSL and transmitted using HTTP protocol and then the receiver decrypts it using SSL. Apache Tomcat fully supports the SSL protocol and provides document on how to configure Tomcat to use SSL , but somehow I found it a little confusing for first time users. So here