centos – PHP MongoDB extension doesn’t work

I install MongoDB on Centos8, And I try to install the MongoDB extension, But when I add `extension=mongodb.so` to the `php.ini` file and run `php-m command` I get this error:

``````PHP Warning:  Cannot load module 'mongodb' because required module 'json' is not loaded in Unknown on line 0
``````

and in phpinfo MongoDB extension doesn’t add.

spells – Exactly how does a Storm of Blades work?

spells – Exactly how does a Storm of Blades work? – Role-playing Games Stack Exchange

c# – Unit Of Work with multiple database context

It is unclear what your motive is for using two contexts, and if/how you expect these to behave in conjunction with one another. The solutions are fairly straightforward, but which solution would apply to your case is not clear. So I’ve tried to address your possible concerns here.

1. When the update to main context fails, should the update to the secondary context automatically fail? And vice versa?

If that is the case, then you need these contexts to work under a shared transaction scope. In the comments, Ewan already provided you with a link that showcases how to do this.

1. Do the entities that are in both contexts always have the same structure? If one changes, will the other need to be changed the same way?

Because if that is not the case, then you should not be reusing the same entity classes for these two contexts. Just because two things are currently the same doesn’t mean that they invariably always will be.

And when they won’t, then they should be separated from the get go. You’re really going to regret having to separate them after you’ve developed your codebase.

1. Are both contexts assumed to be up to date with one another?

In your example, do you need to actively account for the possibility of finding an entity in one context and not finding it in the other? Because your code currently blindly assumes that you’re going to find both. Unless you have a very good (and so far unmentioned) reason to rely on that, this seems like a bad approach.

1. Do both contexts have the exact same entity tables? Will this always be the case?

If you’ve answered “yes” to both questions 2 and 4, then you can abstract a reusable interface that both contexts implement, which I’ll call `IBaseContext` for now.

``````public interface IBaseContext
{
DbSet<Product> Products { get; set; }

int SaveChanges();
}
``````

Note: this interface can contain `SaveChanges`, which will “happen” to match the method from `DbContext`. The compiler allows this, as long as all implementations of `IBaseContext` have such a `int SaveChanges()` available. Regardless of whether they inherit it from `DbContext` or have defined it for themselves.

This opens the door to reusably using your db contexts. This is very relevant for your question:

What if the databases are more than 2 ?

When the contexts have a reusable interface, that means you can write reusable logic that can handle any context that implements this reusable interface.

This means you could, for example, opt for a generic unit of work:

``````public interface IUnitOfWork : IDisposable
{
IProductsRepository ProductsRepository { get; }
int Complete();
}

public class UnitOfWork<TContext> : IUnitOfWork where TContext : IBaseContext
{
public UnitOfWork(TContext context, IProductsRepository productsRepository)
{
_context = context;

ProductsRepository = productsRepository;
ProductsRepository.Context = context;
}

private TContext _context;

public IProductsRepository ProductsRepository { get; private set; }

public int Complete()
{
return _context.SaveChanges();
}
}
``````

This unit of work will work for any implementation of `IBaseContext`, provided that the context has been registered in your service provider.

Note that this slightly complicates the repository DI logic. You can’t rely on DI by itself to figure out which context you want to inject when. But you can change your repositories to allow their context being set after the fact by their unit of work.

There are other ways of doing the same thing, that may be cleaner in your opinion, but it will get incrementally more complicated depending on how clean you want it. I just used the easiest to read example here.

If you cannot create a reusable interface on your context types, then what you’re currently doing is what you’re going to have to do. When you can’t do it reusably, you have to write each case manually.

How does looting treasures worth legend points work?

How does looting treasures worth legend points work? – Role-playing Games Stack Exchange

exploit – ctf kernel challenges does not work

I’m trying to learn and solve some ‘kernel related’ ctf challenges (reading writups to try to run same environment and achieve root using one of the kernel-pwn technique…).

I’m using Ubuntu 20 VM and (for example) this challenge:

Unfortunately only results I can see (no matter if I’m trying to solve mentioned challenge or any other) is (similar to the one) presented below:

``````input: ImExPS/2 Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input3
``````

mount: mounting devpts on /dev/pts failed: No such file or directory
random: fast init done
flux_baby says hi there!
flux_baby opened

1. Call
2. Show me my uid
4. Any hintz?
5. Bye!

1
I need a kernel address to call. Be careful, though or we will crash horribly…

18446744071579168336
There is a good chance we will want to pass an argument. Which one is it?

0
Got call address: 0xffffffff8104ee50, argument: 0x0000000000000000
flux_baby ioctl nr 900 called
flux_baby ioctl nr 900 called
flux_baby ioctl extracted param ffffffff8104ee50 as function ptr, calling it
A miracle happened. We came back without crashing! I even got a return value for you…
It is: ffff88000212ca80

1. Call
2. Show me my uid
4. Any hintz?
5. Bye!

1
I need a kernel address to call. Be careful, though or we will crash horribly…

18446612132349004608
There is a good chance we will want to pass an argument. Which one is it?

18446612132349004608
Got call address: 0xffff88000212cb40, argument: 0xffff88000212cb40
flux_baby ioctl nr 900 called
flux_baby ioctl nr 900 called
flux_baby ioctl extracted param ffff88000212cb40 as function ptr, calling it
kernel tried to execute NX-protected page – exploit attempt? (uid: 1000)
BUG: unable to handle kernel paging request at ffff88000212cb40
PGD 1b34067 P4D 1b34067 PUD 1b35067 PMD 21fd063 PTE 800000000212c163
Oops: 0011 (#1) PREEMPT NOPTI
CPU: 0 PID: 58 Comm: client_kernel_b Tainted: G O 4.18.0 #11
RIP: 0010:0xffff88000212cb40
Code: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
RSP: 0018:ffffc900000b3e00 EFLAGS: 00000246
RAX: 000000000000004c RBX: 0000000000000384 RCX: 0000000000000001
RDX: 0000000000000000 RSI: 00000000000000e4 RDI: ffff88000212cb40
RBP: ffffc900000b3e30 R08: ffffffff811b1ca0 R09: 00000000000000e4
FS: 000000000205a880(0000) GS:ffffffff81a35000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffff88000212cb40 CR3: 00000000021c8000 CR4: 00000000000006b0
Call Trace:
? 0xffffffffa0000040
0xffffffffa0000116
0xffffffff810db790
? 0xffffffff811220f7
? 0xffffffff810148b2
0xffffffff810dbd3c
0xffffffff810dbd95
0xffffffff81001134
0xffffffff81400075
RIP: 0033:0x000000000043f1eb
Code: 0f 97 c0 84 c0 75 af 48 8d 3c 2b e8 df dd 02 00 85 c0 78 b0 48 83 c4 08 48 89 d8 5b 5d c3 90 f3 0f
RAX: ffffffffffffffda RBX: 0000000000400488 RCX: 000000000043f1eb
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000402e80
R13: 0000000000000000 R14: 00000000004c1018 R15: 0000000000000000
CR2: ffff88000212cb40
—( end trace 960bcbc99b521658 )—
RIP: 0010:0xffff88000212cb40
Code: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
RSP: 0018:ffffc900000b3e00 EFLAGS: 00000246
RAX: 000000000000004c RBX: 0000000000000384 RCX: 0000000000000001
RDX: 0000000000000000 RSI: 00000000000000e4 RDI: ffff88000212cb40
RBP: ffffc900000b3e30 R08: ffffffff811b1ca0 R09: 00000000000000e4
FS: 000000000205a880(0000) GS:ffffffff81a35000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffff88000212cb40 CR3: 00000000021c8000 CR4: 00000000000006b0
flux_baby closed
Killed
ACPI: Preparing to enter system sleep state S5
reboot: Power down
acpi_power_off called
root@u20:/home/c/kernelz/baby_kernel_3460960b6fc99f8a90fba7397b5e4c46/public#

(In case you’d say “dude try the value(s) for your OS” – like I said, any kernel-related challenge will present ‘the same’ results, means: exploitation is killed (and I don’t know why)).

Thank you for all the hints.

i had upgraded magento 1.9 to magento 2.4 but it did not work properly so i decided to get back but when i restored it i can see this problem

error log
[14-Apr-2021 15:18:01 Australia/Sydney] PHP Fatal error: Uncaught Error: Class ‘MagentoFrameworkAppErrorHandler’ not found in /home/martarab/public_html/bin/magento:20
Stack trace:
#0 {main}
thrown in /home/martarab/public_html/bin/magento on line 20

Keyboard number keys don’t work except for 5 6

Nothing happened at all it worked last time. I go on my computer and first my keys A D and K stopped working. I fixed it then my numbers stopped working and 5 6 only worked if you know how to fix this PLEASE help.

canon – Auto focus won’t work in viewfinder on Aperture priority mode

My camera (Canon Rebel t7i) won’t auto focus in manual or aperture priority mode in viewfinder. (It works perfectly in liveview)

Maybe it’s important to say that I’ve never shot in manual mode so I wanted to learn how to shoot in Aperture Priority mode. Auto focus isn’t working in viewfinder though. I used 2 different lenses (canon 50 mm 1.8 and the kit lens) It doesn’t work on both. I tried resetting the camera. Still nothing.

It does work in auto mode in the viewfinder.

Am I doing something wrong or is something broken?

My timer wont work in unity

My timer wont work in unity – Game Development Stack Exchange