Skip to content

Instantly share code, notes, and snippets.

object Combine {
def linear[A](xs: Seq[A]): Seq[Seq[A]] =
xs match {
case Seq() => Seq(Seq())
case Seq(h, t @ _*) =>
linear(t) flatMap { ts => Seq(ts, h +: ts) }
}
def binary[A](xs: Seq[A]): Seq[Seq[A]] =
xs match {
* { fill: blue, symbol('shape://slash'); }
:fill { stroke: red; }
/* Stack a red cross on top of a white circle to make a marker for hospital points */
* {
mark: symbol(circle), symbol(cross);
}
:nth-mark(1) {
fill: white;
stroke: red;
}
scala> val Title = """(Mrs?).*""".r
Title: scala.util.matching.Regex = (Mrs?).*
scala> "Mr. Belvedere" match {
| case Title(title) => println("hey there " + title)
| case _ => println("who are you?");
| }
hey there Mr
scala> val TitleName = """(Mrs?)(.*)""".r
........................................................E.............
======================================================================
ERROR: /data/search/detail -> Test accessing the data search detail for a layer
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/dwins/geonode-git/src/GeoNodePy/geonode/maps/tests.py", line 68, in test_search_detail
response = c.get('/data/search/detail', {'uuid':layer.uuid})
File "/home/dwins/geonode-git/lib/python2.6/site-packages/django/test/client.py", line 290, in get
response = self.request(**r)
File "/home/dwins/geonode-git/lib/python2.6/site-packages/django/core/handlers/base.py", line 100, in get_response
import scala.util.parsing.combinator.{ Parsers, RegexParsers }
import scala.util.parsing.input.{ CharSequenceReader, Reader }
object ParsingExample extends Parsers {
override type Elem = Char
object Delimiter extends Parser[String] {
def apply(reader: Input): ParseResult[String] = {
if (reader atEnd) {
Failure("end of string", reader)
<?xml version="1.0" encoding="UTF-8"?>
<sld:UserStyle xmlns="http://www.opengis.net/sld" xmlns:sld="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml">
<sld:Name>Default Styler</sld:Name>
<sld:Title/>
<sld:FeatureTypeStyle>
<sld:Name>name</sld:Name>
<sld:Rule>
<ogc:Filter>
<ogc:Or>
<ogc:Or>
<StyledLayerDescriptor version="1.0.0">
<NamedLayer>
<Name>Rivers</Name>
<NamedStyle>
<Name>CenterLine</Name>
</NamedStyle>
</NamedLayer>
<NamedLayer>
<Name>Roads</Name>
<NamedStyle>
@dwins
dwins / App.java
Created May 23, 2010 19:32
is this the minimal code to render a shapefile with geotools?
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import java.io.File;
import java.net.URL;
import javax.imageio.ImageIO;
import org.geotools.data.FeatureSource;
import org.geotools.data.shapefile.ShapefileDataStore;
import org.geotools.factory.CommonFactoryFinder;
import org.geotools.geometry.jts.ReferencedEnvelope;
--langdef=scala
--langmap=scala:.scala
--regex-scala=/object[ \t]+([a-zA-Z0-9]+)/\1/o,object/
--regex-scala=/trait[ \t]+([a-zA-Z0-9]+)/\1/t,trait/
--regex-scala=/\s*(type|class)[ \t]+([a-zA-Z0-9]+)/\2/c,class/
--regex-scala=/def[ \t]+([a-zA-Z0-9]+)/\1/f,function/