Format:
Recent snippets for: Fernando Claverino
[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"});
31 Views
no comments
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>();
69 Views
no comments
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)
58 Views
no comments
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)
70 Views
no comments
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)
67 Views
no comments
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)
66 Views
no comments
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)
82 Views
no comments
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())); }
71 Views
no comments
public class AccountController : Controller { public IFormsAuthenticationService FormsService { get; set; } public IMembershipService MembershipService { get; set; } private ITokenAuthentication tokenAuthentication; public AccountController(ITokenAuthentication tokenAuthentication) { this.tokenAuthentication = tokenAuthentication;
167 Views
no comments
public interface ITokenAuthentication { string Login(string token); } public class JanRainAuthentication : ITokenAuthentication { private string apiKey; private string baseUrl;
189 Views
no comments
[TestClass] public class HelpCenterServiceTest : BaseTest { private Mock<IUnitOfWork> unitOfWork; private IHelpCenterService service; public static void MyClassInitialize(TestContext testContext) { IoCInitialize(); }
298 Views
1 comments
public class MyRegistry : Registry { public MyRegistry() { // DataContext ForRequestedType<DataContext>() .CacheBy(InstanceScope.HttpContext) .TheDefault.Is.ConstructedBy(() => new DataContext(DecriptConectionString())); // Unit of work
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; /**
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();
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("${");
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());
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(); }
212 Views
no comments
public interface WordTokenizer { void setText(String text); String getNextToken(String tokenizer); String getNextToken(); boolean hasNext(String tokenizer); WordTokenizer clone(); }
202 Views
no comments
<?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>
1304 Views
no comments
<?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>
1323 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
