sql server – Extended event file of system integrity corrupted with error Not a valid Win32 FileTime file

We are collecting data for monitoring extended system health events and few SQL servers have started to fail with the error below.

The conversion failed when converting the date and / or time of a character string. [SQLSTATE 22007] (Error 241).  

When checked manually from SSMS, I can not open the package.0.event file to view the target data with the error below.

Not a valid Win32 FileTime. Parameter name: fileTime (mscorlib)

—————————— Program location:

to System.DateTime.FromFileTimeUtc (Int64 fileTime) to
Microsoft.SqlServer.XEvent.Linq.Internal.XEventInteropMetadataManager.MarshalEvent (XEEventBufferHeader *
data, XEEvent * eventType,
XE_ISerializedEvent *
parser, XEventInteropMetadataAdapter * pMetadata,
XEventInteropMetadataManager interopMetadata, EventLocator position)
at
Microsoft.SqlServer.XEvent.Linq.Internal.XEventInteropBufferProcessor.get_Current ()
at
Microsoft.SqlServer.XEvent.Linq.Internal.XEventEnumerator.MoveNext ()
on Microsoft.SqlServer.XEventStorage.XEStorage.SerializeData ()

What is the cause above and how can I solve this problem.

Note @ problem so far, I've seen on SQL2012 SP3 and nothing about 2014 and above

Un-hide event in private group

I am a member of a private group. Another member created an event for the group. Inadvertently, I clicked on "Hide Event" in the "Events" tab.

Back on the main group page, I can scroll through the screen until notification of the creation of the event and access the page of the event. I can even change my status to "Going". However, I can not unmask the event, and it will no longer appear in the group events tab. Is there a way to un-hide the event?

javascript – Modular and uncluttered JS programming for event management

disclaimer: "bad" is simply a way of saying that this is not the best way.

If we were in the early 2000s, it would probably be relatively clean code, but javascript has progressed a lot since then (current version: es6).

Take the time to check what's new.


Current best practice is to completely separate HTML / JS / CSS (unless you use view, react, angular)

  • Cleaner code
  • Logical separation
  • reusability
  • Easier to maintain

So, the following should not appear in your HTML code.

/// wrong
onclick = "double_increment ()"
/// well
const button = document.getElementById ("some_id");
button.addEventListener ("click", double_increment);

There is always a better alternative than
and it's not semantic

Do not use it.


const before let and let before var

Always declare your variables with const by default. If you agree with the changing variable, use let. Do not use var unless you know what you are doing and you really need it.

Note: pushan element in a table (declared with const) does not change the variable, but only the table. So no mistake.


Make do not hard code your html element identifier into your function.

Increment function (name, value) {
/// wrong
let mydiv = document.getElementById (& # 39; mydiv & # 39;);
}

You must either send it via the parameter or access it statically with the help of class

Class increment {
/// always bad
static target = "mydiv"
}

Object methods must do what their name infers.

Here, the increment function is supposed to increment the variable, but it does more than that.

  1. Gets the textual value of the span
  2. Analyze the value of the text
  3. Increases by one
  4. Update the user interface

(1) is hacky
(2) completely useless
(3) the thing that your function is supposed to do
(4) updates the user interface? not what your function says

/// wrong
that.increment = function () {
var i = parseInt (that.span.textContent) + 1;
that.span.innerHTML = i;
}
/// better
that.i = value;

// increments the value
that.increment = function () {
that.i ++;
}

// update the user interface
that.update = function () {
that.span.innerHTML = que.i;
}

// Method to call at the click of a button
that.handleOnClick = function () {
this.increment ();
that.update ();
}

A double_increment the function does not need to exist. Each incrementer must add an event listener at the click of the button.

/// wrong
double_increment function () {
incrementer1.increment ();
incrementer2.increment ();
}

See the following section add an event listener for the solution


es6 introduced class

The JavaScript classes, introduced in ECMAScript 2015, are mainly syntactic sugar compared to the existing legacy of JavaScript based on a prototype. The syntax of the class does not introduce a new object-oriented inheritance model in JavaScript.

So your incremental the function should be a class instead.

Class increment {

constructor (incrementId, options) {

const {
name = "N / A",
value = 0,
target
} = options;

this.name = name;
this.counter = value;
this.view = document.createElement ("span");

this.view.id = `#num _ $ {name}`

const button = document.getElementById (incrementId);
button.addEventListener ("click", () => this.handleOnClick ())

this.update ();

container const = document.getElementById (target);
container.appendChild (this.view);
}

handleOnClick () {
this.increment ();
this.update ();
}

increment () {
this.counter ++;
}

update() {
this.view.innerText = this.counter;
}
}

const incrementer1 = new Incrementer (
"increment",
{name: "Hello World", value: 3, target: "container"}
)

const incrementer2 = new Incrementer (
"increment",
{name: "Hello World", value: 0, target: "container"}
)
# container {
display: flex;
bending direction: row;
justify-content: uniformly space;
align-items: center;
background color: dark blue;
}

#container> span {
upholstery: 10px;
background color: light blue;
}


listview – The event does not work in kendomobilelist view

I am currently looking for expandmode in kendomobilelistview
because now I have to display the child record below the parent record.

Current result:

Please see point 1.1 is hide below point2

enter the description of the image here

Exact result:

enter the description of the image here

I think that kendomobilelistview does not resize after expanding the line.

Someone please help me about this

magento 1.9 – What is the good event to collect / update the order information after the success of the order?

I have seen several people use save_order_place_after, as good as checkout_onepage_controller_success_action. My problem is that I want to quickly analyze the information collected for this order and update the tables based on the information collected. I have tried these two events and I get the following results (with PayPal Onepage Checkout):

save_order_place_after:

  • Blank page loaded (PayPal payment verification page by URL)
  • Command interrupted (no success page)
  • The payment is sent to PayPal successfully
  • No order information is stored in the administration panel or the database.
  • The account then becomes cluttered with the error "duplicate bill" and can not place another order without receiving an error
  • An email is triggered and sent successfully since the Observer.php

checkout_onepage_controller_success_action:

  • The order is successful
  • Success page loaded
  • Nothing is executed from Observer.php

There is no syntax error in the Observer.phpbecause it works well with the first event but seems to interrupt the command one way or another.

Is there another event triggered after finalizing and saving an order so that I can analyze all the information collected on the order?

cqrs – How to Manage Domain Event Manager Commands

Context:

  • we have 2 defined contexts: Inventory and Sale
  • application context is the point-of-sale system

Scenario:

When an order is placed at Sale BC, we would like to decrease the quantity in stock.

Problem:

We have 2 managers in this problem who is interested in Check-out or AchatCréé Event:

  • The inventory manager who will decrease the amount of a product
  • The manager for a projection that creates a denormalized view.

In a synchronous environment such as PHP, I can set the correct order of Event listeners.

I would like to know how this is handled in an asynchronous environment?

I would appreciate that the answer is not technology specific, because in this case, many of us will benefit from the answer.

Why:

The Checkout event only contains (in the simplest form):

  • Transaction date
  • Product Information (ID, name, quantity purchased and current price).

The projection for the report shows the products purchased, the quantity remaining and the total sale.

The order of the event handler is important for the projection to be accurate. The unnormalized view contains data that does not appear in the Checkout event and that constitutes the "quantity in stock".

If the projection queries the inventory first, it can subtract the quantity in stock from the quantity purchased.

BUT

If the inventory manager comes first, it would be inaccurate to subtract the quantity in stock from the quantity purchased.

event observ – When I use "echo" in vendor methods – Products do not display, but work properly without this one.

I have the following code:

                public function getProductCollection ()
{
if (isset ($ this -> _ productCollections[$this->getCurrentCategory()->getId()])) {
$ collection = $ this -> _ productCollections[$this->getCurrentCategory()->getId()];
} other {
$ collection = $ this-> collectionProvider-> getCollection ($ this-> getCurrentCategory ());
$ this-> prepareProductCollection ($ collection);
$ this -> _ productCollections[$this->getCurrentCategory()->getId()] = $ collection;
}

echo "Number of collections". $ collection-> count ();

return $ collection;
}

When I tried to echo the number of collections – it is still equal to 0, but when I delete this string – everything is fine, the number is equal to 16. How?

Event after removing the Magento2 client

How to create a client event remove (by admin), what is the name of the event?
I need after deleting the client, delete the data on this client from my custom table

c ++ 11 – Event Management System in C ++

I have this question asked at home for an interview. I submitted my solution and I was not selected.
I wanted to know your comments on the solution.

Write a very simple event bus system in C ++. You can use any version with which you are comfortable.

For this system to work, you will need two functions. (How are they
grouped etc. is a challenge left to you)

  • A function that can take a
    Name of the event. For example, "email" and a function that can be executed
    later.

  • A function that can trigger all stored events. For example when we
    trigger the event "email" all events stored where we called the above
    the addition of a function would be invoked. in other words, in pseudo-code:
    add ("email", executeMe) then invoke ("email") I would wait execute me
    to be called once. however

    add ("email", executeMe)
    add ("email1", includingExecuteMe)
    add ("email", executeMe)
    invoke ("email")

I would wait
execute me to be called twice, while dontExecuteMe should not be called.
invoke ("email1") would obviously be the opposite. Once you have that
works, please extend the system to allow event functions to
a string argument. For example:

add ("email", executeMe)
invoke ("email", "our email to send");

When invoke is called executeMe must be called with "our email to be
As an argument, at the final stage, please extend the system to
allow events to be canceled. For example:

add ("email", executeMe)
add ("email", includingExecuteMe)
add ("email", includingExecuteMe2)
invoke ("email", "our email to send");

In this example, only execute me should be executed and it should cancel any
other events for "E-mail". All other subscribed events should not be
invoked.

The existing features we built should always work.
example, if execute me did not cancel the other events. It would also be
be a valid use of the same system.

add ("email", executeMe);
add ("email", executeMe2);
add ("email", executeMe3);
invoke ("email", "our email to be sent")

The three functions (execute me, executeMe2, executeMe3) should still
run. All API design, data structure choices are left to you. he
It must be assumed that this system will continue to need
added features.

  1. Use the Event class to define events
  2. class EventHandler is an abstract class that wraps the manager's methods.
  3. The ExecuteEventHandler class is inherited from EventHandler.
  4. EventManager gathers the event and the event handler and provides the following interface method

    a) Add (lock before adding) with a flag with default param
    whether the manager should be executed

    b) Invoke (locks before calling).

  5. added class utility to connect. The logging method written on the console.
  1. Set Event and EventHandler as objects instead of string and function pointers, respectively.
  2. Only clean up managers whose runtime indicator is disabled.
  3. Do nothing if Invoke is called with an unsaved event.
#understand 
#understand 
#understand 
#understand 
#understand 
#understand 
using namespace std;

class utility
{
public:
Static void log (const std :: string & message)
{
std :: cost << message << std::endl;
    }
};

class Event
{
    std::string name;
public:
    Event(const std::string& name) :name{ name }
    {
    }

    ~Event()
    {
    }
    const std::string& GetName() const
    {
        return name;
    }

    bool operator==(const Event & ev)
    {
        return this->name == ev.name;
}

};

EventHandler class
{
public:
Event Manager () {};
virtual ~ EventHandler () {};

virtual void Execute () = 0;
virtual void Execute (const std :: string & str) = 0;

};

ExecuteEventHandler class: public EventHandler
{
public:

ExecuteEventHandler (): EventHandler ()
{
}
~ ExecuteEventHandler ()
{
}
void Execute ()
{
std :: string msg = "ExecuteEventHandler :: execute called";
Utility :: Journal (msg);
}

void Execute (const std :: string & str)
{
if (str.size () == 0)
Execute ();
other
{
std :: string msg = "ExecuteEventHandler :: execute called with the argument:" + str;
Utility :: Journal (msg);
}
}

};
std :: mutex gMu;

EventManager class
{
std :: unordered_map <event *, std :: vector <std :: pair>> eventAndHandler;
void Remove (EventHandler * eh) {};

public:

Event Manager ()
{
}

~ EventManager ()
{
}

// Add an event with its corresponding event handler
// bool execute indicates whether the handler should be run
// If the event exists, it simply adds the event handler.
// else create a new entry

void Add (Event * ev, EventHandler * eh, bool execute = true)
{
std :: lock_guard lock (gMu);
// auto it = find_if (eventAndHandler.begin (), eventAndHandler.end (), [&](self & e)
// {
// return e.first.Name == ev.Name;
//});
auto it = eventAndHandler.begin ();
for (; it! = eventAndHandler.end (); ++ it)
{
if (* it-> first == * ev)
Pause;
}
std :: string msg;
if (it! = eventAndHandler.end ())
{
it-> second.push_back (std :: make_pair (eh, execute));
msg = "Adding an event handler to an existing event [" + it->first->GetName() + "]";
}
other
{
eventAndHandler[ev].push_back (std :: make_pair (eh, execute));
msg = "Adding a new event [" + ev->GetName() + "] with his event manager ";
}
Utility :: Journal (msg);
}

// Invoke event handlers for the given event.
// If the event is not recorded, do not do anything
// Also delete EventHanlders with execution disabled
void Invoke (Event * ev, const std :: string & arg = "")
{
std :: lock_guard lock (gMu);
auto it = eventAndHandler.begin ();
for (; it! = eventAndHandler.end (); ++ it)
{
if (it-> first == ev)
Pause;
}
std :: string msg;
if (it! = eventAndHandler.end ())
{
msg = "Running managers for the event [" + it->first->GetName() + "]: ";
Utility :: Journal (msg);
for (auto iteh = it-> second.begin (); iteh! = it-> second.end ();)
{
if ((* iteh) .second) // check if the handler should be executed :)
{
(* iteh) .first-> Execute (arg);
++ iteh;
}
other
{
iteh = it-> second.erase (iteh); // Remove the managers to run
msg = "Deleting a handler not running for the event [" + it->first->GetName() + "]: ";
Utility :: Journal (msg);
if (iteh == it-> second.end ())
Pause;
}
}
}
other
{
msg = "event [" + ev->GetName() + "] is not registered ";
Utility :: Journal (msg);
}
}

};

int main ()
{

EventManager evMgr;
Event evEmail {"email"}, evEmail2 {"email2"}, evEmail3 {"email3"};
ExecuteEventHandler execute, execute2, execute3, execute4;

ExecuteEventHandler whoseExecute, includingExecute2;

evMgr.Add (& evEmail, & execute);
evMgr.Add (& evEmail, & dontExecute, false); // false indicates not to execute the manager
evMgr.Add (& evEmail, & whoseExecute2, false);
evMgr.Add (& evEmail, & execute2);

// Summon an email without arguments
evMgr.Invoke (& evEmail);

// Summon an email with an argument
evMgr.Invoke (& evEmail, "this is email content");


evMgr.Add (& evEmail2, & execute4);
evMgr.Add (& evEmail2, & dontExecute2); // Register from whoseExecute2 with email2 and it will be executed

evMgr.Invoke (& evEmail2);

// Summon an unregistered event email3
evMgr.Invoke (& evEmail3);

}

Magento 2 | Is there an observable event for the start of payment?

when the checkout is started, I have to modify the quote.

Is there an event at checkout?

Thanks in advance!