This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.HashMap; | |
import java.util.Map; | |
public enum State { | |
ALABAMA("Alabama", "AL"), ALASKA("Alaska", "AK"), AMERICAN_SAMOA("American Samoa", "AS"), ARIZONA("Arizona", "AZ"), ARKANSAS( | |
"Arkansas", "AR"), CALIFORNIA("California", "CA"), COLORADO("Colorado", "CO"), CONNECTICUT("Connecticut", "CT"), DELAWARE( | |
"Delaware", "DE"), DISTRICT_OF_COLUMBIA("District of Columbia", "DC"), FEDERATED_STATES_OF_MICRONESIA( | |
"Federated States of Micronesia", "FM"), FLORIDA("Florida", "FL"), GEORGIA("Georgia", "GA"), GUAM("Guam", "GU"), HAWAII( | |
"Hawaii", "HI"), IDAHO("Idaho", "ID"), ILLINOIS("Illinois", "IL"), INDIANA("Indiana", "IN"), IOWA("Iowa", "IA"), KANSAS( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load('vertx.js'); | |
vertx.fileSystem.mkDir('a/b/c/d', true, function(err, res) { | |
if (!err) { | |
vertx.logger.info('Directory created ok'); | |
} else { | |
vertx.logger.info(err); | |
} | |
}); | |
// vert.x version: vert.x-1.3.0.final |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2012, the Dart project authors. All rights reserved. | |
// Redistribution and use in source and binary forms, with or without | |
// modification, are permitted provided that the following conditions are | |
// met: | |
// * Redistributions of source code must retain the above copyright | |
// notice, this list of conditions and the following disclaimer. | |
// * Redistributions in binary form must reproduce the above | |
// copyright notice, this list of conditions and the following | |
// disclaimer in the documentation and/or other materials provided | |
// with the distribution. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DataSourceModule extends AbstractModule { | |
private DataSource dataSource; | |
private final String jndiName; | |
public DataSourceModule(final String jndiName) | |
{ | |
this.jndiName = jndiName; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.inject.AbstractModule; | |
import javax.naming.InitialContext; | |
public class DataSource | |
{ | |
public static AbstractModule fromJndi(final String jndiName) | |
{ | |
return new AbstractModule() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from HtmlUnit getting started | |
final WebClient webClient = new WebClient(); | |
final HtmlPage page = webClient.getPage("http://htmlunit.sourceforge.net"); | |
final DOMNodeSelector cssSelector = new DOMNodeSelector(page.getDocumentElement()); | |
final Set elements = cssSelector.querySelectorAll("div.section h2"); | |
final Node first = elements.iterator().next(); | |
assertThat(first.getTextContent(), equalTo("HtmlUnit")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT Members.*, | |
NAME_SRCH.RANK AS rank1, SRCH.RANK AS rank2 | |
FROM Members LEFT OUTER JOIN | |
FREETEXTTABLE(Members, name, ‘breakfast’) NAME_SRCH ON | |
Members.memberID = NAME_SRCH.[KEY] LEFT OUTER JOIN | |
FREETEXTTABLE(Members, *, ‘breakfast’) SRCH ON | |
Members.memberID = SRCH.[KEY] | |
ORDER BY rank1 DESC, rank2 DESC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT Members.*, SEARCH_TBL.RANK AS rank | |
FROM Members INNER JOIN | |
FREETEXTTABLE(Members, *, ‘breakfast’) SEARCH_TBL | |
ON Members.memberID = SEARCH_TBL.[KEY] | |
ORDER BY rank DESC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# on your server (via ssh) | |
mkdir ~/git/yourprojectname.git | |
cd ~/git/yourprojectname.git | |
git --bare init | |
# in your project directory (on your local machine): | |
# setup your user info | |
git config --global user.name "Firstname Lastname" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class WebTestBase { | |
protected WebClient webClient; | |
protected HtmlPage htmlPage; | |
protected void goTo(final String url){ | |
return (HtmlPage)webClient.getPage(url); | |
} |