Indexing office files is one of the common case while developing search applications. In my case I needed to index slides of a presentation in which title and content needs to indexed separately as we need to provide high boosting for title. But while extracting title for slides using XSLFSlide objects method getTitle(). Title is not getting returned for many slides.
A solr core needs so many configuration files. They look different for master and slave. Also some files like data-config.xml are different for environments when you have data sources to index from. With these permutations, you might end up with large sets of config files. Here I have explained how I managed maintain only single set for all servers and all environments.
I almost spent a day trying to understand why my unit test case was able to load a resource where as once I deploy the jar failed to load the same. In the end I came across something very basic : Some.class.getResource behaves differently than Some.class.getClassLoader.getResource. There is no simple answer like use this always. It depends on which class loaded loading that particular class. So if you are facing such issue try checking both options.
How many times have you banged your head against the monitor or seen others doing so when the poor dumb machine goes dumb literally!? Must be a lot of times for most developers. If not, you are a blessed child and you need not read further.There is no use if you keep hitting the ENTER button or keep yelling at your machine when the machine cannot support what you want it to do… Now-a-days, companies are after new languages and technologies like RoR, Scala etc to improve developer speed. They have started following agile methodologies and hiring expensive coaches; paying a lot for agile certifications (really a lot😦 ). Yes, all of these have actually improved efficiency. But in the thick of such ‘big’ things, aren’t they missing out basic stuff which will enhance developer efficiency? For instance, is it not a basic necessity to have a proper work environment, proper infrastructure that can support such ‘big’ things?
How many of you believe you have quality code because you have good test coverage? Or how many of you feel you are working with bad quality legacy code because it doesn’t have any test coverage? Recently every organization started focusing on quality especially automation. Started putting people to increase unit test coverage. But did you question : Did you gain anything out of it? Is your code quality improved? How long these test cases will be relevant ? Do you think developers would be comfortable modifying it when code changing?
When it comes to quality first thing we say is “90%” code coverage. To me whats important is 100% coverage for code that is doing some non-trivial work. For java code you can avoid trivial code and classes easily . Just use following configuration.
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <version>2.6</version> <configuration> <formats> <format>xml</format> <format>html</format> </formats> <instrumentation> <ignoreTrivial>true</ignoreTrivial> <excludes> <exclude>**/some/trivial/classes/**</exclude> </excludes> </instrumentation> </configuration> <executions> <execution> <goals> <goal>clean</goal> <goal>check</goal> </goals> </execution> </executions> </plugin>
// This is used in the local environment. comment this when deploying to Unix box // File propertyFile = new File("Some.properties"); // This is used when deploying in Unix this is used. File propertyFile = new File("/home/mr.x/secrtet/prod.path/some.properties");
Above code is self explanatory. Too good code and superb documentation😉 .