Skip to content

Instantly share code, notes, and snippets.

View chaitanyamannem's full-sized avatar

Chaitanya Mannem chaitanyamannem

View GitHub Profile
@chaitanyamannem
chaitanyamannem / Sample Java Program.java
Last active December 23, 2015 14:09
Sample test Java program
package com.devchaitu18.ipj.collections.maps.usecases;
import java.util.HashMap;
import java.util.Map;
public class MapContains {
/**
* @param args
*/
@chaitanyamannem
chaitanyamannem / BreakStatementMistake1Resolved.java
Last active December 23, 2015 14:59
Common Mistake Break Statement
package com.devchaitu18.ipj.controlflow.breakstmt.mistakes;
/**
* Objective: To parse a String of the form "11&22&33&44&&55xyz&66&77&88&99"
* into list of numbers and display them. Mistake: Try to find the mistake in
* this program correct it.
* Solution: Add a break statement at line 26
* Description: If we don't give the break here the program continues to evaluate
* the string which is unecessary waste of execution time.
* @author devchaitu18
@chaitanyamannem
chaitanyamannem / AStringEqualityMistakeUnresolved.java
Last active December 24, 2015 19:39
Common String Equality comparision mistake.
package com.devchaitu18.ipj.strings.mistakes;
/**
* Find the common mistake in this program.
*
* @author devchaitu18
*
*/
public class StringEqualityMistakeUnresolved {
@chaitanyamannem
chaitanyamannem / GeneratedJSpJavaFile.java
Created October 7, 2013 05:22
JSP: Static inclusion example
/*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/7.0.42
* Generated at: 2013-10-07 05:19:37 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp;
@chaitanyamannem
chaitanyamannem / solrconfig.xml
Created May 11, 2016 07:02
The xml declaration for solr custom function
<valueSourceParser name="availability" class="com.solrExample.solr4.PetcareAvailabilityParser" />
@chaitanyamannem
chaitanyamannem / AvailabilityValueSource.java
Created May 11, 2016 07:19
Implementation of solr custom function class which extends ValueSource
package com.solrExample.solr4;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
@chaitanyamannem
chaitanyamannem / AvailabilityParser.java
Created May 11, 2016 07:30
Parser class to parse the arguments of custom solr function
package com.solrExample.solr4;
import org.apache.lucene.queries.function.ValueSource;
import org.apache.solr.search.FunctionQParser;
import org.apache.solr.search.SyntaxError;
import org.apache.solr.search.ValueSourceParser;
/**
*
import java.io.IOException;
import java.nio.file.*;
import java.util.stream.*;
public class Main {
public static void main(String[] args) {
Stream<String> filenames = null;
try {
filenames = Files.lines(Paths.get("first.txt"));
}catch (IOException ioe){
ioe.printStackTrace();
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVParser;
import org.apache.commons.csv.CSVRecord;
import java.io.BufferedReader;
import java.io.FileReader;
public class CsvReader {
public static void main(String[] args) {
try(
BufferedReader br = new BufferedReader(new FileReader("Sacramentorealestatetransactions.csv"));
<img width="696" alt="image" src="https://user-images.githubusercontent.com/4608129/83413378-5be44880-a439-11ea-8715-422b077d1163.png">