Delete from table one row with 2 variable with limit

I’m developing a PHP script who store session of users in a Database.

When an user logout from server, remove only one row ( because same user can login more than one time )

When server reboot, remove all session of all users from that server with same ip.

Table structure:

  • Table name:
    • totalconcurrent
  • Column in table:
    • ID [int, autoincrement, 11]
    • serverip [mediumint]
    • userid [text]

Running on :

mysql  Ver 15.1 Distrib 5.5.64-MariaDB, for Linux (x86_64) using readline 5.1 

Case: User logout

Query runs correctly but doesn’t delete anything.

    elseif ($  _GET['status'] == "logout"){         $  sql = "DELETE FROM totalconcurrent WHERE (serverip,userid) IN ((INET_ATON('".get_server_ip()."'),'".$  _GET['id']."')) LIMIT 1;";         if ($  conn->query($  sql) === TRUE) {             echo "1 Session of ".$  _GET['id']." removed";         } else {             echo "Error: " . $  sql . "<br>" . $  conn->error;         }     } 

Case: Server Reboot

Query runs correctly but doesn’t delete anything.

    elseif ($  _GET['status'] == "reboot"){         $  sql = "DELETE FROM totalconcurrent WHERE serverip IN ((INET_ATON('".get_server_ip()."')));";          if ($  conn->query($  sql) === TRUE) {             echo "Server rebooted, removed all session stored in this server";         } else {             echo "Error: " . $  sql . "<br>" . $  conn->error;         }     } 

Problem:

I’ve tryed many times and many types of query to do this but without finding the correct way to do this.

What queries i need for do this?

I want to delete connections in tnsnames.ora. I need to figure out which ones are currently in use, so that I don’t delete them mistakenly


I’m using Oracle 12c in Debian 8 (on a vm)

This question is for educational purposes only. I’m not using any production servers, so anything that you can tell me won’t have consecuences

To start with, I found this link to delete registers in tnsnames.ora. I didn’t test it yet because first, I needed to know if there were active connections in the database using the information of the tnsnames.ora.
I’m asking here because I found no way of doing this, but it may be possible to do it.

For you to know, I’m using this command for connecting to the database, so that I clearly specify a tnsname

rlwrap sqlplus sys as sysdba@tnstest 

The contents of my tnsnames.ora are the following

tnstest =   (DESCRIPTION =     (ADDRESS_LIST =       (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1539))     )     (CONNECT_DATA =       (SERVER = DEDICATED)       (SERVICE_NAME = orcl)     )   ) 

But, if I want to be 100% sure that this is working, I use this command

tnsping tnstest 

Which results are…

TNS Ping Utility for Linux: Version 12.2.0.1.0 - Production on 28-JAN-2020 23:51:38  Copyright (c) 1997, 2016, Oracle.  All rights reserved.  Used parameter files: /opt/oracle/product/12.1.0.2/dbhome_1/network/admin/sqlnet.ora   Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1539))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl))) OK (0 msec) 

After all of this I know that my configuration is working, I’m using a register in tnsnames.ora for the connection, but I don’t know a way of checking…
“Hey, now that I’m connected, I want to know which register I used from the tnsnames file for connecting, if I used that file of course”

Is there any possibility that I could get this information?

Well, my following attempts of trying to figure this out, were checking the v$ session view, if there was any field that I could use to get this information, but I couldn’t find one.

After all of this, ultimately, I came here for asking. I don’t know what else to try nor I have more ideas of what should I do next.

P.S: there’s a chance that this problem is impossible to solve, because this is task I’m doing due to I’m a student of sysadmin, and our teacher intentionally added unsolvable questions.
Even so, I still think there might be a solution for this particular case

Algorithm to delete BST nodes with duplicated values

For BSTs we have:

  1. Greater values go to the right
  2. Smaller or EQUAL values go to the left

All the algorithms I found to delete a node say to find the smallest node in the right subtree of the node we want to delete, successor, (or the greatest node in the left subtree, predecessor), and replace the deleted node for the successor.

But what happens when we have BST nodes with the same value?

     4    /   \   2     5 <-- Delete 5  / \   / \ 1  3  5   7          / \        [7]  9 <-- 7 will take 5's place 

Now we end up with:

     4    /   \   2     7   / \   / \ 1  3  5  [7]  <-- This 7 should be in the left subtree            \             9 

The BST will still work (or not?), but the definition of BST won’t fit this resultant tree anymore.

Is there another algorithm that takes this into account or is this result expected and generally accepted?

We’re deleting stale AD accounts for a company but owner wants to see the network files of AD users before deciding which accts to delete

We are deleting stale AD accounts for the companies we work for.

I contacted the owner of a particular company to help us determine which AD accounts we can delete. He said he’d first like to see what files the deletion candidates have stored on the network to help decide which accounts are OK to delete.

We have a domain admin account. Is there a way to access AD User files? Is there a PowerShell command (or GUI app) to list the files of each AD user in a clean/presentable format that we could present to the owner?

I think he’s only really concerned with the contents of each user’s Home directories (the directories containing the Documents, Music etc. folders) — and not network shares or shared folders users may happen to have access to — because the Home directories are the only directories risking deletion as a result of deleting their accounts, right?

How do I delete google help forum questions with my name attached? [closed]

I’m removing as much searchable information on myself as I can from the internet.

I asked some questions on various google help forums (calendar and play) between 2014 and this year, which are attached to my full name, and are a top result when I’m searched. There’s no visible delete option, and editing my name in google plus didn’t change the questions or search results.

Searching how to delete gets mixed results, linked here: Resolved question one. Resolved question two. Unresolved question one. Unresolved question two. I’m not fully sure which posters represent google, or current google policy, and between the questions it seems ambiguous if older posts can be deleted, if there are exceptions for privacy concerns, what “escalating” a question entails, etc.

TL;DR: What is the best way to get or ask for my google help forum questions to be deleted? Or are my grandkids and future employers going to look me up and see my teenage-self getting snippy about Google calendar? Thanks.

How to delete a node from BST tree with 2 chidren?

I googled, read several tutorials and watched several BST node deletion algorithm explanations before posting this question. For some reason, I cannot find a complete explanation of BST node deletion algorithms.

I’ve found 4 algorithms to remove the node with 2 children from Binary Search Tree:
1) Find the smallest node from right sub tree and replace it with the node which we want to delete.
2) Find the biggest node from left sub tree and replace it with the node which we want to delete.
3) Find the deepest leftmost node from the right sub tree and replace it with the node which we want to delete.
4) Find the deepest rightmost node from the left sub tree and replace it with the node which we want to delete.

Apparently, none of those algorithms works for the next use case (most likely because I am missing or don’t understand something). The use case is to remove element 5 from the next tree: enter image description here

For the first algorithm we would chose element 6 and would lose its right sub tree. For the second algorithm we would chose element 4 and would lose its left sub tree. For the 3rd algorithm we would chose element 7 and which would violate BST rules. For the 4th algorithm we would chose element 3 which would also violate BST rules.

What is the right algorithm for such a use case?

delete node from linked list (lang w/GC) -should deleted item ‘next’ be set to null

Regarding: delete a node from a linked list algorithm,in procedural languages with garbage-collection. Should there be a step in the algorithm, of setting the removed-node-next-pointer to null ?

(Several high-school-CS-teachers in my area teach YES, while others teach NO)

What is the right approach?

/thanks ran

How to Delete Code Below the Footer Section

I’m hoping you can give me some advice:

I created a blog post you can see here: https://www.reyrrodriguez.com/seo-services-worth-it/

I added videos by embedding the YouTube player. I realized the page became a lot slower. So I tried to fix it by following this tutorial. https://www.labnol.org/internet/light-youtube-embeds/27941/

I added the script part using google tag manager using custom HTML tag: http://prntscr.com/py9xk7

Then I added the css under themes, customize, additional css: http://prntscr.com/py9yve

The problem is, as you can see near the bottom of the page under the footer the code shows: http://prntscr.com/py9zic

I tried to run a system backup using siteground which is my hosting service. But it did not work to revert the change.

Can you give me some tips how I can complete this correctly: https://www.labnol.org/internet/light-youtube-embeds/27941/

And remove the code at the bottom?

I would really appreciate. -Rey

PS: Before completing the system back up I paused the tag within tag manager and also tried to delete it. But the code at the bottom never went away.