This file contains hidden or 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
def tryWithDefault[A, B](a: A, b: B)(pf: PartialFunction[A, B]): B = | |
if (pf isDefinedAt a) pf(a) | |
else b | |
println(tryWithDefault(1, 0) { case n if n % 2 == 0 => n / 2 }) // 0 | |
println(tryWithDefault(12, 0) { case n if n % 2 == 0 => n / 2 }) // 6 |
This file contains hidden or 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
ds = self.cat.create_datastore() | |
ds.name = "gsconfig" | |
ds.parameters.update( | |
host="localhost", port="5432", database="db", user="postgres", | |
passwd="password", dbtype="postgis") | |
self.cat.save(ds) |
This file contains hidden or 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 python | |
from geoserver.catalog import Catalog | |
cat = Catalog("http://localhost:8001/geoserver/rest", username="admin", password="geoserver") | |
topp = cat.get_workspace("topp") | |
files = dict((x, "roads." + x) for x in ["shp", "prj", "dbf", "shx"]) | |
for i in xrange(0, 200): | |
cat.create_featurestore("roads_" + str(i), files, workspace=topp) | |
for i in xrange(0, 200): |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<sld:UserStyle xmlns="http://www.opengis.net/sld" xmlns:sld="http://www.opengis.net/sld" xmlns:ogc | |
<sld:Name>Default Styler</sld:Name> | |
<sld:Title/> | |
<sld:FeatureTypeStyle> | |
<sld:Name>name</sld:Name> | |
<sld:Rule> | |
<sld:PointSymbolizer> | |
<sld:Graphic> | |
<sld:Mark> |
This file contains hidden or 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
override def managedStyle = ManagedStyle.Maven | |
lazy val publishTo = Resolver.file("local maven repo", (Path.userHome / ".m2" / "repository") asFile) |
This file contains hidden or 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 python | |
from geoserver.catalog import Catalog | |
cat = Catalog('http://host/geoserver/rest', 'user', 'password') | |
def internal_name(s): | |
return s.startswith("__") and s.endswith("__") | |
def check(x): |
This file contains hidden or 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
apache-tomcat-6.0.32/bin/catalina.sh start | |
paster serve --reload riab_geonode/riab/deploy/project.paste.ini | |
apache-tomcat-6.0.32/bin/catalina.sh stop |
This file contains hidden or 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
function checkup() { | |
REPO="$1" | |
WORKING_DIR="$2" | |
if [ -d "${WORKING_DIR}" ]; | |
then | |
echo "Updating ${WORKING_DIR} from upstream" | |
# (cd "${WORKING_DIR}" && git pull) | |
else | |
git clone "${REPO}" "${WORKING_DIR}" | |
fi |
This file contains hidden or 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 python | |
from geoserver.catalog import Catalog | |
cat = Catalog('http://demo.geonode.org/geoserver-geonode-dev/rest/') # + username, password)... | |
def check(x): | |
for name in dir(x): | |
if getattr(x, name) is None: | |
print x, name, "IS NONE" |
This file contains hidden or 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
def reverse[A](xs: List[A]): List[A] = { | |
def reverse0(xs: List[A], accum: List[A]): List[A] = | |
xs match { | |
case Nil => accum | |
case h :: t => reverse0(t, h :: accum) | |
} | |
reverse0(xs, Nil) | |
} |