text:
package main

import (
    "bufio"
    "bytes"
    "encoding/binary"
    "encoding/json"
    "flag"
    "fmt"
    "io"
    "io/ioutil"
    "net/http"
    "os"
    "os/exec"
    "strconv"
    "strings"
    "sync"
    "time"

    "github.com/gorilla/websocket"      // go get github.com/gorilla/websocket
)

type PipesStruct struct {
    Stdin io.WriteCloser
    Stdout io.ReadCloser
    Stderr io.ReadCloser
}

type OrderStruct struct {
    Symbol              string       `json:"symbol"`
    Stock               string       `json:"stock"`
    Venue               string       `json:"venue"`
    Direction           string       `json:"direction"`
    OrderType           string       `json:"orderType"`
    Account             string       `json:"account"`
    Qty                 int32        `json:"qty"`       // int32 is what the backend likes,
    Price               int32        `json:"price"`     // official uses uint32 I think.
}

type OptionsStruct struct {
    MaxBooks            int
    Port                int
    WsPort              int
    AccountFilename     string
    DefaultVenue        string
    DefaultSymbol       string
    Excess              bool
}

type WsInfo struct {
    Account             string
    Venue               string
    Symbol              string
    ConnType            int
    MessageChannel      chan string
}

type Command struct {
    Venue string
    Symbol string
    Command string
    HubCommand int
    CreateIfNeeded bool
    ResponseChan chan []byte
}

type BookInfo struct {
    Venue string
    Symbol string
}

var HEARTBEAT_OK      = []byte(`{"ok": true, "error": ""}`)
var UNKNOWN_PATH      = []byte(`{"ok": false, "error": "Unknown path"}`)
var UNKNOWN_VENUE     = []byte(`{"ok": false, "error": "Unknown venue"}`)
var UNKNOWN_SYMBOL    = []byte(`{"ok": false, "error": "Venue is known but symbol is not"}`)
var BAD_JSON          = []byte(`{"ok": false, "error": "Failed to parse incoming JSON"}`)
var URL_MISMATCH      = []byte(`{"ok": false, "error": "Venue or symbol in URL did not match that in POST"}`)
var MISSING_FIELD     = []byte(`{"ok": false, "error": "Missing key or unacceptable value in POST"}`)
var UNKNOWN_ORDER     = []byte(`{"ok": false, "error": "Unknown order ID"}`)
var BAD_ORDER         = []byte(`{"ok": false, "error": "Couldn't parse order ID"}`)
var AUTH_FAILURE      = []byte(`{"ok": false, "error": "Unknown account or wrong API key"}`)
var NO_VENUE_HEART    = []byte(`{"ok": false, "error": "Venue not up (create it by using it)"}`)
var BAD_BOOK_NAME     = []byte(`{"ok": false, "error": "Couldn't create book! Bad name for a book!"}`)
var TOO_MANY_BOOKS    = []byte(`{"ok": false, "error": "Couldn't create book! Too many books!"}`)
var NOT_IMPLEMENTED   = []byte(`{"ok": false, "error": "Not implemented"}`)
var DISABLED          = []byte(`{"ok": false, "error": "Disabled or not enabled. (See command line options)"}`)
var BAD_ACCOUNT_NAME  = []byte(`{"ok": false, "error": "Bad account name (should be alpha_numeric and sane length)"}`)
var BAD_DIRECTION     = []byte(`{"ok": false, "error": "Bad direction (should be buy or sell, lowercase)"}`)
var BAD_ORDERTYPE     = []byte(`{"ok": false, "error": "Bad (unknown) orderType"}`)
var BAD_PRICE         = []byte(`{"ok": false, "error": "Bad (negative) price"}`)
var BAD_QTY           = []byte(`{"ok": false, "error": "Bad (non-positive) qty"}`)
var MYSTERY_HUB_CMD   = []byte(`{"ok": false, "error": "Hub received unknown hub command"}`)
var STATUS_ON_UNKNOWN = []byte(`{"ok": false, "error": "Status/cancel on unknown book"}`)
var BAD_METHOD        = []byte(`{"ok": false, "error": "Method not allowed, use GET, DELETE, POST only"}`)
var BAD_METHOD_HERE   = []byte(`{"ok": false, "error": "Method not allowed at this URL"}`)

const (
    VENUES_LIST = 1
    VENUE_HEARTBEAT = 2
    STOCK_LIST = 3
)

const (
    BUY = 1
    SELL = 2
)

const (
    LIMIT = 1
    MARKET = 2
    FOK = 3
    IOC = 4
)

const (
    TICKER = 1
    EXECUTION = 2
)

const FRONTPAGE = `
<title>disorderBook</title>

    disorderBook: unofficial Stockfighter server

    C+Go version
    https://github.com/fohristiwhirl/disorderBook_Prime

    By Amtiskaw (Fohristiwhirl on GitHub)
    With help from cite-reader, Medecau and DanielVF

    Mad props to patio11 for the elegant fundamental design!
    Also inspired by eu90h's Mockfighter

    "WOAH THATS FAST" -- DanielVF

`

// -------------------------------------------------------------------------------------------------------

// The following globals are unsafe -- could be touched by multiple goroutines (e.g. web handlers):

var AccountInts = make(map[string]int)
var WebSocketClients = make([]*WsInfo, 0)

// The following are mutexes for the above:

var AccountInts_MUTEX sync.RWMutex
var WebSocketClients_MUTEX sync.RWMutex

// The following globals are safe because they are only written to before the various goroutines start:

var Options OptionsStruct
var AuthMode = false
var Auth = make(map[string]string)

// The following globals are safe because they are never "written" to as such:

var Upgrader = websocket.Upgrader{ReadBufferSize: 1024, WriteBufferSize: 1024, CheckOrigin: func(r *http.Request) bool {return true}}
var GlobalCommandChan = make(chan Command)

// -------------------------------------------------------------------------------------------------------

func main() {

    flag.IntVar(&Options.MaxBooks, "maxbooks", 100, "Maximum number of books")
    flag.IntVar(&Options.Port, "port", 8000, "Port for web API and WebSockets")
    flag.StringVar(&Options.AccountFilename, "accounts", "", "Accounts file for authentication")
    flag.StringVar(&Options.DefaultVenue, "venue", "TESTEX", "Default venue")
    flag.StringVar(&Options.DefaultSymbol, "symbol", "FOOBAR", "Default symbol")
    flag.BoolVar(&Options.Excess, "excess", false, "Enable commands that can return excessive responses")

    flag.Parse()

    fmt.Printf("\ndisorderBook (C+Go version) starting up on port %d\n", Options.Port)

    if Options.AccountFilename != "" {
        load_auth()
        AuthMode = true
    } else {
        fmt.Printf("\n-----> Warning: running WITHOUT AUTHENTICATION! <-----\n\n")
    }

    go hub()

    // Create the default venue...
    result_chan := make(chan []byte)
    msg := Command{
        ResponseChan: result_chan,
        Venue: Options.DefaultVenue,
        Symbol: Options.DefaultSymbol,
        CreateIfNeeded: true,
        Command: "THIS_DOES_NOT_MATTER",
    }
    GlobalCommandChan <- msg
    <- result_chan              // Need to read a result to prevent deadlock

    server_string := fmt.Sprintf("127.0.0.1:%d", Options.Port)

    http.HandleFunc("/", main_handler)
    http.HandleFunc("/ob/api/ws/", ws_handler)
    http.ListenAndServe(server_string, nil)
}

func main_handler(writer http.ResponseWriter, request * http.Request) {

    // Each time a new web request comes in (not including
    // WebSocket connections) this is called as a new goroutine.

    writer.Header().Set("Content-Type", "application/json")     // A few things change this later

    request_api_key := request.Header.Get("X-Starfighter-Authorization")
    if request_api_key == "" {
        request_api_key = request.Header.Get("X-Stockfighter-Authorization")
    }

    path_clean := strings.Trim(request.URL.Path, "\n\r\t /")
    pathlist := strings.Split(path_clean, "/")

    // Disallow all methods except GET, DELETE, POST.............................................

    if request.Method != "GET" && request.Method != "DELETE" && request.Method != "POST" {
        writer.Write(BAD_METHOD)
        return
    }

    // Welcome message for "/" ..................................................................

    if len(pathlist) == 1 && pathlist[0] == "" {      // The split behaviour means len is never 0
        writer.Header().Set("Content-Type", "text/html")
        fmt.Fprintf(writer, FRONTPAGE)
        return
    }

    // Check for obvious path fails..............................................................

    if len(pathlist) < 2 || pathlist[0] != "ob" || pathlist[1] != "api" {
        writer.Write(UNKNOWN_PATH)
        return
    }

    // General heartbeat.........................................................................

    if len(pathlist) == 3 {
        if pathlist[2] == "heartbeat" {
            writer.Write(HEARTBEAT_OK)
            return
        }
    }

    // Venues list...............................................................................

    if len(pathlist) == 3 {
        if pathlist[2] == "venues" {

            msg := Command{
                HubCommand: VENUES_LIST,
            }
            relay(msg, writer)
            return
        }
    }

    // Venue heartbeat...........................................................................

    if len(pathlist) == 5 {
        if pathlist[2] == "venues" && pathlist[4] == "heartbeat" {
            venue := pathlist[3]

            msg := Command{
                Venue: venue,
                HubCommand: VENUE_HEARTBEAT,
            }
            relay(msg, writer)
            return
        }
    }

    // Stocks on an exchange.....................................................................

    list_stocks_flag := false

    if len(pathlist) == 4 {
        if pathlist[2] == "venues" {
            list_stocks_flag = true
        }
    } else if len(pathlist) == 5 {
        if pathlist[2] == "venues" && pathlist[4] == "stocks" {
            list_stocks_flag = true
        }
    }

    if list_stocks_flag {
        venue := pathlist[3]

        msg := Command{
            Venue: venue,
            HubCommand: STOCK_LIST,
        }
        relay(msg, writer)
        return
    }

    // Quote.....................................................................................

    if len(pathlist) == 7 {
        if pathlist[2] == "venues" && pathlist[4] == "stocks" && pathlist[6] == "quote" {
            venue := pathlist[3]
            symbol := pathlist[5]

            msg := Command{
                Venue: venue,
                Symbol: symbol,
                Command: "QUOTE",
                CreateIfNeeded: true,
            }
            relay(msg, writer)
            return
        }
    }

    // Orderbook.................................................................................

    if len(pathlist) == 6 {
        if pathlist[2] == "venues" && pathlist[4] == "stocks" {
            venue := pathlist[3]
            symbol := pathlist[5]

            msg := Command{
                Venue: venue,
                Symbol: symbol,
                Command: "ORDERBOOK_BINARY",
                CreateIfNeeded: true,
            }
            relay(msg, writer)
            return
        }
    }

    // All orders on a venue.....................................................................

    if len(pathlist) == 7 {
        if pathlist[2] == "venues" && pathlist[4] == "accounts" && pathlist[6] == "orders" {
            writer.Write(NOT_IMPLEMENTED)
            return
        }
    }

    // All orders on a venue (specific stock)....................................................

    if len(pathlist) == 9 {
        if pathlist[2] == "venues" && pathlist[4] == "accounts" && pathlist[6] == "stocks" && pathlist[8] == "orders" {
            venue := pathlist[3]
            account := pathlist[5]
            symbol := pathlist[7]

            if Options.Excess == false {
                writer.Write(DISABLED)
                return
            }

            if AuthMode {       // Do this before the acc_id int is generated
                api_key, ok := Auth[account]
                if api_key != request_api_key || ok == false {
                    writer.Write(AUTH_FAILURE)
                    return
                }
            }

            AccountInts_MUTEX.Lock()
            acc_id, ok := AccountInts[account]
            if !ok {
                acc_id = len(AccountInts)
                AccountInts[account] = acc_id
            }
            AccountInts_MUTEX.Unlock()

            msg := Command{
                Venue: venue,
                Symbol: symbol,
                Command: "STATUSALL " + strconv.Itoa(acc_id),
                CreateIfNeeded: true,
            }
            relay(msg, writer)
            return
        }
    }

    // Status and cancel (including cancel at alternate URL).....................................

    if (len(pathlist) == 8 && pathlist[2] == "venues" && pathlist[4] == "stocks" && pathlist[6] == "orders") ||
       (len(pathlist) == 9 && pathlist[2] == "venues" && pathlist[4] == "stocks" && pathlist[6] == "orders" && pathlist[8] == "cancel") {
        venue := pathlist[3]
        symbol := pathlist[5]

        id, err := strconv.Atoi(pathlist[7])
        if err != nil {
            writer.Write(BAD_ORDER)
            return
        }

        // GET doesn't make sense at the alternate cancel URL... (we'll allow DELETE I guess)

        if len(pathlist) == 9 && request.Method == "GET" {
            writer.Write(BAD_METHOD_HERE)
            return
        }

        // In this instance, the web-handler needs to contact the book for info and NOT
        // send that on to the client. Once we have the info we can make the real request.

        command := "__ACC_FROM_ID__ " + strconv.Itoa(id)
        result_chan := make(chan []byte)

        msg := Command{
            ResponseChan: result_chan,
            Venue: venue,
            Symbol: symbol,
            Command: command,
            CreateIfNeeded: false,
        }
        GlobalCommandChan <- msg
        res1 := <- result_chan

        // If the book didn't exist we will receive one of these replies...
        if bytes.Equal(res1, UNKNOWN_VENUE) || bytes.Equal(res1, UNKNOWN_SYMBOL) {
            writer.Write(STATUS_ON_UNKNOWN)
            return
        }

        res1 = bytes.Trim(res1, " \t\n\r")
        reply_list := bytes.Split(res1, []byte(" "))
        err_string, account := string(reply_list[0]), string(reply_list[1])

        if err_string == "ERROR" {
            writer.Write(UNKNOWN_ORDER)
            return
        }

        if AuthMode {
            if Auth[account] != request_api_key || Auth[account] == "" {
                writer.Write(AUTH_FAILURE)
                return
            }
        }

        if request.Method == "DELETE" || len(pathlist) == 9 {       // The longer path is the alternate cancel URL
            command = fmt.Sprintf("CANCEL %d", id)
        } else {
            command = fmt.Sprintf("STATUS %d", id)
        }

        msg = Command{
            Venue: venue,
            Symbol: symbol,
            Command: command,
            CreateIfNeeded: false,
        }
        relay(msg, writer)
        return
    }

    // Order placing.............................................................................

    if len(pathlist) == 7 {
        if pathlist[2] == "venues" && pathlist[4] == "stocks" && pathlist[6] == "orders" {
            venue := pathlist[3]
            symbol := pathlist[5]

            if request.Method != "POST" {
                writer.Write(BAD_METHOD_HERE)
                return
            }

            raw_order := OrderStruct{}
            decoder := json.NewDecoder(request.Body)
            err := decoder.Decode(&raw_order)

            if err != nil {
                writer.Write(BAD_JSON)
                return
            }

            // Accept missing fields that can be determined from URL...
            if raw_order.Venue == "" {
                raw_order.Venue = venue
            }
            if raw_order.Symbol == "" && raw_order.Stock == "" {
                raw_order.Symbol = symbol
            }

            // Accept stock as an alias of symbol...
            if raw_order.Stock != "" {
                raw_order.Symbol = raw_order.Stock
            }

            if raw_order.Venue != venue || raw_order.Symbol != symbol {
                writer.Write(URL_MISMATCH)
                return
            }

            if raw_order.Venue == "" || raw_order.Symbol == "" || raw_order.Account == "" || raw_order.Direction == "" || raw_order.OrderType == "" {
                writer.Write(MISSING_FIELD)
                return
            }

            if raw_order.Price < 0 {
                writer.Write(BAD_PRICE)
                return
            }

            if raw_order.Qty < 1 {
                writer.Write(BAD_QTY)
                return
            }

            if bad_name(raw_order.Account) {
                writer.Write(BAD_ACCOUNT_NAME)
                return
            }

            int_ordertype := 0
            switch raw_order.OrderType {
                case "ioc":
                    int_ordertype = IOC
                case "immediate-or-cancel":
                    int_ordertype = IOC
                case "fok":
                    int_ordertype = FOK
                case "fill-or-kill":
                    int_ordertype = FOK
                case "limit":
                    int_ordertype = LIMIT
                case "market":
                    int_ordertype = MARKET
                default:
                    writer.Write(BAD_ORDERTYPE)
                    return
            }

            int_direction := 0
            switch raw_order.Direction {
                case "sell":
                    int_direction = SELL
                case "buy":
                    int_direction = BUY
                default:
                    writer.Write(BAD_DIRECTION)
                    return
            }

            if AuthMode {
                api_key, ok := Auth[raw_order.Account]
                if api_key != request_api_key || ok == false {
                    writer.Write(AUTH_FAILURE)
                    return
                }
            }

            // Do the account-ID generation as late as possible so we don't get unused IDs if we return early

            AccountInts_MUTEX.Lock()
            acc_id, ok := AccountInts[raw_order.Account]
            if !ok {
                acc_id = len(AccountInts)
                AccountInts[raw_order.Account] = acc_id
            }
            AccountInts_MUTEX.Unlock()

            command := fmt.Sprintf("ORDER %s %d %d %d %d %d", raw_order.Account, acc_id, raw_order.Qty, raw_order.Price, int_direction, int_ordertype)

            msg := Command{
                Venue: venue,
                Symbol: symbol,
                Command: command,
                CreateIfNeeded: true,
            }
            relay(msg, writer)
            return
        }
    }

    // Scores....................................................................................

    if len(pathlist) == 7 {
        if pathlist[2] == "venues" && pathlist[4] == "stocks" && pathlist[6] == "scores" {
            venue := pathlist[3]
            symbol := pathlist[5]

            writer.Header().Set("Content-Type", "text/html")    // FIXME? If the book doesn't exist it will be a JSON response

            msg := Command{
                Venue: venue,
                Symbol: symbol,
                Command: "__SCORES__",
                CreateIfNeeded: false,
            }
            relay(msg, writer)
            return
        }
    }

    // Unknown...................................................................................

    writer.Write(UNKNOWN_PATH)
    return
}

func relay(msg Command, writer http.ResponseWriter) {

    // Send the message to the hub, read the response via a channel,
    // and then send that response to the http client.

    result_chan := make(chan []byte)
    msg.ResponseChan = result_chan
    GlobalCommandChan <- msg
    res := <- result_chan
    writer.Write(res)
    return
}

func hub() {

    // All web-handlers that need some sort of considered response send their commands to the hub.
    // The real reason for this is that the books are behind a map; accessing which is not thread-safe.
    // Earlier architecture ended up with a ton of mutex calls and a map of mutexes behind a mutex...

    books := make(map[string]map[string]chan Command)
    bookcount := 0

    hub_command_chan := make(chan Command)
    hub_update_chan := make(chan BookInfo)

    go hub_command_handler(hub_command_chan, hub_update_chan)

    for {
        msg := <- GlobalCommandChan

        // Check whether the command was to the hub or to the book...

        if msg.HubCommand != 0 {
            hub_command_chan <- msg
            continue
        }

        // Command was a real command to a book...
        // But maybe it doesn't exist and we can ignore it?

        venue, symbol := msg.Venue, msg.Symbol

        if msg.CreateIfNeeded == false {
            if books[venue] == nil {
                msg.ResponseChan <- UNKNOWN_VENUE
                continue
            }
            if books[venue][symbol] == nil {
                msg.ResponseChan <- UNKNOWN_SYMBOL
                continue
            }
        }

        // Either the book exists or we need to create it...

        if books[venue] == nil || books[venue][symbol] == nil {     // Short circuits if no venue

            if bad_name(venue) || bad_name(symbol) {
                msg.ResponseChan <- BAD_BOOK_NAME
                continue
            }

            if bookcount >= Options.MaxBooks {
                msg.ResponseChan <- TOO_MANY_BOOKS
                continue
            }

            if books[venue] == nil {
                books[venue] = make(map[string]chan Command)
            }

            new_command_chan := make(chan Command)
            books[venue][symbol] = new_command_chan
            bookcount += 1

            hub_update_chan <- BookInfo{venue, symbol}

            exec_command := exec.Command("./disorderBook.exe", venue, symbol)
            i_pipe, _ := exec_command.StdinPipe()
            o_pipe, _ := exec_command.StdoutPipe()
            e_pipe, _ := exec_command.StderrPipe()

            // Should maybe handle errors from the above.

            new_pipes_struct := PipesStruct{i_pipe, o_pipe, e_pipe}

            exec_command.Start()
            go ws_controller(venue, symbol, e_pipe)
            go controller(venue, symbol, new_pipes_struct, new_command_chan)
            fmt.Printf("Creating %s %s\n", venue, symbol)
        }

        // The book exists...

        books[venue][symbol] <- msg
    }
}

func hub_command_handler(hub_command_chan chan Command, hub_update_chan chan BookInfo) {

    // Some commands aren't dealt with by passing them to a book but rather are queries of global state.
    // This goroutine keeps a copy of the relevant state up-to-date by receiving messages from the hub
    // about new book creation. It thus is able to deal with the commands for such state.

    venue_symbol_map := make(map[string]map[string]bool)   // bool is adequate here

    for {
        select {
            case cmd := <- hub_command_chan:
                handle_hub_command(cmd, venue_symbol_map)

            case update := <- hub_update_chan:
                if venue_symbol_map[update.Venue] == nil {
                    venue_symbol_map[update.Venue] = make(map[string]bool)
                }
                venue_symbol_map[update.Venue][update.Symbol] = true
        }
    }
}

func handle_hub_command(msg Command, venue_symbol_map map[string]map[string]bool) {
    var buffer bytes.Buffer
    switch msg.HubCommand {

        case VENUES_LIST:

            commaflag := false
            buffer.WriteString("{\n  \"ok\": true,\n  \"venues\": [")
            for v := range venue_symbol_map {
                name := v + " Exchange"
                if commaflag {
                    buffer.WriteString(",")
                }
                line := fmt.Sprintf("\n    {\"name\": \"%s\", \"state\": \"open\", \"venue\": \"%s\"}", name, v)
                buffer.WriteString(line)
                commaflag = true
            }
            buffer.WriteString("\n  ]\n}")

        case VENUE_HEARTBEAT:

            if venue_symbol_map[msg.Venue] == nil {
                buffer.Write(NO_VENUE_HEART)
            } else {
                line := fmt.Sprintf(`{"ok": true, "venue": "%s"}`, msg.Venue)
                buffer.WriteString(line)
            }

        case STOCK_LIST:

            if venue_symbol_map[msg.Venue] == nil {
                buffer.Write(NO_VENUE_HEART)
            } else {
                commaflag := false
                buffer.WriteString("{\n  \"ok\": true,\n  \"symbols\": [")
                for s := range venue_symbol_map[msg.Venue] {
                    name := s + " Inc"
                    if commaflag {
                        buffer.WriteString(",")
                    }
                    line := fmt.Sprintf("\n    {\"name\": \"%s\", \"symbol\": \"%s\"}", name, s)
                    buffer.WriteString(line)
                    commaflag = true
                }
                buffer.WriteString("\n  ]\n}")
            }

        default:

            buffer.Write(MYSTERY_HUB_CMD)
    }

    msg.ResponseChan <- buffer.Bytes()
    return
}

func controller(venue string, symbol string, pipes PipesStruct, command_chan chan Command)  {

    // This goroutine controls the stdout and stdin for a single backend.
    // (stderr (for WebSockets) is handled by a different goroutine.)

    for {
        msg := <- command_chan

        command := msg.Command

        if len(command) == 0 || command[len(command) - 1] != '\n' {
            command = command + "\n"
        }

        fmt.Fprintf(pipes.Stdin, command)

        if command == "ORDERBOOK_BINARY\n" {      // This is a special case since the response is binary
            handle_binary_orderbook_response(pipes.Stdout, msg.Venue, msg.Symbol, msg.ResponseChan)
            continue
        }

        scanner := bufio.NewScanner(pipes.Stdout)
        var buffer bytes.Buffer

        for {
            scanner.Scan()
            str_piece := scanner.Bytes()
            if bytes.Equal(str_piece, []byte("END")) {
                break
            } else {
                buffer.Write(str_piece)
                buffer.WriteByte('\n')
            }
        }

        msg.ResponseChan <- buffer.Bytes()
    }
}

func handle_binary_orderbook_response(backend_stdout io.ReadCloser, venue string, symbol string, result_chan chan []byte) {

    // The orderbook is the only thing the C backend sends in a binary format (this is
    // done for speed reasons, as it's potentially a large amount of data, frequently
    // requested in normal usage). See comments in the C file for format info.

    reader := bufio.NewReader(backend_stdout)

    var qty uint32
    var price uint32
    var commaflag bool

    var buffer bytes.Buffer

    buffer.WriteString("{\n  \"ok\": true,\n  \"venue\": \"")
    buffer.WriteString(venue)
    buffer.WriteString("\",\n  \"symbol\": \"")
    buffer.WriteString(symbol)
    buffer.WriteString("\",\n  \"bids\": [")

    wrote_any_bids := false
    wrote_any_asks := false

    commaflag = false
    for {
        binary.Read(reader, binary.BigEndian, &qty)
        binary.Read(reader, binary.BigEndian, &price)

        if qty != 0 {
            if commaflag {
                buffer.WriteString(",")
            }
            buffer.WriteString("\n    {\"price\": ")
            buffer.WriteString(strconv.FormatUint(uint64(price), 10))
            buffer.WriteString(", \"qty\": ")
            buffer.WriteString(strconv.FormatUint(uint64(qty), 10))
            buffer.WriteString(", \"isBuy\": true}")
            commaflag = true
            wrote_any_bids = true
        } else {
            break
        }
    }

    if wrote_any_bids {
        buffer.WriteString("\n  ")
    }
    buffer.WriteString("],\n  \"asks\": [")

    commaflag = false
    for {
        binary.Read(reader, binary.BigEndian, &qty)
        binary.Read(reader, binary.BigEndian, &price)

        if qty != 0 {
            if commaflag {
                buffer.WriteString(",")
            }
            buffer.WriteString("\n    {\"price\": ")
            buffer.WriteString(strconv.FormatUint(uint64(price), 10))
            buffer.WriteString(", \"qty\": ")
            buffer.WriteString(strconv.FormatUint(uint64(qty), 10))
            buffer.WriteString(", \"isBuy\": false}")
            commaflag = true
            wrote_any_asks = true
        } else {
            break
        }
    }

    ts, _ := time.Now().UTC().MarshalJSON()

    if wrote_any_asks {
        buffer.WriteString("\n  ")
    }
    buffer.WriteString("],\n  \"ts\": ")
    buffer.Write(ts)                        // Already has quotes around it
    buffer.WriteString("\n}")

    result_chan <- buffer.Bytes()
    return
}

// WebSocket strategy:  http://www.gorillatoolkit.org/pkg/websocket
//
// For each incoming WS connection, the goroutine ws_handler() puts an entry
// in a global struct, storing account, venue, and symbol (some of which
// are optional). It also stores a channel used for communication.
//
// Each C backend sends messages to stderr. There is one goroutine per
// backend -- ws_controller() -- that reads these messages and passes them
// on via the channels (only sending to the correct clients).

func ws_handler(writer http.ResponseWriter, request * http.Request) {

    // Each time the /ob/api/ws URL is hit, this is called as a new goroutine.

    conn, err := Upgrader.Upgrade(writer, request, nil)
    if err != nil {
        return
    }

    path_clean := strings.Trim(request.URL.Path, "\n\r\t /")
    pathlist := strings.Split(path_clean, "/")

    if len(pathlist) < 3 || pathlist[0] != "ob" || pathlist[1] != "api" || pathlist[2] != "ws" {
        return
    }

    var account string
    var venue string
    var symbol string
    var info WsInfo

    message_channel := make(chan string, 128)        // Dunno what buffer is appropriate

    //ob/api/ws/:trading_account/venues/:venue/tickertape/stocks/:stock
    if len(pathlist) == 9 && pathlist[4] == "venues" && pathlist[6] == "tickertape" && pathlist[7] == "stocks" {
        account = ""
        venue = pathlist[5]
        symbol = pathlist[8]
        info = WsInfo{account, venue, symbol, TICKER, message_channel}
        append_to_ws_client_list(&info)

    //ob/api/ws/:trading_account/venues/:venue/tickertape
    } else if len(pathlist) == 7 && pathlist[4] == "venues" && pathlist[6] == "tickertape" {
        account = ""
        venue = pathlist[5]
        symbol = ""
        info = WsInfo{account, venue, symbol, TICKER, message_channel}
        append_to_ws_client_list(&info)

    //ob/api/ws/:trading_account/venues/:venue/executions/stocks/:symbol
    } else if len(pathlist) == 9 && pathlist[4] == "venues" && pathlist[6] == "executions" && pathlist[7] == "stocks" {
        account = pathlist[3]
        venue = pathlist[5]
        symbol = pathlist[8]
        info = WsInfo{account, venue, symbol, EXECUTION, message_channel}
        append_to_ws_client_list(&info)

    //ob/api/ws/:trading_account/venues/:venue/executions
    } else if len(pathlist) == 7 && pathlist[4] == "venues" && pathlist[6] == "executions" {
        account = pathlist[3]
        venue = pathlist[5]
        symbol = ""
        info = WsInfo{account, venue, symbol, EXECUTION, message_channel}
        append_to_ws_client_list(&info)

    // invalid URL
    } else {
        conn.Close()
        return
    }

    go ws_null_reader(conn, &info)     // This handles reading and discarding incoming messages

    for {
        msg := <- message_channel
        err = conn.WriteMessage(websocket.TextMessage, []byte(msg))
        if err != nil {
            remove_from_ws_client_list(&info)
            return      // The function ws_null_reader() will likely close the connection.
        }
    }
}

func ws_controller(venue string, symbol string, backend_stderr io.ReadCloser) {

    // See comments above for WebSocket strategy. This goroutine is responsible
    // for reading the stderr of a single C backend (i.e. a single book). It
    // then passes WebSocket messages on to the relevant connections.

    scanner := bufio.NewScanner(backend_stderr)

    for {
        scanner.Scan()
        headers := strings.Split(scanner.Text(), " ")

        var msg_type int

        // The backend sends a header line in format TYPE ACCOUNT VENUE SYMBOL
        // (the last 2 pieces aren't needed as we know what they are already).

        if headers[0] == "TICKER" {
            msg_type = TICKER
        } else if headers[0] == "EXECUTION" {
            msg_type = EXECUTION
        } else {
            msg_type = 0
            fmt.Println("Unknown WS message type received from backend!")
            fmt.Println("Headers: ", headers)
        }

        var buffer bytes.Buffer

        for {
            scanner.Scan()
            str_piece := scanner.Text()
            if str_piece != "END" {
                buffer.WriteString(str_piece)
                buffer.WriteByte('\n')
            } else {
                break
            }
        }

        WebSocketClients_MUTEX.RLock()

        for _, client := range WebSocketClients {

            if client.ConnType != msg_type {
                continue
            }
            if client.Account != headers[1] && client.ConnType == EXECUTION {
                continue
            }
            if client.Venue != venue {
                continue
            }
            if client.Symbol != symbol && client.Symbol != "" {
                continue
            }
            select {
                case client.MessageChannel <- buffer.String() :         // Send message unless buffer is full
                default:
            }
        }

        WebSocketClients_MUTEX.RUnlock()
    }
}

func append_to_ws_client_list(info_ptr * WsInfo) {

    WebSocketClients_MUTEX.Lock()
    defer WebSocketClients_MUTEX.Unlock()

    WebSocketClients = append(WebSocketClients, info_ptr)
    fmt.Printf("WebSocket -OPEN- ... Active == %d\n", len(WebSocketClients))
    return
}

func remove_from_ws_client_list(info_ptr * WsInfo) {

    // Does nothing if the client isn't in the list

    WebSocketClients_MUTEX.Lock()
    defer WebSocketClients_MUTEX.Unlock()

    for i, client_ptr := range WebSocketClients {
        if client_ptr == info_ptr {
            // Replace the pointer to this client by the final
            // pointer in the list, then shorten the list by 1.
            WebSocketClients[i] = WebSocketClients[len(WebSocketClients) - 1]
            WebSocketClients = WebSocketClients[:len(WebSocketClients) - 1]
            fmt.Printf("WebSocket CLOSED ... Active == %d\n", len(WebSocketClients))
            break
        }
    }
    return
}

func ws_null_reader(conn * websocket.Conn, info_ptr * WsInfo) {

    // Apparently reading WebSocket messages from clients is mandatory.
    // This function also closes connections if needed.

    for {
        if _, _, err := conn.NextReader(); err != nil {
            remove_from_ws_client_list(info_ptr)
            conn.Close()
            return
        }
    }
}

// Minor utility functions follow...

func load_auth() {

    file, err := ioutil.ReadFile(Options.AccountFilename)
    if err != nil {
        fmt.Printf("Couldn't load and parse accounts file.\n\n")
        os.Exit(1)
    }

    var di interface{}
    err = json.Unmarshal(file, &di)
    if err != nil {
        fmt.Printf("Couldn't load and parse accounts file.\n\n")
        os.Exit(1)
    }

    m, ok := di.(map[string]interface{})
    if !ok {
        fmt.Printf("Accounts file didn't seem to be the correct format.\n\n")
        os.Exit(1)
    }

    for acc, apikey := range m {
        switch apikey.(type) {
            case string:
                Auth[acc] = apikey.(string)
        }
    }

    return
}

func bad_name(name string) bool {

    if len(name) < 1 || len(name) > 20 {
        return true
    }

    // Disallow all chars except alphanumeric and underscore...

    for _, c := range(name) {
        if c < 48 || (c > 57 && c < 65) || (c > 90 && c < 95) || c == 96 || c > 122 {
            return true
        }
    }

    return false
}


text:
غواتيمالا تنهي دورة لبناء القدرات كان هدفها صون التراث الثقافي غير المادي على أراضيها
٢٦ أبريل، ٢٠١٨ غواتيمالا,
Guatemala lays the foundation for effective and sustainable implementation of the 2003 Convention for the Safeguarding of the Intangible Cultural Heritage
غواتيمالا,
© Ministerio de Cultura y Deportes / GMA PRO
UNESCO's regional capacity-building programme in Central America – benefitting from the generous contribution of Spain to the Intangible Cultural Heritage Fund and kicked-off some weeks ago in Honduras – now materializes in Guatemala. The programme aims to develop institutional capacities and a national strategy for safeguarding intangible cultural heritage, built upon the experiences, views and aspirations of actors working in this field.
Twenty persons, including representatives from the Ministry of Culture and Sport and cultural managers from different parts of the country, will meet in Guatemala City from 15 to 17 April to discuss the key concepts of the Convention, the obligations of a State, the Convention's mechanisms for international cooperation and the Operational Directives that guide its implementation. Conducted by two members of UNESCO's network of expert facilitators, Ms Soledad Mujica (Peru) and Ms Eva Martínez (Honduras), these working sessions benefit from the momentum shown by Guatemala over the past two years in the use of the international mechanisms of the Convention.
الاجتماع
Workshop on the implementation of the 2003 Convention at the national level in Guatemala (١٥ أبريل، ٢٠١٣ – ١٧ أبريل، ٢٠١٣)
Strengthening national capacities for effective safeguarding of intangible cultural heritage in Central America (١ أغسطس، ٢٠١٢ – ١ مارس، ٢٠١٤)

redpajama_set_name: RedPajamaCommonCrawl


text:
Facebook Stops Asking Users to Rat Out Friends Using Fake Names
Facebook users with unconventional names can rest easy – the social network has ended an experiment that called on users to rat out friends using fake names.
By Stephanie Mlot
September 26, 2012 4:57PM EST
VIEW ALL PHOTOS IN GALLERY
Facebook recently started displaying a survey to its users that asked: "Is this your friend's real name?" It served up an image of your friend, as well as the name they were currently using on Facebook and their location. Facebook users were given the option to respond Yes, No, I don't know this person, or I don't want to answer.
The survey was first reported on Twitter by activist/artist/photojournalist/writer @chapeaudefee, and picked up by security firm Sophos. "Are you going to be the snitch?" @chapeaudefree asked.
Facebook confirmed to TPM the next day that for a few months, the social network has been analyzing usernames. "This system has been in a few different incarnations over the past couple months," a Facebook spokesman told TPM. "It changes depending on what's being asked."
A Facebook spokeswoman today told PCMag that the social network has now ended what it called a limited survey.
"We are always looking to gauge how people use Facebook and represent themselves to better design our product and systems," the spokeswoman said in an email. "We analysed these surveys only using aggregate data and responses had zero impact on any user's account."
According to Facebook's official name policy, "Facebook is a community where people connect and share using their real identities." The network, whose Terms of Service directly state that users provide a real name, wants people to use their given titles in an effort provide a safe community for people to connect with others.
But it's clear that Facebook is fighting a losing battle.
Last month, the site reported that it now has more than 950 million monthly active users, but about 8.7 percent of those accounts are duplicates, misclassified, or "undesirable." In the big picture, about 83 million accounts are trying to spam you, are in violation of Facebook's rules, or are just confused.
Those numbers, however, are based on an internal review of a limited sample of accounts, Facebook said last month, and may not accurately reflect the actual number of such accounts.
For more, check out PCMag's "7 Ways to Embarrass Yourself on Facebook" slideshow below.
For more from Stephanie, follow her on Twitter @smlotPCMag.
iPhone 5 Users Report 'Purple Flare' Camera Defect
Can BlackBerry Balance Turn RIM's Enterprise Fortunes Around?
Stephanie Mlot
Stephanie joined PCMag in May 2012, moving to New York City from Frederick, Md., where she worked for four years as a multimedia reporter at the second-largest daily newspaper in Maryland. She interned at Baltimore magazine and graduated from Indiana University of Pennsylvania (in the town of Indiana, in the state of Pennsylvania) with a degree in ... See Full Bio
More From Stephanie
10 Halloween Costumes to Help You Geek Out
8 High-Tech Wedding Ideas
18 Games to Help You Survive the Commute
Muzzle Chatty Colleagues With Hushme Headset
8 Tech Execs Who Should NOT Run for Office


text:
<?php

namespace Drupal\Tests\migrate_drupal\Unit\source\d6;

use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;

/**
 * Tests the variable source plugin.
 *
 * @group migrate_drupal
 */
class i18nVariableTest extends MigrateSqlSourceTestCase {

  // The plugin system is not working during unit testing so the source plugin
  // class needs to be manually specified.
  const PLUGIN_CLASS = 'Drupal\migrate_drupal\Plugin\migrate\source\d6\i18nVariable';

  /**
   * Define bare minimum migration configuration.
   */
  protected $migrationConfiguration = [
    'id' => 'test',
    'highWaterProperty' => array('field' => 'test'),
    'source' => [
      'plugin' => 'i18n_variable',
      'variables' => [
        'site_slogan',
        'site_name',
      ],
    ],
  ];

  /**
   * Expected results from the source.
   */
  protected $expectedResults = [
    [
      'language' => 'fr',
      'site_slogan' => 'Migrate est génial',
      'site_name' => 'nom de site',
    ],
    [
      'language' => 'mi',
      'site_slogan' => 'Ko whakamataku heke',
      'site_name' => 'ingoa_pae',
    ]
  ];

  /**
   * Database contents for tests.
   */
  protected $databaseContents = [
    'i18n_variable' => [
      array('name' => 'site_slogan', 'language' => 'fr', 'value' => 's:19:"Migrate est génial";'),
      array('name' => 'site_name', 'language' => 'fr', 'value' => 's:11:"nom de site";'),
      array('name' => 'site_slogan', 'language' => 'mi', 'value' => 's:19:"Ko whakamataku heke";'),
      array('name' => 'site_name', 'language' => 'mi', 'value' => 's:9:"ingoa_pae";'),
    ],
  ];

}

redpajama_set_name: RedPajamaGithub


text:
Q: RegularExpressionValidator With DropDownList(asp.net) I'm trying to display an error message when someone tries to submit a form without selectiong a "state" from a dropdownlist. I know I can put in an error message using a RegularExpressionValidator, but what would I use for the Validation Expression?
<asp:DropDownList ID="dropState" runat="server">
    <asp:ListItem Value="" select="True">Select One</asp:ListItem>
    <asp:ListItem Value="">Not in USA</asp:ListItem>
    <asp:ListItem Value="AL">Alabama</asp:ListItem>
    <asp:ListItem Value="AK">Alaska</asp:ListItem>
    <asp:ListItem Value="AZ">Arizona</asp:ListItem>
    <asp:ListItem Value="AR">Arkansas</asp:ListItem>
    <asp:ListItem Value="CA">California</asp:ListItem>
    <asp:ListItem Value="CO">Colorado</asp:ListItem>
    <asp:ListItem Value="CT">Connecticut</asp:ListItem>
    <asp:ListItem Value="DE">Delaware</asp:ListItem>
    <asp:ListItem Value="DC">District of Columbia</asp:ListItem>
    <asp:ListItem Value="FL">Florida</asp:ListItem>
    <asp:ListItem Value="GA">Georgia</asp:ListItem>
    <asp:ListItem Value="HI">Hawaii</asp:ListItem>
    <asp:ListItem Value="ID">Idaho</asp:ListItem>
    <asp:ListItem Value="IL">Illinois</asp:ListItem>
    <asp:ListItem Value="IN">Indiana</asp:ListItem>
    <asp:ListItem Value="IA">Iowa</asp:ListItem>
    <asp:ListItem Value="KS">Kansas</asp:ListItem>
    <asp:ListItem Value="KY">Kentucky</asp:ListItem>
    <asp:ListItem Value="LA">Louisianna</asp:ListItem>
    <asp:ListItem Value="ME">Maine</asp:ListItem>
    <asp:ListItem Value="MD">Maryland</asp:ListItem>
    <asp:ListItem Value="MA">Massachusetts</asp:ListItem>
    <asp:ListItem Value="MI">Michigan</asp:ListItem>
    <asp:ListItem Value="MN">Minnesota</asp:ListItem>
    <asp:ListItem Value="MS">Mississippi</asp:ListItem>
    <asp:ListItem Value="MO">Missouri</asp:ListItem>
    <asp:ListItem Value="MT">Montana</asp:ListItem>
    <asp:ListItem Value="NE">Nebraska</asp:ListItem>
    <asp:ListItem Value="NV">Nevada</asp:ListItem>
    <asp:ListItem Value="NH">New Hampshire</asp:ListItem>
    <asp:ListItem Value="NJ">New Jersey</asp:ListItem>
    <asp:ListItem Value="NM">New Mexico</asp:ListItem>
    <asp:ListItem Value="NY">New York</asp:ListItem>
    <asp:ListItem Value="NC">North Carolina</asp:ListItem>
    <asp:ListItem Value="ND">North Dakota</asp:ListItem>
    <asp:ListItem Value="OH">Ohio</asp:ListItem>
    <asp:ListItem Value="OK">Oklahoma</asp:ListItem>
    <asp:ListItem Value="OR">Oregon</asp:ListItem>
    <asp:ListItem Value="PA">Pennsylvania</asp:ListItem>
    <asp:ListItem Value="RI">Rhode Island</asp:ListItem>
    <asp:ListItem Value="SC">South Carolina</asp:ListItem>
    <asp:ListItem Value="SD">South Dakota</asp:ListItem>
    <asp:ListItem Value="TN">Tennesee</asp:ListItem>
    <asp:ListItem Value="TX">Texas</asp:ListItem>
    <asp:ListItem Value="UT">Utah</asp:ListItem>
    <asp:ListItem Value="VT">Vermont</asp:ListItem>
    <asp:ListItem Value="VA">Virginia</asp:ListItem>
    <asp:ListItem Value="WA">Washington</asp:ListItem>
    <asp:ListItem Value="WV">West Virginia</asp:ListItem>
    <asp:ListItem Value="WI">Wisconsin</asp:ListItem>
    <asp:ListItem Value="WY">Wyoming</asp:ListItem>
    <asp:ListItem Value="AB">Alberta</asp:ListItem>
    <asp:ListItem Value="BC">British Columbia</asp:ListItem>
    <asp:ListItem Value="MB">Manitoba</asp:ListItem>
    <asp:ListItem Value="NB">New Brunswick</asp:ListItem>
    <asp:ListItem Value="NL">Newfoundland and Labrador</asp:ListItem>
    <asp:ListItem Value="NT">Northwest Territories</asp:ListItem>
    <asp:ListItem Value="NS">Nova Scotia</asp:ListItem>
    <asp:ListItem Value="NU">Nunavut</asp:ListItem>
    <asp:ListItem Value="ON">Ontario</asp:ListItem>
    <asp:ListItem Value="PE">Prince Edward Island</asp:ListItem>
    <asp:ListItem Value="QC">Quebec</asp:ListItem>
    <asp:ListItem Value="SK">Saskatchewan</asp:ListItem>
    <asp:ListItem Value="YT">Yukon</asp:ListItem>
</asp:DropDownList>

A: Add an item with an empty value to the dropdown, which you have:
<asp:ListItem Value="" Selected="true">Select One</asp:ListItem>

And use a required field validator with InitialValue set to empty string, like this:
<asp:RequiredFieldValidator ID="reqState" runat="server" InitialValue="" ControlToValidate="dropState" ErrorMessage="*"></asp:RequiredFieldValidator>

A: Use a RequiredFieldValidator and set it's InitialValue to String.Empty:
<asp:RequiredFieldValidator ID="valState" runat="server"
                            ControlToValidate="dropState"
                            Display="Dynamic"
                            ErrorMessage="Please select a state in USA."
                            InitialValue=""
                            Text="*">
</asp:RequiredFieldValidator>

If this does not work because the DefaultValue must be set to something different than the default String.Empty(not tested), change the value of your empty ListItem to f.e "-1" nad the Validator's InitialValue accordingly.

A: If you are having numerical value then InitialValue="0" or in case of string it should be blank.
int value
InitialValue="0"

string value
InitialValue=""

Full Code
<asp:RequiredFieldValidator ID="rfvState" runat="server" ControlToValidate="dropState" Display="Dynamic" ErrorMessage="*" ToolTip="Please select the state" InitialValue="0"/>

A: Use the RequiredFieldValidator like this below:
<asp:RequiredFieldValidator ID="rfvState" runat="server" ControlToValidate="dropState" Display="Dynamic" ErrorMessage="Please select the state" InitialValue="-1">*</asp:RequiredFieldValidator>

redpajama_set_name: RedPajamaStackExchange


Get yourself feeling BOMB for the weekend! Our Bath Bomb Trio is a set of 3, delicious bath bombs of colour.
W7 Angel Manicure "A manicure sent from the heavens"
Fancy an Ultra Violet Twist? With all the shades from Aladdin's Cave, this palette will take your eye game to a new level.


text:
Everything About Black Panther Sequel
MoviesTrending
By Momina Wijdan	 Last updated Jun 25, 2019
Given the massive success and popularity of the Black Panther, we are sure Marvel studios would definitely give us a sequel to it. And guess what? It has been confirmed!
Related: Upcoming Marvel Movies In Order Of Release After Avengers: Endgame
Confirmation of Black Panther Sequel
There's confirmation as well, as per the Marvel Studio boss Kevin Feige.
[I have] nothing specific to reveal, other than to say we absolutely will do that. One of the favourite pastimes at Marvel Studios is sitting around on a Part One and talking and dreaming about what we would do in a Part Two.
Plus, Ryan Coogler is writing the screenplay for the movie already. There are plants to start shooting the movie in early 2020 or late 2019. Marvel is keen on keeping a steady pace for its upcoming movies after Avengers: Endgame.
Related: Let's Talk About Avengers: Endgame Ending, Shall We?
We will certainly be seeing our favorite cast of Black Panther again in the sequel. That means we'll see Chadwick Boseman (T'Challa/Black Panther), Daniel Kaluuya (W'Kabi), Lupita Nyong'o (Nakia) and Letitia Wright (Shuri) of course. Plus, Martin Freeman (CIA agent Everett K Ross), Angela Bassett (Ramonda, T'Challa's mother), Winston Duke (M'Baku), Danai Gurira (Okoye) and Daniel Kaluuya (W'Kabi) as well.
Moreover, the rapper who came up with the original music for the movie Kendrick Lamar is interested in taking up a role in the movie too!
What About the Villain?
We all know that a good comic book movie revolves around a good villain. That is why Erik Killmonger (Michael B. Jordan) was such a great addition in the Black Panther universe. He was one of the main reasons the movie got so much hype.
There is a slight possibility that he might return. Jordan himself has expressed how he would love to come back as Killmonger. The only way he could might be through flashbacks. Another way could be through something else.
If you've watched the movie, you would recall that Killmonger ingested a heart-shaped herb. Through it, he got the power of Black Panther. When you become the Black Panther, you are spiritually connected to the realm of Bast.
After T'Challa's ancestors died, they resided in the realm to pass onto their wisdom to whoever becomes the Black Panther. By that logic, Killmonger might also be roaming around the realm because he ingested the herb.
Related: Avengers: Endgame Grossed Millions of Dollars on Premiere Day
Release Date of Black Panther Sequel
It will either come in late 2020 or early 2021, as per speculations. Considering the placeholder dates of Disney, Black Panther could come either on November 6th 2020 or February 12th 2021.
Black PantherBlack Panther SequelFuture Marvel MoviesMarvelMarvel MoviesUpcoming Marvel Movies
Our Unflinching Emmys 2019 Nomination Predictions
Spiderman 3: Everything We Know So Far
Angelina Jolie Agreed To Do Eternals Movie Because of Her Children
Upcoming Marvel Movies In Order Of Release After Avengers: Endgame


Training opportunities for you to step into with Crown Church.
Impact is a gap-year programme run by New Ground. If you're 18+ and want to go deeper in your relationship with God. Please watch the video below and visit the New Ground Impact page for more details.
The New Ground Academy is a training community for church leaders and church shapers - mainly, but by no means exclusively, from the New Ground family of churches. It runs for two years, monthly on Fridays and Saturdays. Visit the Academy page for more details.


Five large pieces of steel reinforcing processing equipment including the Synthesis machine arrived from Europe earlier this year to fit out SmartReo's state-of-the-art manufacturing site.
As part of the site set-up, the team focused building quality and safety into the operation from the outset. To achieve this, they developed processes with minimised human intervention to safely manufacture a repeatable, high quality and reliable product.
After constructing the plant and refining processes, the Wacol site is now close to operational with final factory acceptance testing and commissioning currently underway.
"Our team have worked hard over the past three months to install and commission our new machinery and technology", said SmartReo General Manager Dom Allen. "I'm proud of how they've pulled together in a safe, positive and proactive manner".
The Wacol site is expected to be ready to prefabricate its first steel reinforcing order in November.


text:
Boro linked with Sunderland goalkeeper
Middlesbrough FC have been linked with the 31-year-old Sunderland goalkeeper.
Boro are considering a move for Sunderland goalkeeper Jon McLaughlin, amid speculation that Stoke City are keen on securing the services of Darren Randolph.
According to Teamtalk, Boro have identified the 31-year-old Sunderland goalkeeper as a suitable replacement for Randolph, who was voted the Championship Goalkeeper of the Year last season, along with being named in the Championship Team of the Year.
Jon McLaughlin was named Sunderland's Player of the Year last season as they missed out on promotion back to the Championship at the first attempt, having lost the League One play-off final to Charlton Athletic.
Boro are joined by Championship rivals Millwall, who are also looking to sign McLaughlin. According to the Sun on Sunday, Millwall are set to offer £1 million for the Scotland international, however Sunderland are holding out for £5 million.
Middlesbrough interested in Bristol City forward
Neil Warnock delighted to have Duncan Watmore on board
Sunderland signed McLaughlin from Hearts on a free last summer, on a two-year deal.
More Boro news...
Boro linked with French free agent
Boro once again linked with Spurs winger


Selling this much loved wedding dress by Madison James. It's Ivory lace with an Ivory colour underlay. It's goes into tulle tail. Top section is sheer with beautiful lace detail. Back is completely sheer with lace details and buttons. Worn one for my wedding in February 2019. Just returned from Dry Cleaners. It's a truly stunning dress and I got so many compliments for it, especially for the back detail. Size 8 AU (fits 6-8) It's a Madison James gown purchased from Brides of Sydney paid over $2500 plus alterations.
Just returned from dry cleaners. Also comes with a single tier veil, Retail $150 included in the price.


text:
Q: How to set minimum height for UITextView that grows dynamically? I have a GrowingTextView which increases its height when content size increases.
override viewDidLoad() {
    tv.translatesAutoresizingMaskIntoConstraints = false
    tvHeight.constant = 200
    tv.sizeToFit()
}

func textViewDidChange(_ textView: UITextView) {
    if textView.contentSize.height > 200 {
        textView.sizeToFit()
    }
    updateScroll()
}

I want to set minimum height to the text view as 200, but it is not working. I tried in IB as well as code. The UI has the below components each with 16 as leading and trailing and 8 as top and bottom constraints.
UITextField - Title
GrowingTextView - tv
UITextField - Author
UITextField

How to set the min height for text view?

A: Using the library that you mentioned GrowingTextView in your comment you can use the parameter minHeight = 200.
tv.minHeight = 200

In that case I think you don't need the height constant tvHeight.constant = 200. Here is an example:
override viewDidLoad() {
   super.viewDidLoad()
   tv.translatesAutoresizingMaskIntoConstraints = false
   tv.minHeight = 200
   tv.sizeToFit()
}


text:
The UNESCO World Heritage Site of Jiuzhaigou Valley National Park is famous in China for its remarkable natural phenomena. Located in the north of Sichuan Province, on the edge of the Tibetan Plateau, the diverse forest ecosystems of the park house a diverse array of flora and fauna and boast many topographical features of exceptional beauty.
Within the park, the main attractions are its various glacial lakes, many of which are brightly hued, some translucent, some mirrored. The names of the lakes - Five Flower Lake, Swan Lake, Reed Lake, Mirror Lake and so on - provide some insight into their beauty. Aside from lakes, there are pine forests, waterfalls, majestic valleys, towering peaks and remote Tibetan villages to explore
Jiuzhaigou Valley National Park
The park itself is immense and has many walking and hiking trails. You can visit the major sites within in on foot, taking the bus to attractions at the very top of the park. Three valleys make up the park – Rize Valley, Zechawa Valley and Shuzheng Valley, each with their own unique set of natural phenomena. It takes at least a full day to see each site – two days to cover the entire park will allow you to enjoy it at a more relaxed pace. The park draws many domestic tourists each day.
Qu Nae Valley
This picturesque valley sets the scene for nature walks and wilderness hikes. As part of the park, it's a protected UNESCO Biosphere Reserve and is home to Sichuan takin (a type of cattle), and Chinese goral (a type of goat). Only recently open to tourists, you can still see it in a largely untouched state, and enjoy seeing bird and wildlife activity. There is a selection of hikes through the valley.
The Jiuzhaigou National Arts Center
Here you can enjoy a Tibetan / Qiang minority folk performance – a colorful display with bright costumes and lively dance. Highland barley tea and yak butter tea are offered to complete this cultural experience.
Zharu Valley
This quiet valley offers eco-tourism and is seldom visited by domestic travelers. It houses small, colorful Tibetan villages and offers great opportunities for trekking and camping. Shuzheng Village is one Tibetan village within the valley where travelers can homestay with locals and enjoy traditional Tibetan meals and yak butter tea. A predominant feature of the valley is the sacred Zha Yi Zha Ga Mountain, around which you can do a three-day pilgrimage hike. The valley has around 20 miles of walking and hiking trails, some quite steep.
CHINA Regions
Western & Silk Road
Zhangye Danxia
Litang
China Itineraries
By InterestAmazing LandscapesUnescoWildlife
By DateFeburaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovember
China's Natural Wonders: National Parks and Pandas
Journey through China's most picturesque landscapes on this exciting 13-day luxury journey. You'll hike through the stunning Yellow Mountain and Jiuzhaigou National Park, tour Tibetan villages of the Zharu Valley, and play with Pandas in Chengdu, while staying at luxury hotels like Amanfayun or Banyan Tree.
Interests Amazing Landscapes, Wildlife
Destination China
The Sights of Sichuan
Marvel at Sichuan, China's incredible history and natural beauty on this 8-day luxury tour that voyages through Chengdu, Jiuzhaigou, and Mt Emei. Get a taste for the area's past at sites like Huanglong and the Giant Buddha of Leshan, while also checking out the Chengdu Panda Base and the Jiuzhaigou Valley Scenic Area.
Interest Wildlife
China's Magnificent Mountaintops by Private Jet
Spend 11 days traveling in sheer luxury as your private jet whisks you across China's mountaintops. Starting in Beijing, you'll discover the lush Shangri-La valley on the edge of the Tibetan Plateau, observe colorful cliffs in Zhangye Danxia, and stay overnight in luxury hotels like Banyan Tree and Songstam.
Interests Amazing Landscapes, Unesco
Ritz-Carlton Jiuzhaigou
The new Ritz-Carlton Jiuzhaigou is located near the heart of one of China's earliest UNESCO world heritage sites at the stunning Jiuzhaigou National Park. With snowcapped mountain ranges, glass-clear waters, and a myriad vivid colors, the park alone provides an unforgettable experience for visitors. At the Ritz-Carlton the park's beauty to be enjoyed from the comfort and class of a world-class luxury resort. The 87 villas furnish panoramic views over the surrounding valley and house such luxuries as a rainforest shower and walk in bath tub. The hotels three premium restaurants offer a variety of dishes encompassing Tibetan, Sichuan, Cantonese, Italian, and Southeast Asian flavors. The resort is replete with a spa, indoor and outdoor event spaces, kids' programs, and knowledgeable staff. The Ritz-Carlton Jiuzhaigou is due to open soon, and may be tentatively included in Remote Lands itineraries pending the opening date.
Jiuzhaigou Grand Hotel
Within walking distance from the popular Jiuzhaigou National Park, Jiuzhaigou Grand Hotel offers a simple and comfortable stay for people travelling through this part of China. Nothing too over-the-top here-- staff are friendly, rooms are cozy with comfortable beds, and buffet breakfasts are included at very reasonable rates. It is one of three hotels in this area that have WiFi services available and credit card facilities at the reception desk, restaurant and on-site convenience shop. If language becomes a barrier, the staff are very quick to find someone who will be able to translate for your convenience. The decor and layout of the rooms are tasteful, with twin beds for double occupancy and clean bathrooms, which are supplied with shampoo, bath towels and soap. This is a simple, comfortable place for a good night's sleep.
Sheraton Jiuzhaigou
Between the Duo'ema Mountain Range and the Qinghai-Tibet Plateau, sprawls the Sheraton Jiuzhaigou Resort. Set amidst miles and miles of conservation area inhabited by pandas and monkeys, surrounded by glassy lakes and sparkling waterfalls, the hotel is a true retreat into Southwestern China's fairy land. On site, the accommodation is world class; from superior rooms to presidential suites, the decor is elegant but cosy, with all the mod cons including high-speed internet and enormous flat-screen televisions. Dining options are diverse, from the flavors of Sichuan, Tibet and Qiang at Pearl Court Restaurant to international choices at Coloured Lake Cafe. What's more, there's live music and entertainment in the basement disco including karaoke or, for a more tranquil evening, cocktails, wines and cigars are on offer in the lobby bar. Recreation opportunities abound with an onsite theater, indoor pool and a games room featuring table tennis and billiards. Guests in need of a little pampering can head to the spa where a range of treatments are available as well as wet and dry saunas.
China Goes Well With
Chinese Food: The Need-to-Knows
So, you think you know Chinese food? The ubiquitous cuisine we in the west consider to be Chinese accounts for only a tiny percentage of the vast array of dishes represented by this huge country's many regions.


Over the last eight years, through hard work and collaboration, our Council has brought initiatives that have been stalled for years or even decades to fruition. Not with great fanfare. Not with back slapping self-congratulation. Just doing the job expected by the people who put their faith in us.
Developing library Square into a vibrant community space.
I understand this as I use this intersection at least two times every day.
Traffic, like water, takes the path of least resistance.
The main issue is simply volume. And the secondary issue is that the design of the intersection has not been updated.
We keep growing, so volume is not going away. Therefore, we need to be able to redirect traffic away from that intersection and we also need to redesign the intersection.
Traffic is a product of growth. Growth that is assigned by the Province. And, while one Ministry is dictating growth, another Ministry (Transportation) is taking away infrastructure needed to help manage that growth. Which is why I have requested the Province to press the pause button on the places to grow act, so we can reevaluate our service level.
We are also working on redesigning the Yonge / Wellington intersection, adding a 3rd lane in the southbound direction to accommodate buses and right turns. Redesigning to address the root cause.
It is truly unfortunate that such an important issue to our Town has become such a divisive one.
Which is why I have been advocating for Site Plan review (by professional staff) and the hiring of an independent consultant to assist in the process of defining an appropriate look and feel for infill housing.
To remove the political rhetoric.
To stop pitting neighbour against neighbour.
It is reminiscent of a similar issue last term – designating the Yonge / Wellington South East quadrant as a Historical District. It was also divisible in the neighbourhood and one that could have been avoided. There are remnants still there.
There are three areas defined as "stable neighbourhood" – Regency Acres, Aurora Heights and the Town Park area. Each are unique and the site plan process will be set up to recognize that.
Despite appearances to the contrary, probably as many people do not want any restrictions as those who do.
As Elected Officials, our obligation is to listen to all points of view, and then make a decision that is in the best interests of all of our residents.
I believe the approach we are taking will provide this.
Staff are currently working on the specifics of the site plan approval process with the Goal was to have a consultant engaged by December.
Aurora has benefited from growth both financially and culturally. Over the past few years, our community has welcomed newcomers from many diverse cultures and traditions, and together we have flourished and furthered Aurora's legacy of inclusiveness.
Aurora is nationally recognized as one of the best places to live in Canada. We reached and maintained this status through strategic long-term planning that balanced growth with the need to maintain the small town charm that attracted families to our municipality.
Growth targets and population densities are mandated by The Government of Ontario through The Places to Grow Act, and municipalities are legally required to follow its directives. York Region's Official Plan and The Town of Aurora's Official Plan provide useful guidelines to help facilitate these mandates.
Managing growth that is balanced and sustainable is a challenging process, with few easy answers. As Your Mayor, I have always advocated strongly for strategic, long-term planning, and I will continue to my efforts to diligently scrutinize the merits of each development from a social and economic perspective, to ensure that community interests are considered and respected.
While Aurora has grown tremendously, we remain 6 per cent below the province's mandated growth target.
As we reach full build-out and approach our mandated growth target, the time is now to undertake an objective appraisal of The Places to Grow Act to ensure Aurora has the tools to manage growth responsibly and in the interests of our residents. Growth exacts a toll on our infrastructure, culture and our environment. We have reached a tipping-point in our development, where provincially-mandated growth will shortly exact an unacceptable cost on our environment, our services and the many qualities that make our community so attractive.
That is why I recently joined Mayors across the GTA to ask Premier Ford to "hit the pause button" on The Places to Grow Act. We need to halt this legislation to take stock of our growth and determine the best way for communities to go forward with their future development.
The financial health of the Town of Aurora has never been better.
Aurora has become the envy amongst the majority of Ontario Municipalities across the Province.
Aurora's Debt to Equity Ratio is a remarkably low 1.9% – making Aurora virtually a debt free community.
This does not happen by chance!
But rather it comes from having a strategic vision, bringing strong proven leadership skills to the table. It requires prudent fiscal management from an individual who has a successful track record of managing a multi million dollar corporations such as the Town of Aurora. Residents demand and deserve nothing less to preserve and protect their town and resident owned assets. To protect their stable and sustainable low tax rate.
Aurora resident per capita asset value is approximately $8,000.00 per resident.
A result Mayor Dawe has worked tirelessly over his 2 terms as Your Mayor – Aurora's Mayor, to transform Aurora into a more vibrant, prosperous, healthier and better Aurora for all residents.
Development Charges and not from property taxes through the tax levy.
** A valuable footnote the Town's LED street light conversion project of $2,400,000 is this debt service is neutral.
The actual annual realized energy savings of over $300,000 serves to pay the off 10 year debenture mortgage.
Once this debt is fully paid off the annual savings of approximately $300,000 are realized by the town.
This term, under my leadership, Council has delivered not only the lowest, but the most consistent tax rates in the last 20 years.
We did this by implementing a set of budget principles that help direct staff in preparing budgets. Gone are the days where we play the "High Low" game, where staff comes in with a large increase, and then Council low-balls, we go back and forth and finally settle on a tax increase.
We did this by moving towards a multi-year budgeting model that provides a much better forecasting capability, and by setting a principle that our Tax Increase will be no more than the rate of inflation of Toronto.
By using a predefined, verifiable inflation rate (for the 12 month period of July 1 to June 30), we have set clear goals that staff work to, which has brought a great level of certainty to our budgeting process.
Aurora is blessed with a great variety of high quality services and amenities. And we continue to add.
We have added parks, including the fully accessible Queen's Diamond Jubilee Park; trails, new facilities and new recreational fields.
We improved our snow clearing services for the 2017/2018 season by combining our Roads and Parks crews, almost doubling our capabilities, but not the cost.
And, we will continue to look for efficiencies.
The Aurora Armoury is one of our most significant historical assets.
Built in 1874, it was the longest serving Canadian Armoury until it was decommissioned in 2014, when the Town purchased it from the Canadian Government.
The Armoury has a rich history and the unique distinction of being one of two homes to the Queen's York Ranges (the other being Fort York in Toronto.
Despite this storied past, the Armoury was run down, and when we purchased it, pretty much unusable for any purpose.
Our Council made the decision to move forward with renovations to this building, to recapture it's former glory and to provide usable community space.
Coincident with this, Council agreed to work with the Canadian Food and Wine Institute, a division of Niagara College to set up a culinary school.
I firmly believe this is a win-win situation for our Town.
We are restoring a significant historical asset in our Town. We are creating new community space for our Town. We are fulfilling a significant goal of our Strategic Plan which is to attract a post-secondary facility.
Like I said – a win-win for our Town!
There is no doubt that the downtown area is a significant part of what Aurora is. It is historically and culturally significant and I believe that we need to do what we can to preserve that.
An important part of the preservation strategy is to promote / improve investment in this area: public & private; commercial & residential.
From the public perspective, the Town is moving forward on both the Library Square and Armoury projects which I believe will be a significant attractor, and will definitely help support businesses in that area.
From private perspective, there has been a lot of residential activity over the last 4 years, either completed or planned that will result in people living in the area. People who will patronize local businesses. Which will be a driver for more businesses.
Additionally, I have been very active in getting the Business Improvement Area association – BIA – established.
The BIA is complimentary to the Chamber (indeed, Executive Director of the Chamber has been instrumental on the BIA steering committee), and dedicated to promoting businesses in that defined area.
I believe we are turning a corner in finally moving forward in downtown revitalization.
Our goal with Library Square is to create a community hub within our historic downtown core. A "people" attractor that will be a huge economic boost to that area.
When the new Library was opened in early 2000s, and when the new Seniors' Centre was opened in 2006, we were in the position of having two buildings that had been purpose built and not particularly adaptable for other uses.
The old Seniors' Centre, which was originally a fire hall, ended up being rented out for commercial uses.
The old Library was rented out to some community groups in a deal that was costing the Town tens of thousands of dollars every year.
Further, an analysis of the building showed that we would need to put in over $500,000 to bring it up to standards, and we would still be stuck with a purpose built facility that was not easily convertible.
Council made the tough decision to take both of these buildings down. Which gave us the opportunity to look at this from a new perspective – no preconceived ideas of how to use what was there, but a clean slate.
After decades of discussions, well over a dozen reports, many public consultations, we are now moving forward with another project that was stalled.
And, to be perfectly clear, we are still looking at how to move forward with that area. Yes, we are looking at a new building, but no decisions have been made. We are still looking for public input on this. For others to say we are plowing ahead is simply not true.
It is a disservice to those on Council who have worked hard on this project and to our residents, who are being misled for cynical political purposes.
Having been President and CEO of a consulting firm located here, I can safely state that the primary consideration as to where I would locate is a business friendly environment.
It means a consistent approach to how the Municipality deals with taxes, with regulations, with the permitting process. Just generally, how does the local government deal with the business? Do they work with you? Or put up roadblocks.
When I was elected Mayor in 2010, I was committed to ensuring that the Town of Aurora would be a business friendly place.
That does not mean giving away the shop!
It means recognizing that everyone's time is valuable so we need to be as efficient as possible. It means implementing programs like the Business Concierge Service, which provided one stop shopping for a business looking to set up a new operation or making changes to their current one. To remove those obstacles.
In the last eight years, we have attracted over 300 new businesses; over 5,000 new jobs; we have had the highest rate of job growth in York Region; and by having close to the lowest Commercial and Industrial tax rates in York Region.
I understand and appreciate what is important – and am committed to maintaining that!
No denying it – the old 'Howard Johnson' hotel is an eyesore.
And, we would all like it cleaned up!
It is important to remember that this is private property. So, while we can enforce property standards, we are pretty limited in what we can actually do to affect change.
The first is to encourage the current owners to either fix it up themselves or sell it to someone who will.
Fixing it up seemed a possibility, especially when I met the owner in January of 2017. He came to my office, and told me he was going to fix it all up. Which was great!
And, then he advised me that he was going to do all the work himself, because everyone tried to steal from him. As I would guess that he was mid-80s at that time (he has since passed away) – not so great!
Now we need to look at the sell option. The town has attempted to broker a number of deals, but to no avail. Just when it seems to get close, the owners balk.
So, our last option is expropriation, which as some may know, is a forced sale! Not the most desired course of action, but sometimes necessary.
And, I believe in this case, necessary and justifiable.
Which is why I tried to work with my fellow Council members to take that action.
I was not supported, and, so here we are, over a year later, no progress.
Not because I did not do anything.
Because Council refused to act.
One of the main reasons I lobbied the Provincial Government to "press the pause button" on the Places to Grow Act is the obvious inability of the various Provincial Ministries to work together.
A prime example of this is under the Places to Grow Act, Aurora has been assigned growth targets. Minimum growth targets. Which requires a tremendous amount of infrastructure.
Such as the interchange at the 404, so that traffic can be properly handled.
Yet the Ministry of Transportation removed the interchange as a budget measure.
By working with my Regional colleagues, we managed to get this back into the capital plan.
While the interchange is coming, we have experienced an unnecessary and avoidable delay with negative impact on our community.
Provincial departments simply need to work better together and much better with their municipal partners.
In 2010, I asked to be Your Mayor, to put Aurora back on course, and that is what we have done!
Leadership is about considering the various viewpoints and then making decisions that can best meet the larger community interest.
Once again, we seem to be at a crossroads. With the reduction from 8 to 6 Councillors, and with the loss of 4 of our current sitting elected officials, Aurora will see significant change.
It is even more imperative that we understand the impact this can have and the challenges ahead of us.
I believe in an Aurora where all residents are treated with respect, where our streets are safe and where everyone has the opportunity to prosper.
If you share my vision for Aurora and support passionate, proven leadership, vote Geoff Dawe for your Mayor – Aurora's Mayor on October 22.
Vote to keep Aurora progressive and prosperous for our present and our future!


I love insights and windows into real time and social media marketing hubs, especially when large companies such as adidas plan for global sporting events such as this years World Cup.
Adidas tracked traffic to store visits and sales and will continue after the world cup.
Adidas mention how their YouTube channel has doubled in size since the beginning of the tournament, it is definitely a hint in what area adidas are probably going into (other sports giants have suggested how they are looking at real time marketing and becoming a direct marketing outlet themselves especially through using rich media).
With all of this and props to the agency I can definitely say adidas were #allinornothing and despite being an official sponsor it did not hold adidas back with a holistic marketing campaign to engage with global fans and push awareness and sales.
Let's see how the post tournament numbers look, so far adidas has reported really impressive numbers. I am pretty sure the German sports giant is also pretty pleased with its home nation winning the World Cup and having the ability to double market their successes.
Nielsen have today released impressive stats that 70% of tweets about adidas are actually connected to the World Cup, showing how well the brand and tournament have been associated and how on point adidas have really been.
Well done adidas, you are definitely raising the standards for us to aspire to.


text:
Football gossip: Griezmann, Guardiola, Sarri, Bale, De Ligt, Ndombele, Lukaku, Pogba
From the section Gossip
http://www.bbc.com/sport/48614760
Atletico Madrid's chief executive Miguel Angel Gil Marin has confirmed France striker Antoine Griezmann, 28, will move to Barcelona this summer. (Sport)
Manchester United want to make a late bid to sign Griezmann and are prepared to offer Atletico Madrid £95m for the forward. (Sun)
Manchester City manager Pep Guardiola has dismissed suggestions he is considering taking a break from football at the end of next season. (Independent)
Liverpool have renewed their interest in Lyon playmaker Nabil Fekir but will not pay the £53m fee they agreed with the Ligue 1 club for the 25-year-old France international last summer. (Le Progres, via Mail)
Juventus sporting director Fabio Paratici has arrived in London to conclude a deal for Chelsea's Italian manager Maurizio Sarri. (Calciomercato)
Too old or just not good enough?
Which Premier League squads need major surgery this summer?
Chelsea will refuse to let Sarri leave until the Italian champions meet the Blues' compensation demands. (Mail)
Chelsea defender Emerson Palmieri has been linked with a move to Juventus but the 24-year-old Italy international says he is happy at Stamford Bridge. (Star)
Manchester United have finally ended their pursuit of Wales international Gareth Bale - ruling out a move for the 29-year-old Real Madrid winger. (Evening Standard)
Matthijs de Ligt's agent Mino Raiola has met Paris St-Germain sporting director Antero Henrique over the transfer of the 19-year-old Ajax and Netherlands defender. The clubs are close to reaching an agreement of around 75m euros (£66.6m). (RMC Sport - in French)
French champions PSG have offered De Ligt a a five-year deal worth 12m euros (£10.6m) a year. (ESPN)
But Raiola has denied reports he travelled to France for talks with PSG to sort out a deal for De Ligt. (Express)
West Ham are close to signing Villarreal attacking midfielder Pablo Fornals, and a £24m deal for the Spaniard could be completed by the end of the week. (Guardian)
Tottenham's pursuit of Lyon and France midfielder Tanguy Ndombele, 22, is being complicated by his 75m euro (£66.6m) price tag. (Guardian)
Chelsea will not take up the option to buy Croatia midfielder Mateo Kovacic from Real Madrid. The 25-year-old is instead set for a return to Inter Milan. (Mail)
AC Milan are interested in signing Liverpool's Croatia centre-back Dejan Lovren, 29. (Sky Sports)
Liverpool would only consider letting Lovren leave if they receive an offer of at least £25m for the defender. (Times - subscription required)
Manchester United's Belgium forward Romelu Lukaku, 26, has said Inter Milan boss Antonio Conte is the "best manager in the world" and that, along with the Premier League, Serie A is the league he "always dreamed" of playing in. (ESPN)
Manchester United will hold out for at least £150m for France midfielder Paul Pogba, 26, this summer. (Mirror)
Arsenal are in advanced talks to sign Saint-Etienne's 18-year-old French defender William Saliba. (Le10Sport - in French)
Chinese club Dalian Yifang's Belgium winger Yannick Carrasco, 25, says he hopes he can return to Europe this summer amid interest from Arsenal. (Mirror)
Arsenal's Uruguay midfielder Lucas Torreira, 23, says there are not many things he enjoys about life in England after moving from Italian side Sampdoria last summer. (Ovacion, via Mirror)
Wolves have contacted fellow Premier League club Burnley about 26-year-old England defender James Tarkowski, who could also be a target for Leicester City. (Times - subscription required)
England defender Kyle Walker, 29, is set to open talks with Manchester City over extending his contract with the Premier League champions. (Sun)
Manchester City look set to miss out on Sochaux midfielder Lucien Agoume, with the 17-year-old Cameroon-born France youth international expected to sign for Inter Milan. (Star)
Championship play-off winners Aston Villa are set to make a £14m bid for Leeds United's 23-year-old English midfielder Kalvin Phillips. (Telegraph)
Wednesday's Scottish gossip
Wednesday's gossip column
Thursday's backpage of the Mirror
A cliff-top green and 'Calamity Corner' - Royal Portrush pro's hole-by-hole guide
Meeting the Queen and breakfast with the kids - inside England's World Cup journey
Watch the moment England won the World Cup
The mysterious death that haunts boxing
Vote for your favourite Open Championship moment
Blood, sweat & tears - the best Wimbledon final ever?
Hamilton makes history but F1's future talents deliver the racing
Why Griezmann's transfer provides more questions than answers
'A player who was a fan, determined to extract enjoyment out of each day'
'Meme Lord' Lando Norris plays 'caption this'
Read more on Football notifications, social media and more
Read more on Today's football gossip
Read more on Phil McNulty
Read more on How to get into football


text:
View D60 session videos here!
Dr. Randy Katz
Professor Katz is the Vice Chancellor for Research at the University of California Berkeley. He joined the Berkeley faculty in 1983, where, since 1996, he has been the United Microelectronics Corporation Distinguished Professor in Electrical Engineering and Computer Science. He is a Fellow of the ACM and the IEEE, and a member of the National Academy of Engineering and the American Academy of Arts and Sciences. He received his undergraduate degree from Cornell University, and his M.S. and Ph.D. degrees from the University of California, Berkeley.
Professor Katz has received the Outstanding Alumni Award of the UCB Computer Science Division, the CRA Outstanding Service Award, the Berkeley Distinguished Teaching Award, the Air Force Exceptional Civilian Service Decoration, the IEEE Reynolds Johnson Information Storage Award, the ASEE Frederic E. Terman Award, the ACM Karl V. Karlstrom Outstanding Educator Award, and the IEEE James H. Mulligan, Jr. Education Medal. His textbook, Contemporary Logic Design, has sold over 85,000 copies, and has been used at over 200 colleges and universities. In the late 1980s, with colleagues at Berkeley, he developed the concept of Redundant Arrays of Inexpensive Disks (RAID), which has become a foundational element of information technology systems. While on leave for government service in 1993-1994, he established whitehouse.gov and connected the White House to the Internet.
From ARPAnet to the Internet, Web, Cloud, and Beyond: What's Next? – Thursday, September 6, 4:25 pm – 5:30 pm
Follow @DARPA and #DARPA60 to Stay Posted


A major car accident can be a traumatic experience for you both physically and mentally. You may have some serious injuries that require weeks or even months of rehab, and it can take just as long or longer to get over the mental trauma of the experience. Although you can't get better overnight, you can make your healing process as smooth as possible if you take the right approach. Here are three tips that will help you heal.
When you're feeling stressed and physically broken down, it's not good to try and push through that. Give yourself at least a couple days off from work or school, and don't be afraid to take even more time if you need it. A doctor's note can ensure that your employer or your school doesn't punish you for this time off. Use the time off to relax and take a break from everything.
When you return to your normal routine, don't jump back in as if you hadn't been gone at all. It's better to ease yourself back into your everyday activities. This is especially true with any physical activities, such as working out or playing sports. You could reinjure yourself or slow down your healing process if you resume physical activities too soon or do too much. It's better to do a little less than you think you're capable of than to push too hard.
Any time you've suffered a major injury, you need to see a doctor. They can check the extent of your injuries and put together a recovery plan that helps you get back to normal as quickly as possible. If you're feeling depressed or stressed about your injury, consider seeing a mental health professional who can help you feel better. Medical bills can get expensive, and to avoid giving yourself something new to be stressed about, you should see what insurance is covering and consult with an auto accident attorney or firm like Alexander Law Group if you're having trouble getting the compensation you deserve.
Patience is the key when you're healing from a major car accident. Give yourself the time off that you need, and take it slow as you resume your life. Listen to your doctor and get in touch with a lawyer if your insurance claim is taking too long.


Search and adopt a Norfolk Terrier near you.
The Norfolk Terrier, game and hardy, with expressive dropped ears, is one of the smallest of the working terriers. It is active and compact, free-moving, with good substance and bone. One of the smallest of the working terriers, Norfolks are known to be "demons for their size." This observation is reinforced by the feverish activity of the Norfolk, a tiny dynamo who seizes every opportunity to tackle the seemingly impossible. Although an outgoing, energetic terrier, the Norfolk is not quarrelsome, is a sensitive dog, and can become stubborn without an under-standing owner. A natural ratter and spunky hunter, he displays courage so awesome that "honorable scars from fair wear and tear shall not count against" him in the show ring.
British sportsmen developed the breed around 1880, using the small red tykes favored by the Norfolk gypsies, and crossing these with Yorkshire, Cairn and small Irish stock. These sturdy red or black and tan ratting terriers were known to be congenial, fearless and uncommonly intelligent! The most serious genetic disease in Norfolk Terriers is a life threatening heart abnormality know as mitral valve disease (MVD).


text:
Home » Archive » Shared News » Taking Stock: Misbranding Case Doomed By Fed Error
Taking Stock: Misbranding Case Doomed By Fed Error
Wednesday, November 10, 2021 at 1:00 pm | Back to: Shared News
Updated: November 10, 2021 at 2:57 pm
Coady photo
By Sid Fernando
Expeditiously I be on my Grizzly
Feds try to creep me somehow always miss me
–Mr. Fantastik, from the MF DOOM song "Anti-Matter" on the King Geedorah album "Take Me To Your Leader"
If you're not hip to the slang in the lyrics above, Mr. Fantastik is essentially saying that the Feds are after him while he's on his grind, but they can't quite get him. There's an implication in there that the Feds are incompetent, but that's more evident from Mr. Fantastik's delivery.
Trainer Murray Rojas can probably relate to that sentiment now, after a Supreme Court decision was handed down in her favor last week on the Monday before the Breeders' Cup races. It didn't get much publicity in the racing press, perhaps because of the anticipation of the Breeders' Cup, but it should have, because the decision may have ramifications for horse racing-related misbranding cases working their way through the judicial system. Also, the larger issues of "federal overreach" addressed in an amicus brief filed in support of her petition are in the playbook of conservative federal judges, and some of them may hear cases challenging the constitutionality of HISA (the federal Horseracing Integrity and Safety Act, which was signed into law almost a year ago and is meant to oversee the sport at a federally mandated level but is being challenged by the attorneys general of several red states and the National Horsemen's Benevolent and Protective Association {NHBPA}).
A Penn National-based trainer, Rojas had been convicted on 14 felony charges by a jury in federal court on June 30, 2017, for misbranding drugs and conspiracy to misbrand in violation of the Federal Food, Drug, and Cosmetic Act (FDCA), relating to the administering of drugs to horses in her care within 24 hours of races. That act alone was against the rules of racing in Pennsylvania.
The FBI had led a sweeping law enforcement investigation of trainers and personnel at Penn National, and others were prosecuted as well by the U.S. Attorney's Office of the Middle District of Pennsylvania, but Rojas's case was the icing on the cake. On May 16, 2019, Rojas was sentenced to 27 months in prison and two years of supervised release, plus a fine of $5,000–the most severe sentence handed down in this roundup.
Rojas convinced the sentencing judge to grant bail while mounting an appeal, but the U.S. Court of Appeals for the Third Circuit, on January 11 of this year, affirmed the district court conviction and sentence. Things looked bleak for Rojas at that point.
Rojas, however, fired off a Hail Mary pass. On May 13, she filed a petition for a writ of certiorari, or a hearing in the Supreme Court. The highest court grants only about 1% of petitioners a hearing, but Rojas got two important briefs of support to get hers.
One was the aforementioned amicus brief filed on June 17 by the American Conservative Union Foundation (ACUF), which bills itself as an organization that "opposes the increasing application of federal law to matters that are more appropriately addressed by state and local authorities." ACUF, a nonprofit, is the fundraiser for the American Conservative Union (ACU), which hosts the Conservative Political Action Conference (CPAC).
Joining the ACUF on the brief was The Cato Institute, another organization advocating limited government.
Their brief essentially agreed with the Rojas petition that the lower courts in this case had blurred long-held distinctions in case law between the "dispensing" and "administering" of drugs. Rojas had been convicted by a jury that was instructed that both dispensing and administering amounted to the same thing, and this line of thought had been affirmed in the Third Circuit appeal that she'd lost. The dispensing or sale of drugs is federally regulated in interstate commerce in the FDCA, the brief noted, but the administering of drugs by a veterinarian or medical practitioner in the course of his practice is not. This is what Rojas, who wasn't dispensing drugs, had been arguing all along in fighting the federal charges against her, and it was the centerpiece of her petition.
The brief was a classic conservative treatise on federalism. It disparaged "the aggressive federal criminal prosecution…that historically has been left to state and local regulatory enforcement," because the alleged crimes that took place were infractions of state law. The Feds, however, had tried to pigeonhole them through a "liberal" reading of FDCA, according to the brief, to fit federal felony laws.
Believe it or not, the second brief supporting Rojas came from the respondent, The United States, in a filing Sept. 17 by the Acting Solicitor General, an Acting Assistant Attorney General, and two Deptartment of Justice attorneys. Perhaps they were convinced by some of the arguments in the ACUF and Cato Institute brief, because they also agreed that misbranding did not occur in this case and Rojas's conviction should be vacated. All said and done, it was a stunning defeat for the Feds, although their brief appears to be constructed in a narrow manner applicable only to this case–perhaps because of the larger Southern District of New York (SDNY) case of misbranding pending against trainer Jason Servis.
Rojas filed a reply Oct. 6 addressing some of these specific concerns, plus larger conservative issues of federalism and states' rights. On Nov. 1, the Supreme Court granted the petition, vacated the judgment against Rojas, and remanded the case "for further consideration in light of the confession of error by the Solicitor General."
Conservatives vs. Conservatives
Conservatives and libertarians came to Rojas's defense and flexed ideologies that resonated with a conservative court. Someone tweeted recently that racing is a right-wing industry, which may be going a bit too far, but it's probably safe to say that most of the stakeholders in the game are conservatives who would support concepts of federalism and states' rights, as well as vote for the same type of people advocated by organizations like ACUF and the Cato Institute. Yet two notable conservative factions, one led by The Jockey Club (TJC) and the other by the NHBPA, are on opposite sides of HISA, which brings federal heft into racing like never before.
This anomaly is essentially pitting racing people of the same overall political philosophy against each other at the same time as they're probably supporting the same people in political office or in the voting booths.
Both factions, for instance, likely would have supported Donald Trump's three appointments to the Supreme Court that have shifted it to the right.
It's only a matter of time before there's a collision between conservative principles of federalism and HISA. Those that support HISA are likely to end up at odds with high-powered and influential conservative intellectuals outside of racing like those that came to support the Rojas petition. And if a challenge to HISA were to get to the Supreme Court, opponents of it could possibly prevail. For instance, even before two of Trump's three appointees were on the Supreme Court, it ruled in its May 2018 decision that the Professional and Amateur Sports Protection Act (PASPA) was unconstitutional because the "anti-commandeering principle" of the 10th Amendment recognizes limitations of congressional authority over state governments, and there are parts to this that could possibly apply to HISA as well.
A few years ago, while writing in this space about one of the earlier versions of the bill that eventually became HISA, I wrote: "But if it did somehow become law, the constitutional challenges to it in court–certainly in the way it's now written–could set off another round of battles, and in the end, the industry would probably find itself exactly where it is now: battling itself."
More specifically, I should have warned that it would be a battle of conservatives versus conservatives, and that's something to think about, because mostly liberal lawmakers supported the passage of HISA–it was co-sponsored by 206 Democrats in the House versus 55 Republicans–and liberal and progressive-minded people are mostly the ones behind groups that generally don't support racing.
I'm going to end this with another verse from "Anti-Matter," this one from MF DOOM himself, because the last line is an apt warning:
Yeah, It's neither here nor there, black
Warfare in your ear, clack-clack-clack-clack-clack
What's that? You're hearing things! Tat-tat-tat-tat-tat
Be wearing your thinking hat
Sid Fernando is president and CEO of Werk Thoroughbred Consultants, Inc., originator of the Werk Nick Rating and eNicks.
This story was posted in Shared News and tagged HISA, legal battles, Murray Rojas, Sid Fernando, Taking Stock, U.S. Supreme Court.
Taking Stock: Courting Rituals of Breeders and Stud Farms
Flavien Prat Talks Flightline, SoCal Dominance On Writers' Room
NTRA Conference To Focus On Racing, Training and Event Surfaces
Wagering On U.S. Racing Highest Since 2009
Taking Stock: Varola, Hewitt Discuss Vaguely Noble & Caro