Code snippet to display ID gives critical error

Based on this post, I added the code snippet below to my WordPress site, as to display the ID in the Posts section of each post. However, it returns "critical error". Any idea what is wrong with this code?

add_filter( 'manage_posts_columns', 'column_register_wpse_101322' ); add_filter( 'manage_posts_custom_column', 'column_display_wpse_101322', 10, 3 );  function column_register_wpse_101322( $  columns ) {     $  columns['uid'] = 'ID';     return $  columns; }  function column_display_wpse_101322( $  empty, $  column_name, $  post_id ) {     if ('uid' != $  column_name) {return $  empty;}     return "$  post_id"; } 

what will be space complexity for snippet for(i=1 to n) int x=10;?

The space complexity of the code snippet given below-

int *a=malloc(n*sizeof(int)); int sum=0; for(i=0;i<n;i++) { scanf("%d",&a[i]); for(j=0;j<n;j++) { int x=a[i]; sum=sum+x; } } free(a); 

This is question of a test. I answered it O(n), considering space only for array and constant space for rest of the code. But in the answer they given O(n^2) and there explanation is "The array is of size n and the inner most loop we are declaring a variable x every time the loop is executed, this loop is executed O(n^2) time hence overall space complexity is O(n^2)." Now my doubt is what should be space complexity of

for(i=1;i<=n;i++)    int x=10; 

What i thought is that it should be O(1) because in each iteration variable x gets destroyed. Please someone help me…i searched but found nothing satisfactory.

Sharepoint 2013 Document last modified date code snippet

I am using sharepoint 2013. I have a page that does not show the document library itself, but has links to documents within it. Next to the link I would like to show the date the document was last modified for each file. See imageScreenshot of the links

The text is not a link, just the PDF is a link to a file with in a document library. They are not all in the same library though, some are on other sharepoint 2013 sites, that I own as well.

Is this even possible? I have been searching for a few days, but have not found anything close to what I am looking to do. Most of what I am finding is related to getting the date in applications outside of sharepoint.

getMediaGalleryImages() for rich snippet structured data

currently, it is only add one image to the structured data via

'image'       => $  this->getUrl('pub/media/catalog') . 'product' . $  currentProduct->getImages(), 

.i’m looking to add all media images to structured data for product page. I tried it this way but didn’t seem to work.

'image'       => $  this->getUrl('pub/media/catalog') . 'product' . $  currentProduct->getMediaGalleryImages(), 

the multiple images should be send in an array like this

"image": [   "https://example.com/photos/1x1/photo.jpg",   "https://example.com/photos/4x3/photo.jpg",   "https://example.com/photos/16x9/photo.jpg" ] 

Here is partial of the code

public function showProductStructuredData() { if ($ currentProduct = $ this->getProduct()) { try { $ productId = $ currentProduct->getId() ? $ currentProduct->getId() : $ this->request->getParam(‘id’);

        $  product = $  this->productFactory->create()->load($  productId);         $  availability = $  product->isAvailable() ? 'InStock' : 'OutOfStock';         $  stockItem = $  this->stockState->getStockItem(             $  product->getId(),             $  product->getStore()->getWebsiteId()         );         $  priceValidUntil = $  currentProduct->getSpecialToDate();         $  productStructuredData = [             '@context'    => 'http://schema.org/',             '@type'       => 'Product',             'name'        => $  currentProduct->getName(),             'description' => trim(strip_tags($  currentProduct->getShortDescription())),             'sku'         => $  currentProduct->getSku(),             'mpn'         => $  currentProduct->getSku(), //added 7-30-2019                            'url'         => $  currentProduct->getProductUrl(),             'image'       => $  this->getUrl('pub/media/catalog') . 'product' . $  currentProduct->getImages(),             'brand'       => 'mybrand', //added 7-30-2019             'offers'      => [                 '@type'         => 'Offer',                 'priceCurrency' => $  this->_storeManager->getStore()->getCurrentCurrencyCode(),                 'price'         => $  currentProduct->getPriceInfo()->getPrice('final_price')->getValue(),                 'itemOffered'   => $  stockItem->getQty(),                 'itemCondition' => 'New', //added 7-30-2019                 'url'           => $  currentProduct->getProductUrl(), //added 7-30-2019                 'availability'  => 'http://schema.org/' . $  availability             ]         ];         $  productStructuredData = $  this->addProductStructuredDataByType($  currentProduct->getTypeId(), $  currentProduct, $  productStructuredData);          if (!empty($  priceValidUntil)) {             $  productStructuredData['offers']['priceValidUntil'] = $  priceValidUntil;         }          if ($  this->getReviewCount()) {             $  productStructuredData['aggregateRating']['@type'] = 'AggregateRating';             $  productStructuredData['aggregateRating']['bestRating'] = 100;             $  productStructuredData['aggregateRating']['worstRating'] = 0;             $  productStructuredData['aggregateRating']['ratingValue'] = $  this->getRatingSummary();             $  productStructuredData['aggregateRating']['reviewCount'] = $  this->getReviewCount();         }          $  objectStructuredData = new \Magento\Framework\DataObject(['mpdata' => $  productStructuredData]);         $  this->_eventManager->dispatch('mp_seo_product_structured_data', ['structured_data' => $  objectStructuredData]);         $  productStructuredData = $  objectStructuredData->getMpdata();          return $  this->helperData->createStructuredData($  productStructuredData, '<!-- Product Structured Data by Mageplaza SEO-->');     } catch (\Exception $  e) {         $  this->messageManager->addError(__('Can not add structured data'));     } } 

}

Disable Edit WebPart and/or Snippet link in a Script Editor Web Part on SharePoint Page?

I know it can be done with client side coding, but maybe there is a built in way to do this in SharePoint 2013. I have a web part I share with other sites, but do not want site administrators seeing or editing the web part contents through the normal sharepoint page edit UI > Edit Web Part > Edit Snippet.

Might it there be a switch in the webpart xml to disable that?
Possible to create a new or change the web part type that does not have the Edit Snippet feature?

this is the Web Part XML source of a very simple web part anybody with site admin rights on the site can edit via the UI.

enter image description here

enter image description here

    <webParts>   <webPart xmlns="http://schemas.microsoft.com/WebPart/v3" Gr="Test">     <metaData>       <type name="Microsoft.SharePoint.WebPartPages.ScriptEditorWebPart, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />       <importErrorMessage>Cannot import this Web Part.</importErrorMessage>     </metaData>     <data>       <properties>         <property name="ExportMode" type="exportmode">None</property>         <property name="HelpUrl" type="string" />         <property name="Hidden" type="bool">False</property>         <property name="Description" type="string">JCP 68 TEST</property>         <property name="Content" type="string">         &lt;H1&gt;HELLO THIS IS A TEST&lt;/H1&gt;         </property>         <property name="CatalogIconImageUrl" type="string">/_layouts/images/wp_pers.gif</property>         <property name="Title" type="string">JCP 68 </property>         <property name="AllowHide" type="bool">False</property>         <property name="AllowMinimize" type="bool">False</property>         <property name="AllowZoneChange" type="bool">True</property>         <property name="TitleUrl" type="string" />         <property name="ChromeType" type="chrometype">None</property>         <property name="AllowConnect" type="bool">True</property>         <property name="Width" type="unit" />         <property name="Height" type="unit" />         <property name="HelpMode" type="helpmode">Navigate</property>         <property name="AllowEdit" type="bool">False</property>         <property name="TitleIconImageUrl" type="string" />         <property name="Direction" type="direction">NotSet</property>         <property name="AllowClose" type="bool">False</property>         <property name="ChromeState" type="chromestate">Normal</property>       </properties>     </data>   </webPart> </webParts> 

What happens in this code snippet with the Applet class?

Can someone help me understand what is happening in this code?

public class aClass extends Applet{     public void paint(Graphics g){         g.drawRect(0, 0, 400, 200);     } } 

My understanding is this, I create a class of name aClass that inherit(because it becomes a daughter) methods and attributes of the Applet class; then overwrites the paint method(which had been inherited from Applet), and this method expects an object as a parameter (which we put name g) created from the class Graphics, and then we call the drawRect method that is proper to the g object (which was created from the Graphics class); so that when the aClase class is executed, a rectangle is drawn, is it like that?

How does calling a function within a function work in this snippet of python code?

I am trying to parse a json input that is basically a dictionary within a dictionary. From suggestions and input from others, this seems to work but I have no idea how I can troubleshoot it to understand it better.

I tried returning myprint, but it doesn’t really show me how it is iterating through the nested dictionary.

#!/usr/bin/env python3  def myprint(d, apistring, url):     for k, v in d.items():         if isinstance(v, dict):             **myprint(v, apistring, url)**         else:            if apistring in v:               print("{0}{1}".format(url, v))  def main():     apistring = "/api/"     url = "https://example.com"       input_text = {"country": {"china": "/api/v1/china/", "canada": "/api/v1/china/canada/"}, "continent": {"asia": "/api/v1/asia/", "africa": "/api/v1/asia/africa/"}, "islands": {"madagascar": "/api/v1/madagascar/", "palau": "/api/v1/madagascar/palau/"}}      myprint(input_text, apistring, url)  if __name__ == '__main__':     main() 

Output:

  • https://example.com/api/v1/china/
  • https://example.com/api/v1/china/canada/
  • https://example.com/api/v1/asia/
  • https://example.com/api/v1/asia/africa/
  • https://example.com/api/v1/madagascar/
  • https://example.com/api/v1/madagascar/palau/