Skip to content

Instantly share code, notes, and snippets.

@ekirastogi
ekirastogi / MainActivity.java
Last active October 19, 2015 19:51
Android : Custom List View
package com.ekiras.demo;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ListView;
import com.ekiras.demo.adapter.PersonAdapter;
import com.ekiras.demo.model.Person;
import java.util.ArrayList;
@ekirastogi
ekirastogi / CorsFilter.java
Created October 22, 2015 09:20
CORS filter to allow cross domain ajax calls
package com.ekiras.filter;
import org.springframework.stereotype.Component;
import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Created by ekansh on 22/10/15.
@ekirastogi
ekirastogi / MainActivity.java
Last active October 22, 2015 21:10
Android: Infinite scroll using list view
package com.ekiras.demo;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.AbsListView;
import android.widget.ListView;
import com.ekiras.demo.adapter.PersonAdapter;
import com.ekiras.demo.model.Person;
@ekirastogi
ekirastogi / MainActivity.java
Created October 24, 2015 19:26
Android : Pull to Refresh on List View
package com.ekiras.demo;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.AbsListView;
import android.widget.ListView;
import com.ekiras.demo.adapter.PersonAdapter;
import com.ekiras.demo.model.Person;
@ekirastogi
ekirastogi / SecurityFilter.java
Last active June 10, 2018 04:57
How to define Filter order in Filter Chain in Spring Boot
package com.ekiras.filter;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import javax.servlet.*;
import java.io.IOException;
/**
* Created by ekansh on 22/10/15.
@ekirastogi
ekirastogi / SecurityFilter.java
Created October 27, 2015 13:30
How to register a Filter in spring boot application
package com.ekiras.filter;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import javax.servlet.*;
import java.io.IOException;
/**
* Created by ekansh on 22/10/15.
@ekirastogi
ekirastogi / Bootstrap.java
Created October 30, 2015 23:09
Spring Boot : How to create a Bootstrap class.
package com.ekiras.bootstrap;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.logging.Logger;
/**
* Created by ekansh on 31/10/15.
package com.ekiras.demo;
import com.hazelcast.client.HazelcastClient;
import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.core.HazelcastInstance;
/**
* Created by ekansh on 1/11/15.
*/
@ekirastogi
ekirastogi / FileDemo
Created November 11, 2015 17:04
How to create a File in Java using FileWriter
package com.ekiras.demo;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Date;
class FileDemo {
public static void main(String args[]) {
@ekirastogi
ekirastogi / TestCASRest.java
Created November 17, 2015 19:49
Test CAS Rest API from Java Code
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;