Searching We Love Privacy Club

Twts matching #failed
Sort by: Newest, Oldest, Most Relevant
In-reply-to » Progress! so i have moved into working on aggregates. Which are a grouping of events that replayed on an object set the current state of the object. I came up with this little bit of generic wonder.

(cont.)

Just to give some context on some of the components around the code structure.. I wrote this up around an earlier version of aggregate code. This generic bit simplifies things by removing the need of the Crud functions for each aggregate.

Domain Objects

A domain object can be used as an aggregate by adding the event.AggregateRoot struct and finish implementing event.Aggregate. The AggregateRoot implements logic for adding events after they are either Raised by a command or Appended by the eventstore Load or service ApplyFn methods. It also tracks the uncommitted events that are saved using the eventstore Save method.

type User struct {
  Identity string ```json:"identity"`

  CreatedAt time.Time

  event.AggregateRoot
}

// StreamID for the aggregate when stored or loaded from ES.
func (a *User) StreamID() string {
	return "user-" + a.Identity
}
// ApplyEvent to the aggregate state.
func (a *User) ApplyEvent(lis ...event.Event) {
	for _, e := range lis {
		switch e := e.(type) {
		case *UserCreated:
			a.Identity = e.Identity
			a.CreatedAt = e.EventMeta().CreatedDate
        /* ... */
		}
	}
}
Events

Events are applied to the aggregate. They are defined by adding the event.Meta and implementing the getter/setters for event.Event

type UserCreated struct {
	eventMeta event.Meta

	Identity string
}

func (c *UserCreated) EventMeta() (m event.Meta) {
	if c != nil {
		m = c.eventMeta
	}
	return m
}
func (c *UserCreated) SetEventMeta(m event.Meta) {
	if c != nil {
		c.eventMeta = m
	}
}
Reading Events from EventStore

With a domain object that implements the event.Aggregate the event store client can load events and apply them using the Load(ctx, agg) method.

// GetUser populates an user from event store.
func (rw *User) GetUser(ctx context.Context, userID string) (*domain.User, error) {
	user := &domain.User{Identity: userID}

	err := rw.es.Load(ctx, user)
	if err != nil {
		if err != nil {
			if errors.Is(err, eventstore.ErrStreamNotFound) {
				return user, ErrNotFound
			}
			return user, err
		}
		return nil, err
	}
	return user, err
}
OnX Commands

An OnX command will validate the state of the domain object can have the command performed on it. If it can be applied it raises the event using event.Raise() Otherwise it returns an error.

// OnCreate raises an UserCreated event to create the user.
// Note: The handler will check that the user does not already exsist.
func (a *User) OnCreate(identity string) error {
    event.Raise(a, &UserCreated{Identity: identity})
    return nil
}

// OnScored will attempt to score a task.
// If the task is not in a Created state it will fail.
func (a *Task) OnScored(taskID string, score int64, attributes Attributes) error {
	if a.State != TaskStateCreated {
		return fmt.Errorf("task expected created, got %s", a.State)
	}
	event.Raise(a, &TaskScored{TaskID: taskID, Attributes: attributes, Score: score})
	return nil
}
Crud Operations for OnX Commands

The following functions in the aggregate service can be used to perform creation and updating of aggregates. The Update function will ensure the aggregate exists, where the Create is intended for non-existent aggregates. These can probably be combined into one function.

// Create is used when the stream does not yet exist.
func (rw *User) Create(
  ctx context.Context,
  identity string,
  fn func(*domain.User) error,
) (*domain.User, error) {
	session, err := rw.GetUser(ctx, identity)
	if err != nil && !errors.Is(err, ErrNotFound) {
		return nil, err
	}

	if err = fn(session); err != nil {
		return nil, err
	}

	_, err = rw.es.Save(ctx, session)

	return session, err
}

// Update is used when the stream already exists.
func (rw *User) Update(
  ctx context.Context,
  identity string,
  fn func(*domain.User) error,
) (*domain.User, error) {
	session, err := rw.GetUser(ctx, identity)
	if err != nil {
		return nil, err
	}

	if err = fn(session); err != nil {
		return nil, err
	}

	_, err = rw.es.Save(ctx, session)
	return session, err
}

⤋ Read More
In-reply-to » I'm trying to switch from Konversation to irssi. Let's see how that goes. Any irssiers out there who can recommend specific settings or scripts? I already got myself trackbar.pl and nickcolor.pl as super-essentials. Also trying window_switcher.pl. Somehow my custom binds for Ctrl+1/2/3/etc. to switch to window 1/2/3/etc. doesn't do anything: { key = "^1"; id = "change_window"; data = "1"; } (I cannot use the default with Alt as this is handled by my window manager). Currently, I'm just cycling with Ctrl+N/P. Other things to solve in the near future:

@xuu@txt.sour.is At least for now I don’t need remote frontends, but who knows what the future brings. :-)

Is there any setting or script to render a line in the chat buffer to indicate the last read messages? I fail to find anything. For irssi it would be the trackbar.pl script. Also, the beep settings seem not to work for what ever reason. It’s just not sending a BEL to my terminal. Hm. :-(

⤋ Read More
In-reply-to » Yesterday, we had a heavy thunderstorm in the evening. At first it wasn't too bad, just thunder in the distance and then a few drops of rain for at most five minutes. That was it. Alright, I thought, it's over, let me call a mate and walk to the dairy farm. The heavy clouds looked awesome, a bit threatening but mostly harmless and just beautiful. We decided on a small detour to the home made ice cream vending machine and got ourselves some expensive, but very yummy pineapple/mint, yoghurt and raspberry/basil tubs. Mint was super strong, had to eat three spoons of some other flavors to actually taste it. A few spoons in and then the thunder rolled in from nowhere. So we quickly headed for the dairy farm while eating our ice creams. Half way there the sky floodgates opened and we took cover under a tree at the local playground. A minute later we decided to climb up the slide tower, because it had a proper roof. A tiny bit of hail cam down, but nothing serious.

@prologic@twtxt.net @movq@www.uninformativ.de Thanks mates! Yeah, lens flares rock. But especially for 24 I had several attempts to take one without any flares to more closely match the beautiful reality. I failed miserably. Still super cool shot, though.

⤋ Read More

‘See you next year’: China’s ‘King of gaokao’ fails to get marks for dream university after sitting the entrance exam for 26th time
A man in China who shot to fame after repeatedly sitting the country’s university entrance exam has failed to get the score he wanted for the 26th time — but plans to try again next year. ⌘ Read more

⤋ Read More

Erlang Solutions: Contract Programming an Elixir approach – Part 1
This series explores the concepts found in Contract Programming and adapts them to the Elixir language. Erlang and BEAM languages, in general, are surrounded by philosophies like “fail fast”, “defensive programming”, and “offensive programming”, and contract programming can be a nice addition. The series is also available on Github.

You will find a lot … ⌘ Read more

⤋ Read More

Former Hong Kong leader CY Leung says American Express apologised to wife Regina after suing her over allegedly unpaid HK$93,155 credit card bill
American Express International claimed Regina Leung Tong Ching-yee had ‘refused, failed or otherwise neglected’ to settle an outstanding bill of HK$93,155 as of April 28. ⌘ Read more

⤋ Read More

**“This decision is not only a hollow response to Covid-19, but it sends the message that intellectual property rights outweigh the rights to health and life.”

https://www.amnesty.org/en/latest/news/2022/06/covid-19-wto-ministerial-decision-on-trips-agreement-fails-to-set-rules-that-could-save-lives/**
“This decision is not only a hollow response to Covid-19, but it sends the message that intellectual property rights outweigh the rights to health and life.”

[amnesty.org/en/latest/news/2…](https://www.amnesty. … ⌘ Read more

⤋ Read More

Australia’s China bias and colonial blinkers mean it fails to see big picture for Pacific islands’ development
Canberra had chosen symbolic gestures and feeble investments over more practical initiatives now being offered by Beijing to Pacific island nations. Australia must shed its colonial mindset and stop claiming to always have the moral high ground over China. ⌘ Read more

⤋ Read More

There are some Gemini feeds that Antenna is failing to connect to, and it looks like it’s clogging up the log pretty badly. I hope it’s not putting too much strain on the server.

⤋ Read More

Erlang Solutions: 5 Key Tech Priorities for Fintech Leaders in 2022
Issues caused by sub-optimal tech choices are commonplace in the industry, leading to companies failing under unexpected stress or being unable to adapt in time when their business requirements change.

While no two projects are the same, we’ve observed some common themes for using scalable futureproof technologies to build diverse fintech systems. Taking advantage of these learnings sets financial service provi … ⌘ Read more

⤋ Read More

PEP 685: Comparison of extra names for optional distribution dependencies
This PEP specifies how to normalize distribution _extra_
names when performing comparisons.
This prevents tools from either failing to find an extra name or
accidentally matching against an unexpected name. ⌘ Read more

⤋ Read More

Local man switches to Arch, tells no one
Yesterday, at approximately 5:05pm, a Seattle area man installed Arch Linux on his home computer and has yet to tell anyone. “This appears to be the first occurrence of failing to tell someone that you run Arch,” stated a representative of the Seattle Sheriff’s Department. “We are actively investigating whether or not this is a crime. It definitely is a violation of norms.” ⌘ Read more

⤋ Read More

In reply to: Sable: Kotaku Review, My Top Game of 2021

Sable’s world is not a broken machine, it’s doing fine. You’re not on some grand quest to save it, or return the planet to its former glory. You’re just a girl growing up in this place, and growing up means choosing a new mask.

Closing,

Sable imagines identity and growth as playful, joyous, and nearly impossible to fail. It promises you that chang … ⌘ Read more

⤋ Read More

Q1K3 – Making Of
This was my third time participating in the js13kGames contest. I won in 2018 with Underrun and utterly failed to deliver any compelling gameplay with my 2019 entry Voidcall.

This year’s theme was “Space” – I chose to completely ignore it and instead decided to pay tribute to one of my all time favorite games on its 25th birthday:

The original Quake from 1996.

Image

_ … ⌘ Read more

⤋ Read More

Humanity is a failed alien terraforming op: Usually newly uplifted civilizations, with very little intervention after the initial seeding, reliably consume all the surface fuel and turn the place into a nice cool desert, and what’s left can be psionically reprogrammed

⤋ Read More

vat brains often philosophize over whether they’re actually brains in bodies but usually dismiss it as absurd, why should for example someone go the trouble of engineering the human body and all the world around it as opposed to vats, it just totally fails occam’s razor

⤋ Read More