CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets for: Fernando Claverino
C#
[TestFixture]
class NBuilderTest : NHibernateTest
{
    [Test]
    public void BuildStates()
    {
        using (GetPersistenceRequest())
        {
            ICrudDAO<State> dao = new CrudDAO<State>(sessionFactory);
            dao.Save(new State() { EntityId = 1, Name = "Buenos Aires"});
by Fernando Claverino   November 03, 2011 @ 7:27am
Tags:
31 Views
no comments
 
C#
class Anagram
{
    public string[] GetWords(string word)
    {
        return GetWords(word, word.Length);
    }
 
    private string[] GetWords(string word, int level)
    {
        IList<string> anagrams = new List<string>();
by Fernando Claverino   May 13, 2011 @ 1:50pm
Tags: kata
69 Views
no comments
 
C#
class Anagram
{
    public string[] GetWords(string word)
    {
        IList<string> anagrams = new List<string>();
        if (word.Length == 1)
        {
            anagrams = GetWords(word, 1);
        }
        else if (word.Length == 2)
by Fernando Claverino   May 13, 2011 @ 1:36pm
Tags: kata
58 Views
no comments
 
C#
class Anagram
{
    public string[] GetWords(string word)
    {
        IList<string> anagrams = new List<string>();
        if (word.Length == 1)
        {
            anagrams = GetWords(word, 1);
        }
        else if (word.Length == 2)
by Fernando Claverino   May 13, 2011 @ 1:34pm
Tags: kata
70 Views
no comments
 
C#
class Anagram
{
    public string[] GetWords(string word)
    {
        IList<string> anagrams = new List<string>();
        if (word.Length == 1)
        {
            anagrams = GetWords(word, 1);
        }
        else if (word.Length == 2)
by Fernando Claverino   May 13, 2011 @ 12:58pm
Tags: kata
67 Views
no comments
 
C#
class Anagram
{
    public string[] GetWords(string word)
    {
        IList<string> anagrams = new List<string>();
        if (word.Length == 1)
        {
            anagrams.Add(word);
        }
        else if (word.Length == 2)
by Fernando Claverino   May 13, 2011 @ 12:43pm
Tags: kata
66 Views
no comments
 
C#
class Anagram
{
    public string[] GetWords(string word)
    {
        IList<string> anagrams = new List<string>();
        if (word.Length == 1)
        {
            anagrams.Add(word);
        }
        else if (word.Length == 2)
by Fernando Claverino   May 13, 2011 @ 12:34pm
Tags: kata
82 Views
no comments
 
C#
class Anagram
{
    public string[] GetWords(string word)
    {
        IList<string> anagrams = new List<string>();
        anagrams.Add(word);
        if (word.Length == 2)
        {
            anagrams.Add(new string(word.Reverse().ToArray()));
        }
by Fernando Claverino   May 13, 2011 @ 12:21pm
Tags: kata
71 Views
no comments
 
C#
public class AccountController : Controller
{
 
    public IFormsAuthenticationService FormsService { get; set; }
    public IMembershipService MembershipService { get; set; }
    private ITokenAuthentication tokenAuthentication;
 
    public AccountController(ITokenAuthentication tokenAuthentication)
    {
        this.tokenAuthentication = tokenAuthentication;
by Fernando Claverino   April 03, 2011 @ 3:18pm
167 Views
no comments
 
C#
public interface ITokenAuthentication
{
    string Login(string token);
}
 
 
public class JanRainAuthentication : ITokenAuthentication
{
    private string apiKey;
    private string baseUrl;
by Fernando Claverino   April 03, 2011 @ 3:13pm
189 Views
no comments
 
C#
[TestClass]
public class HelpCenterServiceTest : BaseTest
{
    private Mock<IUnitOfWork> unitOfWork;
    private IHelpCenterService service;
 
    public static void MyClassInitialize(TestContext testContext)
    {
        IoCInitialize();
    }
by Fernando Claverino   December 28, 2009 @ 2:04pm
298 Views
1 comments
 
C#
public class MyRegistry : Registry 
{
    public MyRegistry()
    {
        // DataContext
        ForRequestedType<DataContext>()
            .CacheBy(InstanceScope.HttpContext)
            .TheDefault.Is.ConstructedBy(() => new DataContext(DecriptConectionString()));
 
        // Unit of work
by Fernando Claverino   December 28, 2009 @ 1:58pm
582 Views
1 comments
 
package tocla.repository.olap;
 
import java.util.Map;
import java.util.StringTokenizer;
 
import tocla.model.Filter;
import tocla.repository.QueryBuilder;
import tocla.repository.WordTokenizer;
 
/**
by Fernando Claverino   October 18, 2009 @ 9:32pm
Tags:
135 Views
no comments
 
/**
 * Evaluate DSL expression and return filter value
 * @param dslExpression
 * @param filters
 * @return
 */
private String evalDslExpression(String dslExpression, Map<String, Filter> filters) {
    // Get filter name
    StringTokenizer dslTokenizer = new StringTokenizer(dslExpression, ".(");
    String filterName = dslTokenizer.nextToken();
by Fernando Claverino   October 18, 2009 @ 9:21pm
260 Views
no comments
 
public String buildQuery(String query, Map<String, Filter> filters) {
    StringBuilder queryBinded = new StringBuilder();
    
    WordTokenizer wordTokenizer = wordTokenizerSingleton.clone();
    wordTokenizer.setText(query);
    
    // Iterate over internal dsl expressions
    while(wordTokenizer.hasNext("${")) {
        // get query part
        String queryPart = wordTokenizer.getNextToken("${");
by Fernando Claverino   October 18, 2009 @ 8:11pm
Tags: dsl mdx
221 Views
no comments
 
public class WordTokenizerTest extends BaseTest {
    @Autowired
    private WordTokenizer wordTokenizer;
    
    @Test
    public void tokenizerDslFilter() {
        wordTokenizer.setText("select {${brand}}");
        assertEquals("select {", wordTokenizer.getNextToken("${"));
        assertEquals("brand", wordTokenizer.getNextToken("}"));
        assertEquals("}", wordTokenizer.getNextToken());
by Fernando Claverino   October 18, 2009 @ 8:09pm
183 Views
no comments
 
public class WordTokenizerString implements WordTokenizer {
    private String text;
    private String ltext;
    
    @Override
    public void setText(String text) {
        this.text = text;
        this.ltext = text.toLowerCase();
    }
    
by Fernando Claverino   October 18, 2009 @ 8:07pm
212 Views
no comments
 
public interface WordTokenizer {
    void setText(String text);
    String getNextToken(String tokenizer);
    String getNextToken();
    boolean hasNext(String tokenizer);
    WordTokenizer clone();
}
by Fernando Claverino   October 18, 2009 @ 8:05pm
202 Views
no comments
 
XML
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
  xmlns:beans="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
              http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.4.xsd"> 
    <http auto-config='true'>
        <intercept-url pattern="/**" access="ROLE_USER" />
    </http>
    <authentication-provider>
by Fernando Claverino   September 27, 2009 @ 9:26am
1304 Views
no comments
 
XML
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
    <display-name>toclasaas</display-name>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
by Fernando Claverino   September 27, 2009 @ 9:24am
1323 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate