// Initialize the device
431313
func (d *LSM303) setup() error {
	d.mu.RLock()
	if d.initialized {
		d.mu.RUnlock()
		return nil
	}
	d.mu.RUnlock()

	d.mu.Lock()
	defer d.mu.Unlock()

	if err := d.Bus.WriteByteToReg(magAddress, magConfigRegA, MagCRADefault); err != nil {
		return err
	}
	if err := d.Bus.WriteByteToReg(magAddress, magModeReg, MagMRDefault); err != nil {
		return err
	}

	d.initialized = true

	return nil
}
90984
func (provider *Provider) Initialize(initializer *ledger.Initializer) error {
	var err error
	configHistoryMgr := confighistory.NewMgr(initializer.DeployedChaincodeInfoProvider)
	collElgNotifier := &collElgNotifier{
		initializer.DeployedChaincodeInfoProvider,
		initializer.MembershipInfoProvider,
		make(map[string]collElgListener),
	}
	stateListeners := initializer.StateListeners
	stateListeners = append(stateListeners, collElgNotifier)
	stateListeners = append(stateListeners, configHistoryMgr)

	provider.initializer = initializer
	provider.configHistoryMgr = configHistoryMgr
	provider.stateListeners = stateListeners
	provider.collElgNotifier = collElgNotifier
	provider.bookkeepingProvider = bookkeeping.NewProvider()
	provider.vdbProvider, err = privacyenabledstate.NewCommonStorageDBProvider(provider.bookkeepingProvider, initializer.MetricsProvider, initializer.HealthCheckRegistry)
	if err != nil {
		return err
	}
	provider.stats = newStats(initializer.MetricsProvider)
	provider.recoverUnderConstructionLedger()
	return nil
}
1130174
func (processor *processor) Initialize() error {
	err := processor.Resource.CallFindOne(processor.Result, processor.MetaValues, processor.Context)
	processor.checkSkipLeft(err)
	return err
}
577283
func (eng *Engine) Initialize(conn net.Conn, handlers ...EventHandler) error {
	eng.inject = make(chan func())
	eng.conn = conn
	eng.connection = Connection{C.pn_connection()}
	eng.transport = Transport{C.pn_transport()}
	eng.collector = C.pn_collector()
	eng.handlers = handlers
	eng.running = make(chan struct{})
	eng.timer = time.NewTimer(0)
	eng.traceEvent = envBool("PN_TRACE_EVT")
	if eng.transport.IsNil() || eng.connection.IsNil() || eng.collector == nil {
		eng.free()
		return fmt.Errorf("proton.NewEngine cannot allocate")
	}
	C.pn_connection_collect(eng.connection.pn, eng.collector)
	return nil
}
282367
func (cnt *Connect) Initialize() (rets.Requester, error) {
	transport := wirelog.NewHTTPTransport()

	if cnt.WireLog != "" {
		wirelog.LogToFile(transport, cnt.WireLog, true, true)
		fmt.Println("wire logging enabled:", cnt.WireLog)
	}
	// should we throw an err here too?
	return rets.DefaultSession(
		cnt.Username,
		cnt.Password,
		cnt.UserAgent,
		cnt.UserAgentPw,
		cnt.Version,
		transport,
	)
}
842676
func (s *Discovery) Initialize(_ string, heartbeat time.Duration, _ time.Duration, _ map[string]string) error {
	s.heartbeat = heartbeat
	s.values = make([]string, 0)
	return nil
}
443394
func (d *DeviceMapperDriver) ensureInitialized() error {
	poolPath := d.poolDir()
	if err := os.MkdirAll(poolPath, 0755); err != nil && !os.IsExist(err) {
		return err
	}
	if err := volume.TouchFlagFile(poolPath); err != nil {
		return err
	}
	if d.DeviceSet == nil {
		var (
			thinPoolDev         string
			enableLVMMonitoring string
			dmoptions           []string
		)
		for _, option := range d.options {
			if strings.HasPrefix(option, "dm.") {
				dmoptions = append(dmoptions, option)
				if strings.HasPrefix(option, "dm.thinpooldev=") {
					thinPoolDev = strings.TrimPrefix(option, "dm.thinpooldev=")
					thinPoolDev = fmt.Sprintf("/dev/mapper/%s", strings.TrimPrefix(thinPoolDev, "/dev/mapper/"))
				}
			} else if strings.HasPrefix(option, "enablelvmmonitoring=") {
				enableLVMMonitoring = strings.TrimPrefix(option, "enablelvmmonitoring=")
			} else {
				glog.Errorf("Unable to parse option %s", option)
				return ErrInvalidOption
			}
		}
		dmoptions = append(dmoptions, "dm.fs=ext4")

		if err := d.verifyThinpoolDeviceUUID(thinPoolDev); err != nil {
			return err
		}

		deviceSet, err := devmapper.NewDeviceSet(poolPath, true, dmoptions, nil, nil)
		if err != nil {
			if _, thinError := err.(devmapper.ThinpoolInitError); thinError {
				//Try recreating the base image because sometimes something deletes it
				glog.Errorf("Error intializing thin pool device, %s, attempting to create to new base device", err)
				deviceSet, err = devmapper.NewDeviceSet(poolPath, false, d.options, nil, nil)
				if err != nil {
					return err
				}
				err = deviceSet.CreateBaseImage()
				if err != nil {
					return err
				}
			} else {
				return err
			}
		}

		d.DeviceSet = deviceSet
		if err := d.saveThinpoolDeviceUUID(thinPoolDev); err != nil {
			return err
		}
		prefix, err := GetDevicePrefix(poolPath)
		if err != nil {
			return err
		}
		d.DevicePrefix = prefix
		switch enableLVMMonitoring {
		case "y":
			if thinPoolDev != "" {
				glog.V(1).Infof("Enabling LVM Monitoring for thin pool device %s", thinPoolDev)
				cmd := exec.Command("lvchange", "--monitor", "y", thinPoolDev)
				output, err := cmd.CombinedOutput()
				if err != nil {
					glog.Errorf("Could not run command %v: %s (%s)", cmd, string(output), err)
					return err
				}
			} else {
				glog.Warningf("Ignoring option 'enablelvmmonitoring'; no thin pool device specified")
			}
		case "n", "":
			if thinPoolDev != "" {
				glog.V(1).Infof("Disabling LVM Monitoring for thin pool device %s", thinPoolDev)
				cmd := exec.Command("lvchange", "--monitor", "n", thinPoolDev)
				output, err := cmd.CombinedOutput()
				if err != nil {
					glog.Errorf("Could not run command %v: %s (%s)", cmd, string(output), err)
					return err
				}
			} else if enableLVMMonitoring != "" {
				glog.Warningf("Ignoring option 'enablelvmmonitoring'; no thin pool device specified")
			}
		default:
			glog.Errorf("Attribute %s is not defined for enablelvmmonitoring", enableLVMMonitoring)
			return ErrInvalidArg
		}
	}
	if err := os.MkdirAll(d.MetadataDir(), 0755); err != nil && !os.IsExist(err) {
		return err
	}
	return nil
}
1352475
func init() {
	r, err := rand.Int(rand.Reader, big.NewInt(math.MaxInt64))
	if err != nil {
		prand.Seed(time.Now().UnixNano())
	} else {
		prand.Seed(r.Int64())
	}
	globalNUID = &lockedNUID{NUID: New()}
	globalNUID.RandomizePrefix()
}
1276933
func (dp *LocalProvider) Initialize(fabPvdr contextAPI.Providers) error {
	dp.fabPvdr = fabPvdr.InfraProvider()
	return nil
}
525839
func (s *sample) Initialize(sim simra.Simraer) {
	s.simra = sim
	s.simra.SetDesiredScreenSize(config.ScreenWidth, config.ScreenHeight)

	// add global touch listener to catch touch end event
	s.simra.AddTouchListener(s)

	s.initialize()
	s.resetPosition()
	s.setupSprites()
	s.registerViews()
	s.registerModels()
	s.remainingLife = remainingLifeAtStart

	s.simra.AddCollisionListener(&s.ball, &s.obstacle[0], &s.models)
	s.simra.AddCollisionListener(&s.ball, &s.obstacle[1], &s.models)

	s.showReadyText()
	s.gamestate = readyToStart
}
853253
func (sc *SpriteContainer) Initialize(gl GLer) {
	simlog.FuncIn()
	sc.gl = gl
	GetTouchPeer().AddTouchListener(sc)
	simlog.FuncOut()
}
69529
func Init(dc driverapi.DriverCallback, config map[string]interface{}) error {
	c := driverapi.Capability{
		DataScope:         datastore.LocalScope,
		ConnectivityScope: datastore.LocalScope,
	}
	return dc.RegisterDriver(networkType, &driver{}, c)
}
1151967
func (d *driver) Init(ctx types.Context, config gofig.Config) error {
	d.config = config

	fields := map[string]interface{}{
		"provider":        vbox.Name,
		"moduleName":      vbox.Name,
		"endpoint":        d.endpoint(),
		"userName":        d.username(),
		"tls":             d.tls(),
		"volumePath":      d.volumePath(),
		"controllerName":  d.controllerName(),
		"machineNameOrId": d.machineNameID(""),
	}

	ctx.Info("initializing driver: ", fields)
	d.vbox = vboxc.New(d.username(), d.password(),
		d.endpoint(), d.tls(), d.controllerName())

	if err := d.vbox.Logon(); err != nil {
		return goof.WithFieldsE(fields,
			"error logging in", err)
	}

	ctx.WithFields(fields).Info("storage driver initialized")
	return nil
}
673684
func (i *PluginInitializer) Initialize(plugin admission.Interface) {
	if wants, ok := plugin.(WantsServiceResolver); ok {
		wants.SetServiceResolver(i.serviceResolver)
	}

	if wants, ok := plugin.(WantsAuthenticationInfoResolverWrapper); ok {
		if i.authenticationInfoResolverWrapper != nil {
			wants.SetAuthenticationInfoResolverWrapper(i.authenticationInfoResolverWrapper)
		}
	}
}
614094
func (conn *UDPConn) initialize() (*UDPConn, error) {
	if err := conn.udpConn.SetWriteBuffer(bufSize); err != nil {
		return nil, errors.Wrap(err, "setting write buffer size")
	}
	return conn, nil

}
1072579
func (a *CellView) Init() {
	a.once.Do(func() {
		a.port = NewViewPort(nil, 0, 0, 0, 0)
		a.style = tcell.StyleDefault
	})
}
413509
func Initialize(user, org string) error {
	if user == db.BLANK {
		org = db.BLANK
	}

	disabled := GetAllDefault(org)
	preferences := []interface{}{}

	for _, topic := range disabled {
		preference := db.Topic{
			User:         user,
			Organization: org,
			Ident:        topic.Ident,
			Channels:     topic.Channels,
		}

		preference.PrepareSave()
		preferences = append(preferences, preference)
	}

	if len(preferences) > 0 {
		err, _ := db.Conn.InsertMulti(db.TopicCollection, preferences...)
		return err
	}

	return nil
}