Game mechanics – manage weapon special equipment upgrades (buff, steal, fire service, slow enemies, etc.)

I intend to develop a role play and have problems with the calculation of the weapon damage.

I would like to be able to apply modifiers to swords, such as looting, damage increase, fire damage over time, slowing enemies, increasing attack speed, and so on.

I can not find a way to apply these modifiers when calling the "hit" method.

At the moment, I'm managing it with a "GearType" switch and do different things with the enemies at that point, but it does not really follow the object-oriented logic. I would prefer something more scalable, where I could easily add new buff / debuff.

If you have any tips or experience, it will be appreciated.

boot – Slow boot in Ubuntu 19.04 with full disk encryption

I have a 960 GB SSD (Kingston A400) installed on my laptop (Asus X505BA). I installed Ubuntu 19.04 with full disk encryption. I also enabled Fastboot and SecureBoot in the UEFI settings. My problem is that the system key is very slow at boot time. It usually takes 4 to 5 minutes, which is too much compared to the startup time I used to have with an unencrypted hard drive in the same laptop (usually 1 minute or less).

What can I do to improve this?

SQL Server – Slow query in production, wrong execution plan or wrong index?

I just fixed a production issue by deleting and rebuilding an index.
I suspect that deleting the index also cleared execution plans that used it, and one of them happens to be bad.

Arguments for a bad execution plan:

  • Before I deleted the index, I looked up the last update date for the statistics in the given table and they were up to date.
  • My database administrator has set up the solution for the index and statistics management of Hallengren
  • The slow query was a SELECT statement that was executed by sp_executesql with date parameters. Execute the same select statement without sp_executesql was fast, but did not use the same execution plan.

Arguments against a bad execution plan:

  • Before we dropped the index, we got really wild and ran the forbidden dbcc freeproccache to delete a bad plan, but this has not resolved or changed the performance issue.

Note:

  • The slow query randomly uses a table indexed by date. However,
    There are big differences in the number of records for each date. in the
    In other words, a specific date ranges from a few records to more than 100,000
    and it's pretty coincidental.

  • The database runs under compatibility level 140 (SQL Server)
    2017)

Was the cause of the problem a bad plan or an outdated index?
If it's a bad plan, why? dbcc freeproccache Did not it work out?

Slow start of Ubuntu

That's my systemd analysis guilt

     52.231s plymouth-quit-wait.service
     15.176s snapd.service
     15.051s dev-sda5.device
     12.565s networkd-dispatcher.service
     12.202s systemd-journal-flush.service
     11.897s gpu-manager.service
     10.950s ModemManager.service
     10.698s NetworkManager-wait-online.service
      9.294s udisks2.service
      8.115s dev-loop1.device
      6.849s accounts-daemon.service
      6.706s NetworkManager.service
      5.915s dev-loop11.device
      5.579s dev-loop18.device
      5.480s dev-loop2.device
      5.299s dev-loop12.device
      5.253s systemd-resolved.service
      5.156s dev-loop19.device
      5.029s dev-loop14.device
      5.020s dev-loop16.device
      4.924s dev-loop9.device
      4.575s thermald.service
      4.571s grub-common.service
      4.447s apport.service
      4.341s dev-loop7.device
      3.968s systemd-logind.service
      3.594s avahi-daemon.service
      3.531s bluetooth.service
      3.526s wpa_supplicant.service
      3.489s fwupd.service
      3.366s dev-loop8.device
      2.919s rsyslog.service
      2.760s dev-loop10.device
      2.731s dev-loop6.device
      2.656s dev-loop4.device
      2.644s dev-loop5.device
      2.390s systemd-fsck@dev-disk-byx2duuid-90E0x2d8818.service
      2.371s apparmor.service
      2.255s systemd-tmpfiles-setup.service
      2.108s polkit.service
      1.943s dev-loop3.device
      1.870s dev-loop13.device
      1.764s dev-loop0.device
      1.727s systemd-udevd.service
      1.641s dev-loop15.device
      1.405s dev-loop17.device
      1.391s systemd-sysctl.service
      1.298s gdm.service
      1.094s upower.service
       874ms snap-gnomex2dcalculator-406.mount
       838ms snap-core18-1066.mount
       837ms snap-gtkx2dcommonx2dthemes-1198.mount
       836ms snap-gnomex2dcharacters-254.mount
       832ms grub-initrd-fallback.service
       821ms snap-gnomex2d3x2d28x2d1804-71.mount
       821ms snap-gnomex2dcharacters-296.mount
       820ms snap-gnomex2dsystemx2dmonitor-100.mount
       783ms systemd-backlight@backlight:intel_backlight.service
       755ms snap-libreoffice-139.mount
       754ms snap-core18-1074.mount
       747ms systemd-modules-load.service
       673ms snap-vlc-1049.mount
       644ms pppd-dns.service
       639ms snap-gtkx2dcommonx2dthemes-1313.mount
       633ms snap-chromium-821.mount
       583ms systemd-timesyncd.service
       565ms snap-core-7270.mount
       552ms systemd-tmpfiles-setup-dev.service
       532ms systemd-sysusers.service
       525ms keyboard-setup.service
       497ms systemd-rfkill.service
       482ms systemd-journald.service
       466ms switcheroo-control.service
       423ms snapd.seeded.service
       383ms plymouth-start.service
       347ms systemd-udev-trigger.service
       332ms networking.service
       323ms snap-gnomex2d3x2d28x2d1804-67.mount
       314ms colord.service
       308ms snap-core-7396.mount
       296ms systemd-user-sessions.service
       289ms openvpn.service
       278ms swapfile.swap
       206ms snap-gimp-189.mount
       182ms ifupdown-pre.service
       181ms snap-chromium-817.mount
       180ms nvidia-persistenced.service
       172ms dns-clean.service
       169ms sys-kernel-debug.mount
       169ms dev-mqueue.mount
       166ms dev-hugepages.mount
       163ms boot-efi.mount
       163ms plymouth-read-write.service
       162ms snap-gnomex2dsystemx2dmonitor-77.mount
       162ms snap-gnomex2dlogs-61.mount
       154ms rtkit-daemon.service
       149ms snap-hwx2dprobe-337.mount
       137ms systemd-random-seed.service
       132ms systemd-update-utmp.service
       125ms ufw.service
       121ms kmod-static-nodes.service
       119ms setvtrgb.service
       107ms kerneloops.service
        99ms console-setup.service
        97ms bolt.service
        91ms systemd-remount-fs.service
        65ms user@1000.service
        11ms user-runtime-dir@1000.service
         9ms systemd-update-utmp-runlevel.service
         3ms sys-fs-fuse-connections.mount
         1ms sys-kernel-config.mount
         1ms snapd.socket

Performance – slow execution of the API scraping and processing code

I've written a Python script that requests information from several sports betting APIs, breaks down and standardizes results into a dictionary, compares elements between dictionaries, and then calculates based on the results. The code works, but I have two problems:

1.) The execution of the code takes up to one hour

2.) When the code runs, it seems to use my CPU instead of the GPU, which may help it slow down

Currently, my code uses for-loops and fuzzywuzzy to match names and bet types in different dictionaries, which I have standardized from several APIs against a list of tuples. Once a match is found, the code performs a calculation that is returned if it is less than 1. This works, but it is very slow.

from fuzzywuzzy import fuzz,process

BETennis = {'Frances Tiafoe v Roberto Bautista Agut': {'PVP': {'PlayerA/Match/Win': 3.6, 'PlayerB/Match/Win': 1.28, 'PlayerA/Set1/Win': 2.94, 'PlayerB/Set1/Win': 1.39, 'PlayerA/FirstService/Win/Yes': 1.28, 'PlayerA/FirstService/Win/No': 3.3, 'PlayerB/FirstService/Win/Yes': 1.11, 'PlayerB/FirstService/Win/No': 5}, 'ID': {'EventID': '4806539', 'PlayerA': 'Frances Tiafoe', 'PlayerB': 'Roberto Bautista Agut', 'Agency': 'BET'}}, 'Nick Kyrgios v Karen Khachanov': {'PVP': {'PlayerA/Match/Win': 1.72, 'PlayerB/Match/Win': 2.08, 'PlayerA/Set1/Win': 1.79, 'PlayerB/Set1/Win': 1.96, 'PlayerA/FirstService/Win/Yes': 1.05, 'PlayerA/FirstService/Win/No': 8, 'PlayerB/FirstService/Win/Yes': 1.06, 'PlayerB/FirstService/Win/No': 7.5}, 'ID': {'EventID': '4804932', 'PlayerA': 'Nick Kyrgios', 'PlayerB': 'Karen Khachanov', 'Agency': 'BET'}}}


TBTennis = {'Frances Tiafoe v Roberto Bautista Agut': {'PVP': {'PlayerA/Match/Win': 9, 'PlayerB/Match/Win': 1.99, 'PlayerA/Set1/Win': 2.94, 'PlayerB/Set1/Win': 1.42, 'PlayerA/FirstService/Win/Yes': 1.35, 'PlayerA/FirstService/Win/No': 3.67, 'PlayerB/FirstService/Win/Yes': 1.11, 'PlayerB/FirstService/Win/No': 5}, 'ID': {'EventID': '4806539', 'PlayerA': 'Frances Tiafoe', 'PlayerB': 'Roberto Bautista Agut', 'Agency': 'TB'}}, 'Nick Kyrgios v Karen Khachanov': {'PVP': {'PlayerA/Match/Win': 1.78, 'PlayerB/Match/Win': 2.98, 'PlayerA/Set1/Win': 1.99, 'PlayerB/Set1/Win': 1.96, 'PlayerA/FirstService/Win/Yes': 1.15, 'PlayerA/FirstService/Win/No': 8.1, 'PlayerB/FirstService/Win/Yes': 1.09, 'PlayerB/FirstService/Win/No': 7.5}, 'ID': {'EventID': '4804932', 'PlayerA': 'Nick Kyrgios', 'PlayerB': 'Karen Khachanov', 'Agency': 'TB'}}}



PVPtuples = ((('PlayerA/Match/Win'), ('PlayerB/Match/Win')), (('PlayerA/Set1/Win'), ('PlayerB/Set1/Win')), (('PlayerA/Set2/Win'), ('PlayerB/Set2/Win')), (('PlayerA/Aset/Win/Yes'), ('PlayerA/Aset/Win/No')))





###BETennis/TBTennis###

for i in BETennis:
    for e in BETennis(i)('PVP'):
        for p in TBTennis:
            for m in TBTennis(p)('PVP'):
                for y in PVPtuples:
                    try:
                        if fuzz.token_sort_ratio(BETennis(i)('ID')('PlayerA'), TBTennis(p)('ID')('PlayerA')) > 80 and fuzz.token_sort_ratio(BETennis(i)('ID')('PlayerB'), TBTennis(p)('ID')('PlayerB')) > 80:
                            if e == m and y(0) == e:
                                c = 1/float(TBTennis(p)('PVP')(y(1))) + 1/float(BETennis(i)('PVP')(y(0)))
                                if c < 1:
                                    print(TBTennis(p)('ID')('Agency') + '/' + TBTennis(p)('ID')('PlayerB') + '/' + y(1) + '  ' + BETennis(i)('ID')('Agency') + '/' + BETennis(i)('ID')('PlayerA') + '/' + y(0) + '       ' + str(c))            
                    except:
                        continue



for i in BETennis:
    for e in BETennis(i)('PVP'):
        for p in TBTennis:
            for m in TBTennis(p)('PVP'):
                for y in PVPtuples:
                    try:
                        if fuzz.token_sort_ratio(BETennis(i)('ID')('PlayerA'), TBTennis(p)('ID')('PlayerA')) > 80 and fuzz.token_sort_ratio(BETennis(i)('ID')('PlayerB'), TBTennis(p)('ID')('PlayerB')) > 80:
                            if e == m and y(0) == e:
                                c = 1/float(TBTennis(p)('PVP')(y(0))) + 1/float(BETennis(i)('PVP')(y(1)))
                                #print(TBTennis(p)('ID')('Agency') + y(0) + '/' + BETennis(i)('ID')('Agency') + y(1) + c)
                                if c < 1:
                                    print(TBTennis(p)('ID')('Agency') + '/' + TBTennis(p)('ID')('PlayerA') + '/' + y(0) + '  ' + BETennis(i)('ID')('Agency') + '/' + BETennis(i)('ID')('PlayerB') + '/' + y(1) + '       ' + str(c))                
                    except:
                        continue

The code works more or less as expected, but I am new to Python and programming in general. I think I do it in a very inefficient way. One workaround I'm currently researching is using CUDA to do this with my NVIDIA GPU instead of my CPU, as is currently the case. All suggestions would be greatly appreciated. Finally, it should be noted that the dictionaries in my code are significantly longer and more extensive than those used in the above example.

Javascript – Find the way between the points. Labyrinth algorithm too slow

I'm creating an algorithm to find the shortest path between two points in a maze, but my current solution is too slow.

I did that:

Helper classes:

import { Coord } from "./Coord";

export class MazeResult {
    position: Coord;
    path: Array;

    constructor (_position: Coord, _path: Array) {
        this.position = _position;
        this.path = _path;
    }
}

export class Coord {
    coordX: number;
    coordY: number;
    isFree: boolean;
    element: Element;
    distance: number;

    constructor (xpos: number, ypos: number) {
        this.coordX = xpos;
        this.coordY = ypos;
        this.distance = 0;
    }
}

function isValid(visited: Array, position: Coord)
{
    let checkPosition = mapPositions.find(_p => _p.coordX == position.coordX &&
                                                _p.coordY == position.coordY);
    let isVisited = false;
    for (var j = 0; j < visited.length; j ++) {
            if ((visited(j).coordX == position.coordX && visited(j).coordY == position.coordY)) {
                isVisited = true;
                break;
        }
    }
    return (position.coordY >= 0) && 
            (position.coordY < lines.length) && 
            (position.coordX >= 0) && 
            (position.coordX < lines(0).length) && 
            (checkPosition != undefined && checkPosition.element.elementType == ElementType.FIELD) && 
            !isVisited;
}

function findPath(origin: Coord, target: Coord, minDistance: number) {
    let queue = Array();
    let validpaths = Array>();

    // New points, where we did not check the surroundings:
    // remember the position and how we got there
    // initially our starting point and a path containing only this point
    let tmpElement = new MazeResult(origin, (origin));
    queue.push(tmpElement);

    while (queue.length > 0) {
        // get next position to check viable directions
        let pointToReach = queue.shift();
        let position = new Coord(0, 0);
        let path = new Array();
        if(pointToReach != undefined){
            position = pointToReach.position;
            path = pointToReach.path;
        } 
        // all points in each direction
        let direction = ( 
                            ( position.coordX, position.coordY - 1 ),
                            ( position.coordX, position.coordY + 1 ),
                            ( position.coordX - 1, position.coordY ),
                            ( position.coordX + 1, position.coordY )
                        );
        for(var i = 0; i < direction.length; i++) { 
            let newTarget = new Coord(direction(i)(0), direction(i)(1));
            // is valid is just a function that checks whether the point is free.
            if (isValid(path, newTarget)) {
                //
                let newPath = path.slice(0);
                newPath.push(newTarget);

                if ((validpaths.length > 0 && validpaths.sort(_p => _p.length)(0).length < newPath.length) || 
                    (minDistance > 0 && newPath.length > minDistance))
                    continue;

                // check if we are at end
                if (newTarget.coordX != target.coordX || newTarget.coordY != target.coordY) {
                    // remember position and the path to it
                    tmpElement = new MazeResult(newTarget, newPath);                    
                    queue.push(tmpElement);
                } else {
                    // remember this path from start to end
                    validpaths.push(newPath);
                    // break here if you want only one shortest path
                }
            }
        }
    }

    validpaths = validpaths.sort(sortByArrayPosition);
    let result = validpaths.shift();

    return result;
}

I added a third parameter minDistance So I can compare with earlier path calculations on different points, but this should not be relevant here.

How can I improve the performance of this algorithm?

vnc – x11vnc fast to send user input, very slow to remove screen changes

I run x11vnc on a Linux Mint 19 box and connect to the Windows TightVNC client over the WAN. Works great.

So I thought about trying it on my LAN and ran x11vnc on another Mint 19 box and made a connection with Remmina on another Mint 19 box. The behavior has beaten me, however. I can see both screens (server and client side).

When I move the mouse over the server side, it rotates a bit slowly, but bearable. When I click in a browser on a new tab, the server side paints immediately and the client side takes a lot of time to paint. I count 8 seconds orally. Insane.

I checked online for a long time and tried to take damage without luck.

The initial connection is instant and paints immediately. It's just subsequent interactions that last forever.

I'm using the same Remmina to connect to another Mint 19 box with Vino, and she's afloat. However, I prefer x11vnc. I admit, Vino seems like a dead project, it's hard to install today, and there's almost no documentation or options to talk about. x11vnc, on the other hand, seems to be a living project that is highly configurable, provides great logging, and much more, and that has (for now) a charm to me.

What puzzles me is that this 8-second delay has nothing to do with network speed or, of course, with the client and seems to be something very special. I hope for some hints, how to diagnose this and maybe understand / fix it?

Can anyone suggest enabling the debug output, and what could I learn from it?

Videos are slow to load if the hard drive can not be replaced

Hello everyone, is that why video streaming slows and slows down when you look at this graph? One of the drives has been replaced and now it is synced again. I am not sure if the videos are loaded slowly for this reason.

(root @ localhost home) # cat / proc / mdstat
Personalities: (raid1) (raid6) (raid5) (raid4)
md125: active raid1 sdd1 (2) sdc1 (1)
4096000 blocked Super 1.2 (2/1) (_U)
resync = DELAYED

md128: active raid6 sdf1 (10) (s) sdb1 (0) sdl1 (9) sdk1 (8) sdj1 (7) sdi1 (6) sdh1 (5) sdg1 (4) sde1 (2) sda1 (1)
62511161344 blocked Super 1.2 Level 6, 512 KB Block, Algorithm 2 (10/9) (UUU_UUUUUU)
(> ………………..) Resync = 1.8% (145655296/7813895168) Finish = 87756.0 Min. Speed ​​= 1456 K / sec
Bitmap: 31/59 pages (124 KB), 65536 KB block

md126: active raid1 sdd2 (2) sdc2 (1)
307904 Blocks Super 1.2 (2/2) (UU)
Bitmap: 0/1 pages (0 KB), 65536 KB Chunk

md127: active raid1 sdd3 (2) sdc3 (1)
112747520 blocked Super 1.2 (2/1) (_U)
(===========> ……..) Recovery = 60.8% (68553344/112747520) End = 10.1 min Speed ​​= 72739 K / s
Bitmap: 1/1 page (4 KB), 65536 KB block

Increase and accelerate WordPress dramatically and fix slow administrators in 24 hours for $ 20

Increase and accelerate WordPress dramatically and fix slow administrators within 24 hours

If you want your content to rank, it's important that your website load quickly. The faster the better.

The speed of page loading has a direct impact on the position of your website in search engine results.

I will optimize and improve yours WordPress Website performance, speed and load time.

✓ page caching
✓ File compression
✓ Enable gZip compression
✓ ultrafast charging time
✓ Browser caching
✓ Database optimization
✓ Optimize your websites pictures
✓ Basic WordPress security

Fast site speed means:

  • Better user experience
  • Lower bounce rate
  • Higher ROI and conversion rates
  • Better ranking of the Google search engine
  • Happy visitors

Delivery includes:

1. Service as promised!

2. Before and after reports
3. Answering the questions
4. Greetings

Still insecure? Let's talk to clarify it! Or you can order now. 100% satisfaction