Algorithm design: Internet data sessions are randomly started on a mobile node

Internet data sessions are randomly started on a mobile node.
Let S1, S2,…, Sn be the arrival/starting times of the data sessions on the mobile node.
The starting times of the sessions are sorted in an ascending order.
Let E1, E2,…, En be the ending times of the sessions.
The ending times do not follow any order. Each session can be of any random duration. The mobile node stays in a cell for a random duration of time before moving to another cell.
Let H1, H2,…, Hm be the handover (leaving one cell to join another cell) times of the mobile node. The handover times are sorted in an ascending order.
Assume that Sn < Hm.
As an example, let’s suppose that the mobile node starts three sessions during its stay in cell C1. The mobile node then moves
to another cell C2. Let’s suppose that 2 out of the 3 sessions are still alive at the handover time (time of leaving C1 to join C2).
For the still alive sessions, a tunnel is established between cell C1 and the cell where the mobile node is currently present. The
tunnel is removed as soon as all the alive sessions (which were started in C1) are terminated. Assume that the mobile node
never moves to an already visited cell.
You are required to write the most efficient algorithm (in pseudocode form) to calculate the average tunnel time. The average
tunnel time can be calculated by adding the times of all tunnels and then dividing the total time by the total number of tunnels
which are created. The time complexity of your algorithm must not be more than O(n+m).

8 – users randomly being created when clearing all error messages on user registration which also causes EntityStorageException

This error came up because I was trying to fix an issue related to user registration. Right now I have an issue with users creating their account. Users create their account by filling out the user registration form and then an email gets sent to that email address. The email will have a link that makes the user completes their account. I was getting this error message that says an email is already taken, when it actually isn’t. I tried fixing the root of the problem (why was that error message getting set in the first place), then I gave up and tried a hackish way to do it (I know, bad). The hackish way is clearing that email already taken error message and resetting the error message in my .module file, if I have too. To be honest, I did not get far with this solution. Anyways, I tried clearing all the error messages by doing $form_state->clearErrors(). But by doing this, something weird happened…A whole bunch of users were created. I logged into the admin account to view the people and this is what I saw:

enter image description here

There’s a lot too. For some reason <email_address_I_put_in>_1_2… gets created and continues until I get that sql expection becuase the name is too big. To be clear, the accounts will be created consecutively. ie <email_address_I_put_in>_1 then <email_address_I_put_in>_1_2 and so on.
This is the exception that get triggered.

DrupalCoreEntityEntityStorageException: SQLSTATE(22001): String data, right truncated: 1406 Data too long for column 'name' at row 1: UPDATE {users_field_data} SET name=:db_update_placeholder_0 WHERE uid = :db_condition_placeholder_0; Array ( (:db_update_placeholder_0) => jasperhsggfghf_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19 (:db_condition_placeholder_0) => 315 ) in DrupalCoreEntitySqlSqlContentEntityStorage->save() (line 846 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

networking – Marvell tech grp 88w8897 avastar wifi on surface pro shutting down randomly 20.04

Im using a surface pro with built in Marvell tech group 88W8897 [AVASTAR] wifi built in, running Ubuntu 20.04. The wifi radio keeps shutting down randomly or the system just stops talking to it. Im not sure which is happening, but it will randomly go into airplane mode and cant find the wifi radio. I have to then shut down and restart the computer to get it back. This is happening 8-10 times a day at least. I have searched this site and everywhere else I can find to get an answer for this. So far, nothing has worked. I even completely wiped ubuntu and reinstalled. No additional drivers can be found as well. Has anyone found a fix for this issue that actually works? At this point I’m looking at getting an external wifi adapter to see if that will fix this issue. This happens on different networks as well. Thanks in advance.

amd graphics – Ubuntu 20.10 on mac: Mouse cursor disappears randomly

The mouse cursor disappears after a while. It happens randomly with any software (Chrome, Skype, terminal, LibreOffice etc…). The mouse still works though.It just the cursor which disappears.
I cannot find a pattern why it disappears or what makes it disappear. The only fix is to reboot (logout does not work).
It works for a while after the reboot, then it disappears again.
It only disappears when I move the mouse which makes me thing it could a be GPU driver bug (the screen is not redrawn correctly). I could be wrong obviously.

I’ve tried standard login and Wayland. It happens with both. I guess it’s related to the hardware as I tried the same Ubuntu version on a different computer with an Intel GPU and it does not occur on it.

Only Ubuntu is installed on the drive (macOS is not). Ubuntu detects the GPU as Rv730.

Is there a way I can bring the cursor back without rebooting?

Configurable Product Options Randomly Empty in Frontend

On Magento 2.3.6-p1 we have an issue where customers cannot select a product’s options because the options list is empty.

This is very inconsistent since different products with the same option attribute sometimes show the options list and sometimes don’t.

Here is an example for an empty options list:
Product woth empty options list

This is a working options list for the exact same options attribute:
Working options dropdown list

Both products are identical besides the pictures and names.

It seems that just very seldomly options are shown for a product when most of the time it does not work; the reason for this is not known to me.

The problem exists since we upgraded from Magento 2.3.0 to 2.3.6-p1.

This issue has a heavy impact since most products sare sold as configurable products which customers are currently unable to buy. (My wife is killing me!)

Besides obvious hints like clearing caches, reindexing or making sure the products are in stock I found neither a solution nor any direction to look for to solve the problem. The server logs show no irregularities, the Magento cron job is running fine.

Any help is appreciated!

Edit: I was told that this issue already sometimes happened on Magento 2.3.0 but not as often.

python – Which is the best data structure to use when you want to randomly pick elements & use them, but also delete them after use

I have 1000 lines in a text file. I want to read them into some data structure(DS).

After reading them, I will be randomly picking 50 lines from the DS (using a Random Number Generator). Next time 50 more & 50 more the time after that. Each time I use 50 lines from the DS, I want to delete them from the DS. So after the first iteration, I will have 950 items, after the second iteration, I will have 900 & so on.

So 3 operations

  1. Read from file & insert lines into the DS
  2. Random access from the DS
  3. Delete members from the DS in a random manner.

Consider both these requirements, which would be the best DS to use?

FWIW, I will be coding this in python.

Probability of a point randomly chosen in a circle is nearest to the center

I’ve been having some trouble thinking about this problem for a couple days, but everything I’ve done has been useless, can you guys help me?

Inside of a circle of radius A>0, N points are chosen randomly and independently. What is the probability that the distance between the point closest to the center of the circle and the center of the circle itself is at least B>0?

Thank you!

black screen of death – Thomson TV Blackscreens randomly

I have a 3 year old Thomson TV which I use as a second screen for my pc. It’s the Thomson 55UC6326.

Here’s the problem:

The TV randomly shows a blackscreen after working for many hours perfectly. Once this happened, i am only able to turn it on for some seconds after it blackscreens again.

I guess it’s not the power supply because the TV is still on when it happens (when I switch the input blindly while with the remote when the TV is black, it’s still changed after restart).

After pressing the power button twice, the TV starts again and works again for some seconds.

The only pattern i recognized is that it works longer when it’s not detecting any input. When the “no input” message is shown, it stays on several minutes (sometimes it shuts down anyway) but when switching to an input, it shuts down instantly after showing an image for about half a second. This also happens when in a full-screen settings mode.

I am not an expert but I opened the TV and didn’t see any clear damages on any electric component. Also, I installed the latest software update “MS586T02-LF1V231”. I’m getting pretty desperate with this case!

Ubuntu Server 20.04 LTS hangs randomly

I’m struggling to find the reason why my Ubuntu server hangs/crashes.

I have installed a barebone Ubuntu Server 20.04 LTS on my old computer to try and use it as a personal server to host some projects of mine.

My issue is after a few hours, sometimes as low as 2 to 3 hours or as long as 8 to 12, my server will eventually hang.

I get a visual output, but it is completely unresponsive to either keyboard, mouse or ssh. Sometimes it will log CPU #X stuck for Xs! but never seems to be coming from the same place. Sometimes kworkers, sometimes md-udev, sometimes systemd-networkd.
Other times I get just no visual output at all and just have to force a reboot.

So currently running on my server are:

  • UFW
  • OpenVPN
  • Cockpit
  • Portainer
  • Docker container with nginx reverse proxy
  • Let’s encrypt docker container
  • 2 Nextcloud docker containers
  • around 5 other docker containers running small apps/web apps

What’s puzzling me the most is I get not logs at all, I’ve checked my kernel and system logs and usually the last line is an unrelated UFW block command of some spammer ip address but nothing more substantial. I’ve also tried looking at /var/crash but same thing, either empty or the log of my reboot.

I’ve looked around this website and people usually seem to indicate this might be a hardware issue but I’ve never had an issue running this system overnight on Windows 10 when it was my main setup.

What I’ve tried:

  • Multiple clean reinstall of Ubuntu Server 20.04
  • Updated my BIOS and removed any overclock I might have applied
  • Checked my temperatures and system load, both OK
  • Checked my RAM with Memtest86 for 3×4 runs, totalling over 12 hours and got no errors

My system specifications are:

Ryzen 1700 @stock
16 GB CORSAIR GDDR4 @2133MHz but rated for 3200Mhz
Gigabyte GTX 1080
Samsung 960 EVO 512GB nVme SSD 
650W corsair power supply
Plenty of cooling

If any of you has any lead or advice on how to diagnose my setup, or some more steps I could try I would be grateful.

Thanks for your help