Skip to content

Instantly share code, notes, and snippets.

View rokon12's full-sized avatar
🎯
Focusing

A N M Bazlur Rahman rokon12

🎯
Focusing
View GitHub Profile
hello
@rokon12
rokon12 / FirstNonRepeatedWordFinder.java
Created September 10, 2012 12:47
Problems # 1: Suppose you have a plain text file. Write a simple java program to find out the first non-repeated word in the file.
package com.therapjavafest.puzzle;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Hashtable;
import java.util.Map;
@rokon12
rokon12 / Exceptions.java
Created November 25, 2012 12:47
Exceptions
2012-11-25 18:48:01,970 [main] ERROR org.springframework.test.context.TestContextManager - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@10f4d43] to prepare test instance [com.codexplo.antsonfire.UserServiceTest@199a2ab]
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:157)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211)
at org.springframewor
@rokon12
rokon12 / submitform.js
Created December 14, 2012 21:27
I'm trying to encode an url using Unicode character
function submitForm() {
var publicUrl = jQuery("#public_url").val();
alert(encodeURIComponent( publicUrl));
jQuery.ajax("/write/publicurl/" + encodeURIComponent(publicUrl) + "/" + ${content.id} +"/",
{
type: "POST"
});
}
@rokon12
rokon12 / TodoControllerTest.java
Created January 7, 2013 04:34
TodoControllet Test Case
package com.codexplo.todo.web;
import com.codexplo.todo.domain.Todo;
import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.mock.web.MockHttpServletRequest;
@rokon12
rokon12 / RPG.java
Last active December 10, 2015 22:58
The Quick And Dirty RPG
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Random;
/**
* Created with IntelliJ IDEA.
* User: Bazlur Rahman Rokon
* Date: 1/10/13
* Time: 11:28 PM
@rokon12
rokon12 / UserBeanTest.java
Created February 11, 2013 04:43
OpenEJB Test Case
package com.codexplo.sleepingkit.bean;
import com.codexplo.sleepingkit.domain.User;
import org.junit.Before;
import org.junit.Test;
import javax.naming.Context;
import javax.naming.InitialContext;
import java.util.Properties;
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="persistDB">
<jta-data-source>jdbc/sleepingkit</jta-data-source>
<!--<provider>org.hibernate.ejb.HibernatePersistence</provider>-->
<class>com.codexplo.sleepingkit.domain.Users</class>
<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/maven-v4_0_0.xsd">
<parent>
<artifactId>sleepingkit</artifactId>
<groupId>sleepingkit</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>sleepingkit</groupId>
<bean
class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
<property name="mediaTypes">
<map>
<entry key="json" value="application/json"/>
<entry key="xml" value="text/xml"/>
<entry key="htm" value="text/html"/>
</map>
</property>
<property name="favorParameter" value="true"/>