Skip to content

Instantly share code, notes, and snippets.

View visvv's full-sized avatar

Vishnu V V visvv

View GitHub Profile
$(function () {
"use strict";
// for better performance - to avoid searching in DOM
var content = $('#content');
var input = $('#input');
var status = $('#status');
// my color assigned by the server
var myColor = false;
@visvv
visvv / ArraysMain
Last active August 29, 2015 14:10 — forked from pradeep-shettar/ArraysMain
package test.programs;
import java.util.ArrayList;
import java.util.List;
public class ArraysMain {
public static void main(String[] args) {
// merge two lists by removing duplicates.
List<Integer> list1 = Arrays.asList(new Integer[]{4,6,7,7,8});
@visvv
visvv / gist:c116b861664cbd3b163a
Created November 28, 2014 04:43
// Merge only duplicate elements in two array list .
// // Merge only duplicate elements in two array list .
package com.gallery.controller;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.FileUtils;
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- this tag instructs spring container to load all the classes which are
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<html>
<head>
<title>Spring MVC Multiple File Upload</title>
<!-- script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> -->
</head>
<body>
package com.gallery.util;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
public class FileUtil {
package com.gallery.dto;
import java.util.ArrayList;
import java.util.List;
import org.springframework.web.multipart.MultipartFile;
public class UserDetails {
private MultipartFile file;
Find the elements that appears once in a sorted array.
INPUT :
1,1,2,3,3,4,4
OUTPUT : 2
INPUT :
1,1,2,2,3,3,4,4,5
OUTPUT : 5
@visvv
visvv / AppearOnceAlt.java
Created July 15, 2015 08:07
Find the element that appear once in a sorted array.
// Find the element that appear once in a sorted array.
public class AppearOnceAlt{
public static void main(String[] args){
int[] arr = new int[]{1,1,1,1,2,2,3,4,4,4,4,5};
appear(arr);
}
public static void appear(int[] arr){
int elem = arr[0];
int old = elem;