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 unittest | |
def has_branches(tree): | |
return len(tree) >= 1 | |
def depth(tree): | |
if has_branches(tree): | |
return 1 + max(map(depth, tree)) | |
else: | |
return 1 |
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 unittest | |
def has_branch(tree): | |
return False | |
class DepthTest(unittest.TestCase): | |
#I guess, testing existence of branches might be useful to calculate the depth of tree. | |
def test_has_branch(self): | |
tree = [] | |
self.assertFalse(has_branch(tree)) |
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 unittest | |
def depth(tree): | |
return 1 | |
class DepthTest(unittest.TestCase): | |
#Simplest tree is a tree which has just one node with no branches. In that case, the depth is 1. | |
def test_no_children(self): | |
tree = [] | |
self.assertEquals(1, depth(tree)) |
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
첫째날 | |
10:00 소개 | |
10:10 실습 | |
10:30 휴식 | |
0h 40m |
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
package servlet; | |
import clojure.lang.RT; | |
import clojure.lang.Var; | |
import javax.servlet.ServletException; | |
import javax.servlet.ServletResponse; | |
import javax.servlet.http.HttpServlet; | |
import javax.servlet.http.HttpServletRequest; | |
import javax.servlet.http.HttpServletResponse; |
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
#!/usr/bin/env ruby | |
require 'fileutils' | |
if ARGV.length != 2 | |
puts "Usages: #{$0} <moin pages directory> <gitit wikidata directory>" | |
exit 1 | |
end | |
from_dir = File.expand_path ARGV[0] |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'hpricot' | |
require 'open-uri' | |
INDEX_PAGE = "http://community.livejournal.com/clinic_duty/12225.html" | |
(open(INDEX_PAGE) { |f| Hpricot(f) }/"table > tbody > tr > td > a").each do |a| | |
#Skip season links |
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.sql.ResultSet; | |
import java.sql.SQLException; | |
import java.sql.Types; | |
import java.util.List; | |
import javax.sql.DataSource; | |
public class FooDao extends JdbcDaoSupport { | |
private final String COLUMNS = "id a b"; | |
private final RowMapper<Foo> rowMapper = new RowMapper<Foo>() { |
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
package geojson; | |
import com.google.gson.JsonArray; | |
import com.google.gson.JsonElement; | |
import com.google.gson.JsonObject; | |
import com.google.gson.JsonSerializationContext; | |
import com.google.gson.JsonSerializer; | |
import org.geotools.feature.FeatureCollection; | |
import org.geotools.feature.FeatureIterator; | |
import org.opengis.feature.Feature; |
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.List; | |
import com.google.common.base.Function; | |
public interface JdbcTemplate { | |
<T> List<T> query(String sql, Object[] args, int[] argTypes, RowMapper<T> rowMapper); | |
<T> T queryFirst(String sql, Object[] args, int[] argTypes, RowMapper<T> rowMapper); | |
int queryForInt(String sql, Object[] args, int[] argTypes); | |
<T> void eachDo(String sql, Object[] args, int[] argTypes, RowMapper<T> rowMapper, Function<T, Void> block); | |
int update(String sql, Object[] args, int[] argTypes); |
OlderNewer