Skip to content

Instantly share code, notes, and snippets.

View shekhargulati's full-sized avatar

Shekhar Gulati shekhargulati

View GitHub Profile
@shekhargulati
shekhargulati / gist:779589
Created January 14, 2011 13:15
Spring Embedded database
<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"
xmlns:context="http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd"
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 http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd">
<jdbc:embedded-database id="embeddedDatasource" type="HSQL"/>
</beans>
@shekhargulati
shekhargulati / messages_hi.properties
Created May 14, 2011 08:03
Spring Roo Hindi message.properties translation
#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
button_cancel = \u0930\u0926\u094D\u0926
button_end = \u0905\u0902\u0924
button_find = \u0916\u094B\u091C\u0947\u0902
button_home = \u0918\u0930
@shekhargulati
shekhargulati / gist:1455072
Created December 10, 2011 12:39
ArrayStoreException
public class GenericsPlay<T> {
public void toArray(T t){
T[] array = (T[])Array.newInstance(t.getClass(), 100);
Object[] objs = array;
List<Double> doubles = new ArrayList<Double>();
doubles.add(Double.valueOf(12.4));
objs[0] = doubles;
}
@shekhargulati
shekhargulati / gist:1489623
Created December 17, 2011 08:03
A Java Puzzler
public static void main(String[] args) throws Exception {
List<String> words = Arrays.asList("hello","hi","hiya","hello world","bye","java","c++","python");
int count = 0;
for (String word : words) {
if (word.startsWith("h"));{
count++;
}
}
System.out.println("Count " + count);
}
@shekhargulati
shekhargulati / sphinx.conf
Created November 16, 2012 08:50
Sphinx Configuration file
#
# Sphinx configuration file sample
#
# WARNING! While this sample file mentions all available options,
# it contains (very) short helper descriptions only. Please refer to
# doc/sphinx.html for details.
#
#############################################################################
## data source definition
@shekhargulati
shekhargulati / sphinx-sphinx.conf
Created November 16, 2012 12:37
Sphinx Updated Configuration file
#
# Sphinx configuration file sample
#
# WARNING! While this sample file mentions all available options,
# it contains (very) short helper descriptions only. Please refer to
# doc/sphinx.html for details.
#
#############################################################################
## data source definition
@shekhargulati
shekhargulati / gist:4485762
Created January 8, 2013 17:19
Install Exiv2 C++ Library on OpenShift
cd app-root/data/
mkdir exiv2
cd exiv2/
wget http://www.exiv2.org/exiv2-0.23.tar.gz
tar -zxvf exiv2-0.23.tar.gz
cd ..
mkdir installation
cd installation/
cd ..
cd exiv2-0.23
# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
<?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@shekhargulati
shekhargulati / server.xml
Created July 9, 2013 09:23
Tomcat 8 server.xml required to deploy on OpenShift
<?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0