Skip to content

Instantly share code, notes, and snippets.

@bchetty
bchetty / jsf12-facelets-maven-archetype
Created November 29, 2012 14:14
Maven Archetype for Web Application with Technology Stack: JSF 1.2, Facelets
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.bchetty</groupId>
<artifactId>jsfFacelets</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>JSF12-Facelets-WebApp ${project.version}</name>
<url>http://maven.apache.org</url>
@bchetty
bchetty / jsf12-facelets-facesconfig-xml
Created November 29, 2012 14:16
Faces Config for JSF12, Facelets Web App
<?xml version="1.0"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<application>
<locale-config>
<default-locale>en</default-locale>
</locale-config>
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
</application>
@bchetty
bchetty / jsf12-facelets-Web-Xml
Created November 29, 2012 14:34
Web.xml for JSF 1.2, Facelets Web Application
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>JSF12-Facelets-WebApp</display-name>
<context-param>
<param-name>com.sun.faces.verifyObjects</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
@bchetty
bchetty / TicTacToe.java
Last active December 16, 2015 16:58
GCJ 2013 - Tic-Tac-Toe-Tomek
package com.bchetty.gcj2013;
/**
*
* @author Babji Prashanth, Chetty
*/
public class TicTacToe {
//Possible 'X' winning combination strings
public static final String xWin1 = "XXXX";
public static final String xWin2 = "XXXT";
@bchetty
bchetty / pom.xml
Created April 26, 2013 12:59
POM.XML for 'Fair And Square' Project (Google Code Jam 2013)
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.bchetty</groupId>
<artifactId>gcj2013</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>gcj2013</name>
@bchetty
bchetty / FairAndSquare.java
Created April 26, 2013 13:06
Solution for 'Fair And Square' problem statement from Google Code Jam 2013
package com.bchetty.gcj2013;
import java.io.*;
import java.math.BigInteger;
import java.util.Map;
import java.util.NavigableMap;
import org.jscience.mathematics.number.LargeInteger;
import org.mapdb.DB;
import org.mapdb.DBMaker;
@bchetty
bchetty / MimeTypes.java
Last active December 17, 2015 10:49
Mime Types Enum
/**
* Mime Types Enum
* Source Ref: http://www.java2s.com/Code/Java/Network-Protocol/enumMimeType.htm
*
* @author Babji Prashanth, Chetty
*/
public enum MimeTypes {
$323 ("text/h323"),
$3gp ("video/3gpp"),
$7z ("application/x-7z-compressed"),
@bchetty
bchetty / RecycledNumbers.java
Last active December 17, 2015 16:29
GCJ 2012 - Recycled Numbers
import java.util.HashSet;
/**
*
* @author Babji Prashanth, Chetty
*/
public class RecycledNumbers {
public int findNumberOfPairs(int A, int B) {
int res = 0;
int len = ("" + A).length();
@bchetty
bchetty / DancingGooglers.java
Created May 23, 2013 19:30
GCJ 2012 - Dancing With Googlers
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
/**
*
* @author Babji Prashanth, Chetty
*/
public class DancingGooglers {
public int findMaxGooglers(int N, int s, int p, ArrayList<Integer> scoreList) {
@bchetty
bchetty / Euler's Number (e)
Created May 23, 2013 19:37
Euler's Number (e) to 10000 digits
2.71828182845904523536028747135266249775724709369995957496696762772407663035354
759457138217852516642742746639193200305992181741359662904357290033429526059563
072731008532378052751063686487016953141865527484590824495504533928649764277413
664165964636632508736091584134397099983170353823380092116814655415374930542022
2461709321230949167763499311130703029256989342067643919136650384873578846610775
725576307921898867353790419412043377406494907073863079049248976437069836297366
862198429250767700214157406500293826954406871877954270969766247465243666295138
572019208303177269234097701656745392257779147341603684935723103304485761429026
633263529379734450400061311941647086898259755208734782937085387009434178080656
799728070459503917013351431243873005220184059659629058572148124084211850064775