rest api – Retrieving X-WP-Total header using cURL

I am accessing a WP site from an outside app and using the restAPI routes / endpoints to work with posts, pages, comments, users, etc…
I am wondering how I can change / use the below cURL to retrieve the number of elements (eg. the “X-WP-Total” header…) collected:

$process = curl_init($curl_init);
curl_setopt($process, CURLOPT_TIMEOUT, 30);
curl_setopt($process, CURLOPT_POST, 1);
curl_setopt($process, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($process, CURLOPT_HTTPHEADER, array("Authorization: Bearer ".$token));
$post= curl_exec($process);
return json_decode($post);

…in this case the endpoint is obviously posts, but I use this cURL request for other endpoints…
Many thanks for your help

shortcode – Retrieving post content from only one div/element

I want to display blog post little summary on my home page and I have built custom short codes to retrieve data: title, date, featured image and content.
My problem is that it fetches all text with content and I have restricted it to first 140 chars.
But first text in that page is date and title etc. So I have one div with ID “post-content”. Is it possible to get text only from that specific div?

Currently I have it like that:

        function wpc_shortcode_content($atts) {
            $args = array( 'numberposts' => '3' );
            $recent_posts = wp_get_recent_posts($args);
            $content = substr(wp_strip_all_tags(strip_shortcodes( $recent_posts($atts('index'))("post_content"))), 0, 140) . "...";
            $trimmedContent = $content;

            return <<<HTML

Is there a search engine with reverse search mechanism: processing multiple queries and retrieving a single result for each of them?

A regular search engine retrieves a number of results matching a single query. I need one that does the opposite: enables to input a number of queries and displays a single match to each of them. If there is no match, I need to know it too. An implementation of this approach exists, but its application is limited to the database embedding it (PubMed). Batch Citation Matcher enables a user to identify unique content in databases covering material also present in PubMed. A user can submit a text file and the engine transforms the content of the file separated in a required way into a number of queries, then displays a table with queries in one column and the information on whether the text of the queries was found in a database being compared to PubMed in another column. Is there an analogues application which can be applied to any website?

8 – Retrieving the logged in user from another script

I need to load the user object from another non Drupal script.

The following returns an anonymous user. I guess this creates a new session.

Is there a way to get the user object for the user who is logged into the site?

define('DRUPAL_DIR', '/var/www/xxxxxx');
use DrupalCoreDrupalKernel;
use SymfonyComponentHttpFoundationRequest;

require_once DRUPAL_DIR . '/core/includes/';
require_once DRUPAL_DIR . '/core/includes/';

// Specify relative path to the drupal root.
$autoloader = require_once DRUPAL_DIR . '/autoload.php';
$request = Request::createFromGlobals();

// Bootstrap drupal to different levels
$kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod');
$em = $kernel->getContainer()->get('entity.manager');

$user = DrupaluserEntityUser::load(Drupal::currentUser()->id());

ios – UIPasteboard retrieving the previous item

I have the following code:

((UIApplication sharedApplication) sendAction:@selector(copy:) to:nil from:self forEvent:nil);
NSString *string =  (UIPasteboard generalPasteboard).string;

The problem is that the storyboard returns what I copied previously, not currently. Either way, it depends on the previous item that I copied and returned, then next time, I get the item that I wanted and copied … strange behavior .. any ideas?

postgresql – Retrieving SQL records via a third-party application

I have a front end application, which has a login page. User records come from an external database.
The application is JOSSO2 and the component used to retrieve the records and the external database is called "RDBMS Identity Source".

There are 3 tabs in the "Create a database identity source" window: login, search for user and update password.

In the Connection tab, I need to fill in the Driver, Connection URL, Username, Password and Retype password sections.

In the User Search and Password Update sections, there are SQL statements to complete to retrieve the necessary records from the database. The queries are already present in each section; however, they must be modified to suit the needs of each person.

In the User Lookup tab, there are 4 different queries and their corresponding SQL statements:





In the Password Update tab, there are 2 different queries and their corresponding SQL statements:


Relay Credentials : SELECT LOGIN FROM JOSSO_USER WHERE #?# = ?

Updating credentials is a SQL update statement to change the credentials of the user.

Relay Credentials is a SQL update statement to update the credentials supporting the Remember Me functionality.

Now let's move on to the external database itself. The name of the database is invoices and the name of the table with user records is "myeg_users". In this table, the important columns related to the SQL queries above include user name, first name, last name, nric, role and password.

The structure of the table:

paybills=# d myeg_users
                               Table "public.myeg_users"
       Column       |            Type             |              Modifiers
 username           | character varying(100)      | not null
 password           | character varying(40)       |
 email              | character varying(100)      |
 maiden             | character varying(30)       |
 first_name         | character varying(100)      |
 last_name          | character varying(100)      |
 gender             | character varying(6)        |
 nric               | character varying(14)       |
 passport_no        | character varying(12)       |
 dob                | date                        |
 address1           | character varying(80)       |
 address2           | character varying(80)       |
 address3           | character varying(80)       |
 city               | character varying(60)       |
 state              | character varying(50)       |
 country            | character varying(35)       |
 postcode           | character varying(5)        |
 mobile_no          | character varying(13)       |
 fax_no             | character varying(13)       |
 phone_no           | character varying(13)       |
 marital_status     | character varying(12)       |
 occupation         | character varying(35)       |
 industry           | character varying(35)       |
 rec_created_date   | timestamp with time zone    |
 status_flg         | character varying(3)        |
 activation_id      | character varying(100)      |
 last_logintime     | timestamp with time zone    |
 role               | character varying(255)      | default 'role 2'::character varying
 issync             | character(1)                | default 0
 updatedsyncdated   | timestamp(0) with time zone |
 flg_confirm_detail | character varying(2)        | default 'N'::character varying
 pdpa               | character varying           | default 'X'::character varying
 encr_password      | character varying(255)      |
 is_active          | boolean                     |
 encr_date          | timestamp with time zone    |
 is_encr            | character varying(3)        | default 'N'::character varying
 new_user_flag      | character varying(3)        |
 valid_email_flag   | character varying(3)        |
 email_sent_flag    | timestamp with time zone    |
 email_hash         | text                        |
 upgrade_flag       | character(1)                | default NULL::bpchar
    "index_activationid" btree (activation_id)
    "index_myegusers_username" btree (username)


Now, I need help on how to create queries in the above SQL queries to retrieve the necessary information from the external database. I have tried several ways, like changing the above queries to directly use "myeg_users" instead of the already available JOSSO_USER, but it doesn't work, for example like this:

select login as username from myeg_users where login = ?

SELECT username AS login FROM myeg_users;

SELECT role AS role FROM myeg_users;

SELECT username, password AS login from myeg_users;

SELECT username, nric from myeg_users;

Please help me add / modify the above default SQL queries to successfully connect to the page. For now, the error is

Invalid Authentication Information

when i try to connect.

Retrieving list item with JavaScript does not work

I have a task list with items that are in a SharePoint list.

First of all, I implemented a method with which I could retrieve ToDo list items from localStorage like this:

if (localStorage.getItem('todo_list')) {
      this.todoList = JSON.parse(localStorage.getItem('todo_list'));

It worked well:

enter description of image here

Then I changed the code to retrieve the items from the list to let them appear on the task list. But the problem is that they don't show up and I don't know how to fix the problem.

Here is the method:

getTodos() {
  let siteUrl = 'https://thesite';
  var clientContext = new SP.ClientContext(siteUrl);
  var oList = clientContext.get_web().get_lists().getByTitle('PhysicalGoals');
  var camlQuery = new SP.CamlQuery();
  var playerID = this.$store.state.selectedPlayer.ID;
  console.log("playerID getTodos: " + playerID);
  camlQuery.set_viewXml('' +
  var collListItem = oList.getItems(camlQuery);


  clientContext.executeQueryAsync(()=> {
            var listItemEnumerator = collListItem.getEnumerator();
            var counter = 0;
            var circularObj = {};
            var items = ();

            while (listItemEnumerator.moveNext()) {
                var item = listItemEnumerator.get_current();
                  items(counter) = oList.getItemById(item.get_id());
                  console.log("items(counter) at counter: " + counter + " are: " + items(counter));
            circularObj.circularRef = circularObj;
            circularObj.list = (items);
            this.todoList = circularObj.list;

            // Finally execute the delete statements
                    () => console.log('Item(s) retrieved')),
                    () => console.log('Failed to show item(s)');
          ()=>console.log('Failed to retrieve items'));

  if (localStorage.getItem('todo_list')) {
        this.todoList = JSON.parse(localStorage.getItem('todo_list'));

Here is what the development tools show:
enter description of image here

Anyone know how to fix this problem?
Thanks in advance!

Can a Linux box be configured with IEEE 802.1x while retrieving information from a Windows box?

A managed Windows device can join my company's wired network, unlike a personal Linux device.

As far as I know, this is possible thanks to the IEEE 802.1x standard.

Looking at the configuration, a computer certificate is used and I have successfully accessed the private key located under ...MicrosoftCryptoRSAMachineKeys and its corresponding certificate.

The questions are:

  1. Is this possible given these elements?
  2. The private key seems to be in a binary format that I don't recognize, it should probably be converted to a DER / PEM format for the Linux NetworkManager? If so, how?

mysql – Find the next due date by excluding weekends and holidays in php by retrieving the value from the same table and inserting it into it

i just used this code and its not working

get value from the table

        $sql = "SELECT Nextactiondate FROM pr_trial_test WHERE SLNO='12'";

         $result = mysqli_query($conn,$sql);

         if (mysqli_num_rows($result)>'0') {
            while($row = mysqli_fetch_assoc($result)) {

Holiday table

                $action_date_2 = '$sql';
                $holidays = ('(2020-01-04','2020-01-05','2020-01-11','2020-01-12','2020-01-18','2020-01-19','2020-01-25','2020-01-26','2020-02-01','2020-02-02','2020-02-08',
2020-09-05','2020-09-06','2020-09-12','2020-09-13','2020-09-19','2020-09-20','2020-09-26',' 2020-09-27','2020-10-03','2020-10-04','2020-10-10','2020-10-11','2020-10-17','2020-10-18','

                                $i ='1';
                            $nextactiondate2 = date('Y-m-d',strtotime('$action_date_2'.'+30 Weekday'));

verification of the calculation of the due date
$ date = date (& # 39; Y-m-d & # 39 ;, strtotime (& # 39; $ action_date_2 & # 39 ;. & # 39; + 30 Weekday & # 39;));

       $nextactiondate2 = date('Y-m-d', strtotime($action_date_2.' +'.$i.' weekdays'));

                            $date= date('Y-m-d',strtotime($action_date_2));
                    $sql="UPDATE pr_trial_test SET nextactiondate2='$nextactiondate2' WHERE SLNO='12'";

echo "table inserted successfully";
            echo "0 results";

table successfully inserted.

But there is no change in the table.

excel – Error retrieving name of immediately preceding sheet

I am trying to retrieve the value that is in a leaf cell just before the sheet I'm on, that is, from which I want to launch the code. Because the name of the sheet just above may be different, depending on the Excel book I'm in to run this code.
It gives me an error that the qualifier must be a collection, as if the variable which was to retrieve the name of the previous page did not recognize me. The error marks me in the exclamation mark.

Under Macro1 ()

Dim nombrehojaanterior As String
nombrehojaanterior = Workbook.Worksheets.Previous.Name
Range("B1").Value = nombrehojaanterior!H2

End Sub