Skip to content

Instantly share code, notes, and snippets.

View AntonioDiaz's full-sized avatar
🤓

Antonio Diaz Arroyo AntonioDiaz

🤓
View GitHub Profile
@AntonioDiaz
AntonioDiaz / maven_dependencies.xml
Last active November 28, 2016 09:23
maven dependencies for Spring MVC project
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.2.13.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
@AntonioDiaz
AntonioDiaz / MyController.java
Created November 28, 2016 09:25
minimun Spring MVC controller
package com;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class MyController {
@AntonioDiaz
AntonioDiaz / web.xml
Created November 30, 2016 07:09
config for Spring MVC project.
<servlet>
<servlet-name>spring-web</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
@AntonioDiaz
AntonioDiaz / applicationContext.xml
Last active November 30, 2016 14:51
applicationContext for Spring MVC project.
<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:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd">
<context:component-scan base-package="com" />
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>xxx</title>
</head>
package mypackage;
import java.io.*;
import java.util.*;
public class ThisClassName {
public static void main(String[] args) throws IOException {
InputStream inputStream = ThisClassName.class.getClassLoader().getResourceAsStream("config.properties");
Properties properties = new Properties();
properties.load(inputStream);
@AntonioDiaz
AntonioDiaz / TemplateTest.java
Created December 18, 2016 12:27
jUnit template
package algorithms.easy;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class TemplateTest {
@Test
public void changedLettersInput01(){
MarsExploration marsExploration = new MarsExploration("SOSSPSSQSSOR");
@AntonioDiaz
AntonioDiaz / MainActivity.java
Created December 24, 2016 16:31
Android ContentProvider access example.
package android.example.com.dictionaryproviderexample;
import android.content.ContentResolver;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.UserDictionary;
import android.provider.UserDictionary.Words;
import android.support.v7.app.ActionBarActivity;
import android.widget.TextView;
@AntonioDiaz
AntonioDiaz / UsingSimpleCursorAdapter.java
Last active January 4, 2017 06:52
CursorAdapter.java example.
package android.example.com.dictionaryproviderexample;
import android.content.ContentResolver;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.UserDictionary;
import android.support.v7.app.ActionBarActivity;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
@AntonioDiaz
AntonioDiaz / WeatherContract.java
Created December 28, 2016 18:46
Defines table and column names for the weather database.
package com.example.android.sunshine.app.data;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.net.Uri;
import android.provider.BaseColumns;
import android.text.format.Time;
/** Defines table and column names for the weather database. */
public class WeatherContract {