Drupal 8 entity browse

I want to install videos on my Drupal 8 website and have created a content type and a video field. I can upload a video with the entity navigation module on Drupal, but when I download a video from FileZilla, I can not see it.

Hardware – Browse the data on the hard drive of the old computer, without booting the computer or removing the hard drive?

For my current laptop, I have a 2017 MBP under OSX 10.14.

I have twice as many old Mac laptops on which I want to get data, one of them is a 2007 Macbook and the other a 2004 iBook.

In addition to disassembling them, removing the hard drives and placing them in an enclosure, is this a way to browse the data from these older laptops, from my current computer? Maybe by connecting my current computer to the old via USB? If so, should old laptops be turned on?

Thematization – How can I browse all types of article content and get the content of each

I have created new article content and replaces it by creating a template (eg: node – 4.html.twig).

Then, inside this model, I want to browse all the nodes belonging to the type of article content. and to achieve this, I created my .theme file and added the following code depending on the answer to this question here:

condition('type', 'article')->execute();
  $nodes = DrupalnodeEntityNode::loadMultiple($articles);  
  $variables('articles') = $nodes;

But when I do:

{{ kint(articles) }}

inside my template and I will refresh the page, I show the article as NULL.

How can I browse articles?


None of the following works:

function capoeira_preprocess_page(&$variables) {
  $articles = Drupal::entityQuery('node')->condition('type', 'article')->execute();
  $nodes = DrupalnodeEntityNode::loadMultiple($articles);
  $variables('name') = $nodes;

function capoeira_preprocess_node(&$variables){
  $variables('name') = 'My name comes here';

function capoeira_preprocess_node_article(&$variables){
  $variables('name') = 'My name comes here';

plugin development – How to browse custom posts and add the title to a table

The main problem is that you have to use get_the_title() instead of the_title() in your code, like the_title() is repeated and can not be set to a variable.

It appears that you want your collection locations (custom message type) to be displayed in a drop-down field (or radio buttons) on the WooCommerce payment page.

You can also simply use get_posts() works as:

add_action('woocommerce_after_order_notes', 'custom_checkout_field');

function custom_checkout_field( $checkout ) {

    $pickup_points = (array) get_posts( array(
        'post_type'         => 'pickup-point',
        'posts_per_page'    => -1,
        'post_status'       => 'publish'
    ) );

    if ( count( $pickup_points ) > 0 ) {

        $available_locations = (); // Initializing

        // Loop though each 'pickup-point' WP_Post object
        foreach ( $pickup_points as $pickup_point ) {
            // Set current post title in the array
            $available_locations() = $pickup_point->post_title;

        // testing output
        var_dump ($available_locations);

Or if you keep a WP_Query:

add_action('woocommerce_after_order_notes', 'custom_checkout_field');

function custom_checkout_field( $checkout ) {

    // Custom query to pull in the pickup points.
    $query = new WP_Query( array(
        'post_type'         => 'pickup-point',
        'posts_per_page'    => -1,
        'post_status'       => 'publish'
    ) );

    $available_locations = (); // Initializing

    // Check that we have query results.
    if ( $query->have_posts() ) :

    $available_locations = (); // Initializing

    while ( $query->have_posts() ) : $query->the_post();

    $available_locations() = get_the_title(); // Set the current title in the array


    // testing output
    var_dump ($available_locations);



Both should work the same way.

filesystems – Browse files on a partially formatted drive

I therefore brought in a client for data recovery when an installation failure resulted in a partial loss of data.

When booting to a USB stick live on the machine, the drive appears with lsblk as the correct size for the actual player, df can find the drive but shows the partition as 7.8G instead of the real ~120G.

Here are the results of lsblk

sdc      8:32   0 119.2G  0 disk

And here is the result of df -h dev/sdc

Filesystem      Size  Used Avail Use% Mounted on
udev            7.8G     0  7.8G   0% /dev

Is it possible to mount the drive or just browse the files to see what I can recover before properly formatting the drive and reinstalling the operating system?

python – Browse 2 large Raster tables and subtract each block

I have two big rasters that I have to subtract one from the other to get the difference. Raster dies are too large to fit in memory. I therefore need to read them in blocks and subtract them.

So, I think I'm able to read each image as a table block, but I do not see how to subtract them.

image1 = '/vsimem/array_size_new.vrt'
image2 = '/vsimem/array_size_old.vrt'

new_image = gdal.Open(image1)
old_image = gdal.Open(image2)

raster_xsize = new_image.RasterXSize
raster_ysize = new_image.RasterYSize

def myfunc(large_raster_file):
    in_ds = gdal.Open(large_raster_file, gdal.GA_ReadOnly)
    in_band = in_ds.GetRasterBand(1)
    block_xsize, block_ysize = in_band.GetBlockSize()
    print("Start reading")
    for b_y, yoff in enumerate(range(0, in_ds.RasterYSize, block_ysize)):
        for b_x, xoff in enumerate(range(0, in_ds.RasterXSize, block_xsize)):
            win_xsize, win_ysize = in_band.GetActualBlockSize(b_x, b_y)
            img_arr = in_band.ReadAsArray(xoff=xoff, yoff=yoff, 
                    win_xsize=win_xsize, win_ysize=win_ysize)
            return img_arr

Then I should do something like

image_Change = myfunc(new_image)-myfunc(old_image)
print (image_Change)

This is obviously incorrect, I think it gives an idea of ​​what I am trying to accomplish.

My result would ideally be a combined picture of the differences between the other two tables.

Browse a table line by line in python

I have the following code:

for link in soup.find_all("td", class_="textleft",limit=30):
    a = link.find('a').attrs('href')

It sends me 30 objects:


So, up to 30 results because I can get each result in a variable, performing an iteration with each result, one by one, for example

var 1 = /SOTRAFA.html
var 2 = /AGROPONIENTE.html

How to create a GUI to browse Google Drive and apply a Google Apps script to the chosen file?

I have a Google Apps script code that creates PDF files from data contained in a Google spreadsheet.
I've created this code for personal use: I use it to jot down the papers of my students and send them the results.

I am by no means a professional programmer and my code can certainly be optimized. However, even un-optimized as it is, it saves me a lot of work.

For this reason, some colleagues were interested in my "system", so I tried to share my code with them.
The problem is that they are even less expert than me and that all these lines of code frighten and confuse them.

In fact, they do not need to see or understand the code. They should only provide the file ID of the target spreadsheet and the destination folder, where all PDF files are created, plus a set of data (such as the number of students in the class , etc.).

It would be interesting to create a graphical user interface that allows them to simply browse their Google Drive and choose the spreadsheet and the output folder.

I do not know if this can be done and how.

I did some research and I proposed two possibilities.

  • the user interface service of Google Apps Script. However, this is deprecated since 2014. It has been replaced by the HTML service, but I do not know how to use it to navigate Google Drive.
  • Google Picker, this seems to be what I need. However, it is an API for HTML pages and requires the registration of a project. I do not know exactly how I'm going to do it. As I said, I simply need a simple user interface for my colleagues, and Google Picker may have too much for it.

My apologies for being so vague. As I said, I'm not a professional coder and I have no idea about this business.

I would really appreciate some suggestions. It would be great if someone could give me a tutorial or an example.

Thank you very much in advance


Server Hunter – Easily browse thousands of virtual and dedicated servers from hundreds of vendors

Server Hunter is an online platform for finding and comparing virtual and dedicated server packages from hundreds of hosting providers. Offers and prices are automatically retrieved and updated every 24 hours. Visit us at serverhunter.com.

Now you can easily search and compare thousands of virtual, hybrid and dedicated servers from hundreds of vendors. Learn more about Server Hunter: https://www.serverhunter.com/about/.

performance – The best and most efficient way to browse files using Excel VBA

I have a procedure to browse all the files of folders and subfolders from a folder that the user can select. The user can select both source and target folders. I use Excel VBA for this. Spreadsheets contain all or some of the file names to look for.

It works like this. I have function GetFiles which returns a string (including the path) separated by a pipeline (|). Then, I browse all the cells in column A containing the file name (or part of it) to search for. the GetFiles browses all the folders and subfolders of the selected source path. It takes longer if a high level of the source folder is selected.

The main function looks like this:

Under MoveFilesToFolder ()

Dim filePath As String: filePath = ""
Dim moveToPath As String: moveToPath = ""
Dim filename as a string
Dim fileNameFront As String
Dim fileNameRear As String
Dim currentFileName As String
Dim cell As Range
Dim fileCopied As Boolean: fileCopied = False
Dim i as an integer
Sun J also long
Dim StartTime As Double
Dim SecondsElapsed As Double
Dim result As String
Dim ws as sheet sheet
Dim frm As ufImageSearcher

ExactMatch = True
OverwriteExistingFile = False

Application.DisplayAlerts = False
Application.ScreenUpdating = False

On Error GoTo ErrorHandling

If (wsExists ("Images")) then

fileNameString = ""

& # 39; filePath = InputBox ("File Path, Close with Backslash ()", "Source Folder", ActiveWorkbook.Path)
& # 39; moveToPath = InputBox ("File copy path in! Close with backslash ()", "Target folder", ActiveWorkbook.Path & " copy ")

filePath = GetFolderPath ("Bron directory")
If (IsStringEmpty (filePath)) then
Output under
End if
moveToPath = GetFolderPath ("Doel directory")
If (IsStringEmpty (moveToPath)), then
Output under
End if

If not (IsStringEmpty (filePath) or IsStringEmpty (moveToPath)), then

If ((FolderExists (filePath)) And _
(FolderExists (moveToPath))) And (filePath <> moveToPath) Then

If Right (moveToPath, 1) <> "" Then
moveToPath = moveToPath & ""
End if

If (Dir (moveToPath & "*. *") <> ""), Then
result = MsgBox (moveToPath & "contains files! Choose an empty folder!" & _
vbCrLf & vbCrLf & "Go to the folder:" & moveToPath & "?", vbYesNo + vbQuestion, "Result!")
If (result = vbYes) Then
OpenFolderInExplorer (moveToPath)
End if
Output under
End if

wsActivate ("Images")
Set frm = New ufImageSearcher

With frm
.lblSource.Caption = file_path
.lblTarget.Caption = moveToPath

If .Tag <> "Canceled" Then
ExactMatch = .cbxExactMatch.Value
OverwriteExistingFile = .cbxOverwrite.Value
Output under
End if
Finish by

Start time = Timer

& # 39; Retrieves all files, including the path, separated by a pipeline.
GetFiles (filePath)

If not (IsStringEmpty (fileNameString)), then
Dim imgArray As Variant: imgArray = Split (fileNameString, "|")
& # 39; Column A contains all the strings used to compare the files found from the GetFiles function
For each cell in ActiveSheet.Range ("A1: A" & Range ("A1"). End (xlDown) .row)
fileCopied = False
filename = Mid (cell.Value, lastpositionOfChar (cell.Value, "/") + 1, Len (cell.Value))

Application.StatusBar = "(File Nbr:" & CStr (UBound (imgArray)) & ")"

If not (IsStringEmpty (filename)), then
For i = LBound (imgArray) to UBound (imgArray)
If not (IsStringEmpty (CStr (imgArray (i)))), then
If ExactMatch Then
If (GetFileName (imgArray (i)) = file name), then
If DoesFileExist (moveToPath & GetFileName (imgArray (i))) and do not overwrite the existing file
FileCopy imgArray (i), moveToPath & GetFileName (imgArray (i)) & "-" & Format (now, "yyyymmddhhmmss")
FileCopy imgArray (i), moveToPath & GetFileName (imgArray (i))
End if
fileCopied = True

If fileCopied then
ActiveSheet.Range ("B" & cell.row) .Value = imgArray (i)

For J = 2 to 15
Dim newFileName As String
newFileName = CreateFileName (CStr (imgArray (i)), LeadingZeroString (J))
If not (IsStringEmpty (newFileName)), then
If (DoesFileExist (newFileName)), then
If not (IsFileOpen (newFileName)), then
FileCopy newFileName, moveToPath & Right (newFileName, Len (newFileName) - lastpositionOfChar (newFileName, "") + 1)
ActiveSheet.Range (GetColLetter (J + 1) & cell.row) .Value = newFileName
ActiveSheet.Range (GetColLetter (J + 1) & cell.row) .Font.Color = RGB (0, 102, 0)
End if
ActiveSheet.Range (GetColLetter (J + 1) & cell.row) .Value = "(Niet aanwezig)" & Right (newFileName, Len (newFileName) - lastpositionOfChar (newFileName, "") + 1)
ActiveSheet.Range (GetColLetter (J + 1) & cell.row) .Font.Color = RGB (255, 153, 51)
End if
End if
Next J
End if
End if
If (InStr (1, GetFileName (imgArray (i)), filename, vbTextCompare)> 0), and then
If not (IsFileOpen (CStr (imgArray (i)))), then
If DoesFileExist (moveToPath & GetFileName (imgArray (i))) and do not overwrite the existing file
FileCopy imgArray (i), moveToPath & GetFileName (imgArray (i)) & "-" & Format (now, "yyyymmddhhmmss")
FileCopy imgArray (i), moveToPath & GetFileName (imgArray (i))
End if
fileCopied = True

& # 39; Find the first empty columnid.

lCol = Cells (cell.row, Columns.Count) .End (xlToLeft) .Column
ActiveSheet.Cells (cell.row, lCol + 1) .Value = imgArray (i)
End if
End if

End if
End if
Then I
If not copied then
ActiveSheet.Range ("B" & cell.row) .Value = "** NOT FOUND **"
ActiveSheet.Range ("B" & cell.row) .Font.Color = RGB (250, 0, 0)
End if
End if
End if

Sheets ("Images"). Columns ("B: Z"). Automatic adjustment
SecondsElapsed = Timer - Start Time

Application.DisplayAlerts = True
Application.ScreenUpdating = True

result = MsgBox ("Date Exported in:" & moveToPath & vbCrLf & "This was done in:" & Format (SecondsElapsed / 86400, "hh: mm: ss") & "seconds." & _
vbCrLf & vbCrLf & "Go to the folder:" & moveToPath & "?", vbYesNo + vbQuestion, "Result!"
If (result = vbYes) Then
OpenFolderInExplorer (moveToPath)
End if

If not (FolderExists (filePath)) then
MsgBox (filePath & ": the path is niet gevonden!")
End if
If not (FolderExists (moveToPath)), then
MsgBox (moveToPath & ": Path is niet gevonden!")
End if
End if
MsgBox ("No source and / or target selected" & vbCrLf & _
"Source:" & filePath & vbCrLf & _
"Target:" & moveToPath)
End if
MsgBox ("This procedure expects a worksheet" Images & # 39; "& vbCrLf & _
"and the name or part of the name of the image to be found in column A")
End if
If (IsObject (ws)) Then
Set ws = Nothing
End if

Application.DisplayAlerts = True
Application.ScreenUpdating = True
Output under
Error handling:
MsgBox ("An error has occurred! (" & Err.Description & ")")
End Sub

The GetFiles function looks like:

Sub GetFiles (ByVal path as a string)

On Error GoTo ErrorHandling
Dim fso As Object: Define fso = CreateObject ("Scripting.FileSystemObject")
Dim As Object folder: Set folder = fso.GetFolder (path)

Dim subfolder as object
Dim file as object

For each subfolder in folder.SubFolders
GetFiles (subfolder.path)
Subfolder next

For each file in folder.Files
fileNameString = fileNameString & file.path & "|"
Next file

Set fso = Nothing
Define the folder = nothing
Set the subfolder = Nothing
Set file = Nothing

Output under

Error handling:
MsgBox ("An error has occurred! (" & Err.Description & ")")
End Sub

Everything works, but the execution can take a long time, especially when the selected source folder contains a lot of folders and subfolders.

To give you an idea, it takes 13 minutes to compare 100 rows of column A with 10 000 files found. The average loop 100 x 10,000 = 1 million times.

I have two questions:

  1. Is there a more efficient way to do this with Excel VBA?
  2. Is the DoEvents function used correctly?