// PgXlogLocationDiff calls the stored procedure 'pg_catalog.pg_xlog_location_diff(pg_lsn, pg_lsn) numeric' on db.
196552
func PgXlogLocationDiff(db XODB, v0 pgtypes.PgLsn, v1 pgtypes.PgLsn) (float64, error) {
	var err error

	// sql query
	const sqlstr = `SELECT pg_catalog.pg_xlog_location_diff($1, $2)`

	// run query
	var ret float64
	XOLog(sqlstr, v0, v1)
	err = db.QueryRow(sqlstr, v0, v1).Scan(&ret)
	if err != nil {
		return 0.0, err
	}

	return ret, nil
}
401680
func (ellipsoid Ellipsoid) Location(lat1, lon1, x, y float64) (lat, lon float64) {
	degreesPerRadian := 180.0 / math.Pi

	range1 := math.Sqrt(x*x + y*y)
	bearing1 := math.Atan2(x, y)

	if ellipsoid.Units == Degrees {
		bearing1 *= degreesPerRadian
	}

	return ellipsoid.At(lat1, lon1, range1, bearing1)
}
60185
func parseXlog(x xlog.Position) (pos int64, err error) {
	if x == "" {
		return 0, nil
	}
	pos, err = strconv.ParseInt(string(x), 10, 64)
	if err != nil {
		return 0, err
	}

	return pos, err
}
365887
func printDiff(oldResources, newResources map[schema.GroupVersionResource]struct{}) string {
	removed := sets.NewString()
	for oldResource := range oldResources {
		if _, ok := newResources[oldResource]; !ok {
			removed.Insert(fmt.Sprintf("%+v", oldResource))
		}
	}
	added := sets.NewString()
	for newResource := range newResources {
		if _, ok := oldResources[newResource]; !ok {
			added.Insert(fmt.Sprintf("%+v", newResource))
		}
	}
	return fmt.Sprintf("added: %v, removed: %v", added.List(), removed.List())
}
1182183
func (d *failureDetail) Location() (string, int, string) {
	return d.fileName, d.lineNumber, d.funcName
}
1211022
func DialWithLocation(location *time.Location) DialOption {
	return DialOption{func(do *dialOptions) {
		do.location = location
	}}
}
275304
func NewGetNodeForLocationArgs(x int, y int) *GetNodeForLocationArgs {
	args := new(GetNodeForLocationArgs)
	args.X = x
	args.Y = y
	return args
}
483363
func intSliceDiff(x, y []int) []int {
	var out []int

	for _, cX := range x {
		found := false
		for _, cY := range y {
			if cX == cY {
				found = true
				break
			}
		}
		if !found {
			out = append(out, cX)
		}
	}

	for _, cY := range y {
		found := false
		for _, cX := range x {
			if cY == cX {
				found = true
				break
			}
		}
		if !found {
			out = append(out, cY)
		}
	}

	return out
}
1122050
func LocationBlock(args ...interface{}) []byte {
	var buf bytes.Buffer
	for _, arg := range args {
		switch x := arg.(type) {
		case op.Opcode:
			buf.WriteByte(byte(x))
		case int:
			util.EncodeSLEB128(&buf, int64(x))
		case uint:
			util.EncodeULEB128(&buf, uint64(x))
		default:
			panic("unsupported value type")
		}
	}
	return buf.Bytes()
}
712131
func (u *User) GetLocation() string {
	if u == nil || u.Location == nil {
		return ""
	}
	return *u.Location
}
866332
func CParseInStringLocation(layout, value, timezone string) (Arrow, error) {
	if location, err := time.LoadLocation(timezone); err == nil {
		return CParseInLocation(layout, value, location)
	} else {
		return New(time.Time{}), err
	}
}
5055
func GetLocation() (string, string) {
	panicBrowserDetect()
	loc := js.Global.Get("location")
	path := loc.Get("pathname").String()
	hash := loc.Get("hash").String()
	return path, hash
}
390070
func (a *Account) ChangeLocation(gatewayID string, latitude, longitude float64) error {
	return a.EditGateway(gatewayID, GatewayEdits{
		AntennaLocation: &Location{
			Longitude: longitude,
			Latitude:  latitude,
		},
	})
}
697173
func (s *S3LogsConfig) SetLocation(v string) *S3LogsConfig {
	s.Location = &v
	return s
}
1042469
func (self *RawDispatcher) location(name string, isUdid bool, i interface{}) string {
	//we should have already checked that this object is a pointer to a struct with an Id field
	//in the "right place" and "right type"
	result := self.Prefix + "/" + name

	p := reflect.ValueOf(i)
	if p.Kind() != reflect.Ptr {
		panic("unexpected kind for p")
	}
	e := p.Elem()
	if e.Kind() != reflect.Struct {
		panic("unexpected kind for e")
	}
	if !isUdid {
		f := e.FieldByName("Id")
		id := f.Int()
		return fmt.Sprintf("%s/%d", result, id)
	}
	f := e.FieldByName("Udid")
	id := f.String()
	return fmt.Sprintf("%s/%s", result, id)
}
938662
func (h *HereError) Location() string {
	lastSlash := strings.LastIndex(h.loc, "/")
	secondLastSlash := strings.LastIndex(h.loc[:lastSlash], "/")

	return h.loc[secondLastSlash+1:]
}
1045970
func (c *locationCache) getLocation(offset int) *time.Location {
	c.lock.Lock()
	defer c.lock.Unlock()

	location, ok := c.cache[offset]
	if !ok {
		location = time.FixedZone("", offset)
		c.cache[offset] = location
	}

	return location
}