Skip to content

Instantly share code, notes, and snippets.

View timoteoponce's full-sized avatar

Timoteo Ponce timoteoponce

View GitHub Profile
@timoteoponce
timoteoponce / word-count-1.md
Created August 1, 2017 15:27
Exercise: Word-count-1

Word count

TLDR: The program to write must calculate words frequency from a given file.

We will provide you a file with some text on it, and you have to open it and find the frequencies of all words in it having the following requirements:

  • Assume a valid UTF-8 input file
  • All words must be processed in lower case (ignore case) Output must be sorted by word alphabetically
  • Output must have one entry per word, having its frequency next to it
@timoteoponce
timoteoponce / wildfly-8-https-how-to.md
Created June 9, 2017 17:42
Describes the steps needed to enable https on wildfly-8

Generate a certificate (only for testning)

  • Generate key
keytool -genkey -alias foo -keyalg RSA -keystore foo.keystore -validity 10950
Enter keystore password: secret
Re-enter new password: secret
What is your first and last name?
  [Unknown]:  foo.acme.com
What is the name of your organizational unit?
@timoteoponce
timoteoponce / EXERCISE: Messaging service-spring.md
Created March 14, 2017 22:58
EXERCISE: Messaging service-spring.md

Exercise: Messages list service

This exercise consists on creating a REST service that allows external applications to create and manage message lists, basically there are two contexts:

  • User management: Services that allow the register, update or removal of users
  • Messages management: Services that allow message exchange between registered users

So the service will allow users to be registered, send messages between them and retrieve all the messages directed to a specific user.

## Example

@timoteoponce
timoteoponce / EXERCISE: Messaging service-play.md
Created March 14, 2017 22:57
EXERCISE: Messaging service-play.md

Exercise: Messages list service

This exercise consists on creating a REST service that allows external applications to create and manage message lists, basically there are two contexts:

  • User management: Services that allow the register, update or removal of users
  • Messages management: Services that allow message exchange between registered users

So the service will allow users to be registered, send messages between them and retrieve all the messages directed to a specific user.

## Example

@timoteoponce
timoteoponce / EXERCISE: Messaging service.md
Last active February 13, 2017 20:37
EXERCISE: Message service

Exercise: Messages list service

This exercise consists on creating a REST service that allows external applications to create and manage message lists, basically there are two contexts:

  • User management: Services that allow the register, update or removal of users
  • Messages management: Services that allow message exchange between registered users

So the service will allow users to be registered, send messages between them and retrieve all the messages directed to a specific user.

## Example

@timoteoponce
timoteoponce / dates.java
Created July 18, 2016 17:14
Simple joda-time comparison demo
int difference = 0;
DateTime start = new DateTime(source);
DateTime end = new DateTime(target);
if (source.after(target)) {
start = end;
end = new DateTime(source);
}
switch (type) {
case MONTHS:
difference = Months.monthsBetween(start, end).getMonths();
@Stateless @LocalBean
public class MyClass{
@Resource(lookup = "java:openejb/Resource/helloDS")
private DataSource dataSource;
public int countSql(){
Connection conn = datasource.getConnection();
Statement st = null;
try{
@timoteoponce
timoteoponce / ruby_warrior_beginnner.rb
Created October 3, 2014 19:36
ruby warrior solution-beginner
class Player
def initialize
@direction = :forward
end
def feel
return @warrior.feel @direction
end
@timoteoponce
timoteoponce / domain2.java
Created September 17, 2012 04:17
Domain query 2
User user = userLister.withName( param1 ).get(0);
doSomething( user );
// and what about something more complex?
List<User> list = userLister.withName( name ).beingSingle( true ).withChidrenGt( 3 ).list();
@timoteoponce
timoteoponce / jpa1.java
Created September 17, 2012 04:13
JPA entityManager
User user = (User)entityManager.createQuery( "SELECT t FROM User t WHERE t.name like :param1" ).setParam("param1",parameter).singleResult();
doSomething( user );