mysql – Returns an ID specifying data that does NOT have the same category as the given id

I have 3 tables: video, video_category and video_category_join.

A video can have multiple video_category and a video_category can be associated with multiple videos: hence the video_category_join table

TABLE: Video

| video_id | title | description | Duration |
| --------------------------------------------
| 12 | hello | ... | 190 |
| 24 | hello | ... | 190 |
| 78 | hello | ... | 190 |
| 34 | hello | ... | 190 |
| 91 | hello | ... | 190 |
| 88 | hello | ... | 190 |

TABLE: video_category

| video_category_id | name |
| ------------------------------
| 4 | Music |
| 8 | tv |
| 5 | black |
| 2 | politically |
| 1 | Movie |
| 6 | others |

TABLE: video_category_join

| video_id | video_category_id |
| ------------------------------
| 24 | 4 |
| 24 | 5 |
| 88 | 1 |
| 91 | 6 |
| 91 | 5 |
| 78 | 4 |

Accepted video_idI want to select random videos that do NOT have the same category as the one specified video_id,

So for example, if the video_id At 24, the result set should return videos that do not match the same category as video_id 24. In this case, the only videos do not have the same category as video_id 24 are: video_id 88 and video_id 91st

This is a query that I thought might work, but if that is true video_id has no categories there is nothing back.

SELECT DISTINCT v.video_id, v.title, v.duration, 2 AS preferred
FROM video_category_join vc
JOIN video_category_join vc2 ON vc2.video_category_id <> vc.video_category_id AND vc2.video_id <> vc.video_id
JOIN video v ON v.video_id = vc2.video_id
WO vc.video_id = 5
ORDER BY EDGE ()
LIMIT 20

JavaScript – CAML query ID of last list item with status = new

I have a custom SharePoint 2013 list and must load the last list item with Status = Reload. I first tried SPGetLastItemID with a CAML query filter. However, this method returns only items for the current user, and I need the last item with status = new for ALL items / users.

For some reason it does not seem to work (no alarm box):

var LastID;
Function QueryLastNewStatusItem () {
var clientContext = new SP.ClientContext ();
var List = clientContext.get_web (). get_lists (). getByTitle (& # 39; Tracker & # 39;);
var query = new SP.CamlQuery ();
var textCaml = "
         
        1 
         
             
             
            
            
            
                
                New
            
         
        
        ";
query.set_viewXml (textCaml);
var item = List.getItems (query);
context.load (item);
LastID = GetItemID (item);
alert (LastID);
}   

I'm a beginner with JavaScript and pretty new to CAML queries. I used internal names for FieldRef names in the query and made sure the function was triggered.

mysql – Edit the database ID in PHP

I'm trying to make a query to the database faster the edition, I explain: I have the following code "SELECT * from bdd where id = 17"
What I want is too ID Enter it via a form, as I have to update it manually every week.
There is a lot of data that I need to update at the same time, for example:

$ sqlp = "SELECT * from bdd where id = 17";
$ resultp = mysqli_query ($ connection, $ sqlp);
$ rowsp = mysqli_fetch_array ($ resultp);
if ($ rowsp) {
echo & # 39;<img height = "40px" src = "http://es.stackoverflow.com/escudos/.png ">& # 39 ;;
}

$ sqlp = "SELECT * from bdd where id = 7";
$ resultp = mysqli_query ($ connection, $ sqlp);
$ rowsp = mysqli_fetch_array ($ resultp);
if ($ rowsp) {
echo & # 39;<img height = "40px" src = "http://es.stackoverflow.com/escudos/.png ">& # 39 ;;
}

As you can see, there are two images, each referring to a different ID. As I said, what I am trying is "id" to enter it from a form:

How do I find the node ID of the node issuing a lightning network bill?

Lightning bills are signed by the node issuing the bill to check the signature we need to know the node ID. Thus, it is included in the bill. Lightning nodes provide an API for decoding invoices.

In c-lightning this is possible (And below!)

Flash cli decodepay LNBC13934430N1PWJUJEZPP5K7FLC2M5CLHTWMTF3HZDN7VVRCA4RNFAFA89F2D6KGYWW4JCSDAQDZ62PSKJEPQW3HJQ4RGV5SYC6T8DP6XU6TWVUSYXMMWVEJHYETWVDJJQ2Z0WFJX2U3QF9ZR5GZ5F3PNZWFD25UY54Z39YXQZURCQP2RZJQG8ZM9WXGVHZPMUQEWY9J9KDQNRVLZHPCWM6S8CVLC2CKRDNELE42Z9U5VQQY3SQQYQQQQL8QQQQPJQQ9Q6KM84F7KTW6UV574UR2LFNKZLM7VNK8NJRZV20JD8SAW6FZ3TQGSZE6YUT0X2UXGDGYJZGTXEFSQSSEVTKFF97P3TER5K23ZPHDDXHQQ95UT4N
{
"currency": "bc",
"created_at": 1563314978,
"Process": 899,
Payee: 024a8228d764091fce2ed67e1a7404f83e38ea3c7cb42030a2789e73cf3b341365
msatoshi: 1393443000
"amount_msat": "1393443000msat",
"description": "Paid to the Lightning Conference (Order Number: TLC19-U8JTQ)",
"min_final_cltv_expiry": 10,
"Stretch": [
    [
      {
        "pubkey": "020e2d95c6432e20ef80cb885916cd04c6cf8ae1c3b7a81f0cfe158b0db3cff355", 
        "short_channel_id": "572579x582x1", 
        "fee_base_msat": 999, 
        "fee_proportional_millionths": 200, 
        "cltv_expiry_delta": 40
      }
    ]
  ].
"payment_hash": "b793fc2b74c7eeb76d698dc4d9f98c1e3b51cd3d4f4e54a9bab208e75658837a",
Signature: 3045022100d5b67aa7d65bb5c653d5e0d5f4cec2fefcc9d8f390c4c53e4d3c3aed245158110220016744e2de6570c86a09212166ca6008432c5d9292f8315220
}

In particular, we find the entry revealing the node of the business:

    Payee: 024a8228d764091fce2ed67e1a7404f83e38ea3c7cb42030a2789e73cf3b341365

The following command will allow us to query gossip for more information about the node:

lightning-cli listnodes | grep 024a8228d764091fce2ed67e1a7404f83e38ea3c7cb42030a2789e73cf3b341365 -B 1 -C 13
{
"nodeid": 024a8228d764091fce2ed67e1a7404f83e38ea3c7cb42030a2789e73cf3b341365,
"alias": "www.fulmo.org",
"color": "f2f3f4",
"last_timestamp": 1561973177,
"globalfeatures": "",
"global_features": "",
"Addresses": [
        {
          "type": "ipv4", 
          "address": "95.211.207.81", 
          "port": 9735
        }
      ]
    }, 

This gives us all the information we need to compare with the business and to fund a channel. (If the node was private, we could use that routes Hints from the decoded bill to connect to a public root node.)

and user

If you use Ind You can use the command DecodePayReq and instead of calling nodes list To get the information from the gossip, you can call it GetNetworkInfo

Replacing Ajax fails with the Form ID mismatch warning, even if the event is not executed the second time in Drupal 8

Enter image description here

Above the field is the paragraph field with two separate selection fields. Note : Business Rules Engine does not work with it.
Both field options are loaded from entity reference views.

Trying to create a dependent selection box with Drupal 8 Ajax Replace.

The replacement fails the second time, and the log displays the match with the form ID as a warning.

I tried a different approach by using HtmlCommand instead of ReplaceCommand and set the static ID for the child form element. By default, Drupal provides a dynamic ID for each form element. Also, if I try to change the item ID, it will not work by giving a Form ID mismatch warning.

  1. I tried to replace the entire form element by packing the wrapper with ReplaceCommand.
    / **
    * Implemented hook_field_widget_WIDGET_TYPE_form_alter ().
    * /
    function module_name_field_widget_entity_reference_paragraphs_form_alter (& $ element, & $ form_state, $ context) {

                    $ element['subform']['field_course']['widget']['#ajax']    = [
                  'callback' => 'get_competency',
                  'event' => 'change',
                  'method' => 'replace',
                  'wrapper' => '#edit-competency-'.$uuid_value,
                ];
    
    }
    
    
    
    Function get_competency (Array & $ element, FormStateInterface $ form_state, $ context) {
    
    
    $ triggeringElement = $ form_state-> getTriggeringElement ();
    $ value = $ triggeringElement['#value'];
    
    $ gt =  Drupal :: service (& # 39; generic_templates.utility & # 39;);
    $ options = $ gt-> getCompetency ($ value);
    $ options = ["_none" => "- Select a value -"] + $ options;
    $ wrapper_id = $ triggeringElement["#ajax"]["wrapper"];
    unset ($ triggeringElement["#value"]);
    unset ($ triggeringElement["#ajax"]);
    $ triggeringElement['#title'] = "Competence";
    $ triggeringElement['#prefix'] = & # 39;
    & # 39 ;; $ triggeringElement['#suffix'] = & # 39;
    & # 39 ;; $ triggeringElement['#options'] = $ options; $ triggeringElement['#default_value'] = NULL; $ triggeringElement['#field_name'] = "Field competence"; $ triggeringElement['#parents'] = [ "field_configurations", 0, "subform", "field_configuration", 0, "subform", "field_score", 0, "subform", "field_competency", ]; $ triggeringElement["#array_parents"] = [ "field_configurations", "widget", 0, "subform", "field_configuration", "widget", 0, "subform", "field_score", "widget", 0, "subform", "field_competency", "widget", ]; $ triggeringElement["#attributes"]["data-drupal-selector"] = str_replace ("course", "competence", $ triggeringElement["#attributes"]["data-drupal-selector"]); $ triggeringElement["#name"] = str_replace ("course", "competence", $ triggeringElement["#name"]); $ id = explode (& # 39; - & # 39 ;, $ triggeringElement["#id"])[0]; $ triggeringElement["#id"] = str_replace ("course", "competence", $ id); return $ triggeringElement; }
  2. I changed the ID of the element as a wrapper ID so that the form element itself now acts as a wrapper, and I used HtmlCommand. The idea is to replace only the entire Drupal-generated selection field (1st method).

use Drupal Core Ajax AjaxResponse;
use Drupal Core Ajax HtmlCommand;

                / **
* Implemented hook_field_widget_WIDGET_TYPE_form_alter ().
* /
function module_name_field_widget_entity_reference_paragraphs_form_alter (& $ element, & $ form_state, $ context) {

$ element['subform']['field_course']['widget']['#ajax']    = [
                  'callback' => 'get_competency',
                  'event' => 'change',
                  'method' => 'html',
                  'wrapper' => 'edit-competency-'.$uuid_value,
                ];

$ element['subform']['field_competency']['widget']['#attributes']['id']= & # 39; processing competence - & # 39 ;. $ uuid_value;

}



Function get_competency (Array & $ element, FormStateInterface $ form_state, $ context) {

$ triggeringElement = $ form_state-> getTriggeringElement ();
$ value = $ triggeringElement['#value'];

$ gt =  Drupal :: service (& # 39; generic_templates.utility & # 39;);
$ options = $ gt-> getCompetency ($ value);
$ options = ["_none" => "- Select a value -"] + $ options;
$ wrapper_id = $ triggeringElement["#ajax"]["wrapper"];

$ gt =  Drupal :: service (& # 39; generic_templates.utility & # 39;);
$ options = $ gt-> getCompetency ($ value);
$ options = ["_none" => "- Select a value -"] + $ options;
$ renderingField = & # 39; & # 39 ;;

foreach ($ options as $ key => $ value) {
$ renderingField. = "";
}

$ response = new AjaxResponse ();
$ response-> addCommand (new HtmlCommand (# #; # $ wrapper_id, $ renderingField));
return $ response;
}

Javascript – Angular – Generate a unique CSS ID for each table cell

I'm working on a project where I need a unique CSS ID for each table cell. The format of the table is something like that.


  
  
  
  
           

I try to generate CSS I would with the above method, where I increment the index variable with 1. This trick does not work and all td always the same I wouldalthough this method generates a unique ID for each row.

I am very grateful for any help. I did a lot of tricks but nothing really works for me ūüôĀ

Many Thanks!

8 – How can I load a Commerce Store by User ID?

I am building a multi-seller commerce site where a user can register and sell their product. I need to display a menu link if the user is anonymous to become a "seller", where he is directed to sign up and create a business form.

When the user is logged in, I want to display a menu link that displays "My Store" if he has previously created a store. How can I load a store from the user ID to see if it has a store?

I could not find an example where someone can load a user's shop.

How do I select a text by double-clicking on a web page about Selenium in Python? (Not available Xpath, ID, etc.)

I have boxes like this:

https://prnt.sc/ofbs2y

Xpath value for the space next to the "axes":

// * [@ id = "ctl00_ContentPlaceHolder1_ABC_ctl02"]

Xpath value for the space next to the "Classic":

// * [@ id = "ctl00_ContentPlaceHolder1_ABC_ctl03_"]

There is only one difference in the number at the end, but these are not specific values. The sorting can vary depending on the user. This ranking could look like this:

https://prnt.sc/ofbtdk

The Xpath value for the space value next to "Classic," which is the fourth line here

// * [@ id = "ctl00_ContentPlaceHolder1_ABC_ctl05_"]

The Xpath value changes according to the sort, not the name on the left. This prevents me from using values ‚Äč‚Äčlike Xpath and ID. As a solution, I plan to switch to the corresponding field by selecting the Classic value with a double-click and pressing the TAB key. By the way, Classic is just such a name. The real name could be something like "classic of the year". In fact, I can also select the entire phrase "classic of the year".

Incidentally, the sorting also applies to the axes, Classic, etc. For this reason, I can choose with Xpath, ID neither Axles nor Classic. Because these values ‚Äč‚Äčlike boxes do not have specific xpath or id values.

For these reasons, I would like to double-click on the word "Axis" on the page and switch to the tab with the TAB key. Is this possible via Xpath, does that contain? If yes how?