Why Golang projects seldom use mocking library in testing?

New to golang and is now researching on how to do test in golang. I see that there are popular mocking library like gomock. However, at the same time, I see that large golang open source projects don’t use any mocking library at all. For example, geth (ETH miner), wire (dependency injection library) and sendgrid go client (for sending email) all choose not to use any mocking library.

Considering the fact that there is no class in golang, is it a practice that not to mock interface (which most mocking library did)? Should I just make the function to be tested as package variable and overwrite in test instead?

software – Looking for a desktop app to sort my photos library by face

I am looking for a desktop application that can index my local photo library and understand faces on its own. As a 2nd step I want to copy these found photos per each person into a separate folder. I am not looking for apps where I need to tag people first.

I believe Picasa was able to do that many years ago, but it no longer exists. I tried several new ones without success. I tried Google photos by uploading but it does not work with my account/country, there are many bugs reported around that. I am sure there must be a desktop application.

Any help or hints are appreciated. Thank you!

pnp powershell – Get Copy Link Value from Document Library Files

I am in the process of moving files to Sharepoint Online. Some of the files will have a share assigned to them (obtained via the ‘Copy Link’ option) in the format

https://myorg.sharepoint.com/:t:/s/mysite/SOME-lONg?StringOfCharsAndNumbers456778

I want to get a list of all links using the PnP Powershell Framework but cannot find the field in the ListItem or File object that contains the information. If i select the file in Sharepoint Online, i can see a link icon which has tooltip ‘1 link giving access’ in the ‘Has Access’ Info panel.

I can get the relative URL information (https://myorg.sharepoint.com/mysite/mydocs/folder1/test.txt)

My script is as follows:

#Get Credentials
$creds = Get-Credential -UserName $user -Message "Enter password."

#Connect
Connect-PnPOnline –Url $site –Credentials $creds

#Get All Items to see which one i want
Get-PnPListItem -List $docLibrary

#get more info for my test file which has ID = 295
$checkItem = Get-PnPListItem -List $docLibrary -Id 295

#See all field values for the check item
$checkItem.FieldValues

I cannot see the link information in any of the field values.

I have also tried the File object but again, cannot obviously see where the information is.

$checkFile = Get-PnpFile -Url $link

Note: the $link in the above line is the relative URL

Is this possible using the PnP Framework and do i just need to dig further into the object to get what i need or is it not possible.

Thanks

uploads – get_the_post_thumbnail() returning 404 for newly uploaded attachments in media library via thumbnail – filename discrepancy

Using get_the_post_thumbnail($post->ID,'thumbnail') to generate the thumbnails for a display. This was working for a very long time, but now we have switched an image on a post, and the URL returned from get_the_post_thumbnail($post->ID,'thumbnail') is now a 404 for the newly uploaded image whereas the other posts image attachments still work. This issue seems to be related to new media uploaded. All older media called from get_the_post_thumbnail() seems to be returning correctly and actually exists in the uploads directory.

get_the_post_thumbnail() is trying to return: /path/image-150x150.jpg(expected) which is causing a 404. Looking into the uploads directory, the thumbnails are generating but have a iterating suffix at the end of the filename. for example the thumbnails generated by WordPress look like this: /path/image-150x150-1.jpg, /path/image-150x150-2.jpg, ect, there is no /path/image-150x150.jpg

I have tried uploading unique media with an absolutely unique filename and the issue still remains. Does anyone have any idea what could be causing the media library to be generating thumbnails with this naming discrepancy?

.ods will open in read-only inside sharepoint online document library

we have a file with.ods extension, but when we try to edit it using the browser, we get this message and the file opens in read-only:-

enter image description here

is there a way to fox this?

Thanks

sharepoint online – Copy documents from document library A to document library B

I have a requirement to develop a solution based on SPFx, namely, copy main versions of a documents from document library A to document library B. I have tested copyto (PnP.js) but it only copies the latest version. This is not possible with copyByPath (destinationUrl, true, true);

For example, if a document has 5 versions (1.0, 2.0, 3.0, 4.0, 5.0), is it possible to copy 5 times, once version 1.0, etc. and overwrite and in this way keep version history? How?

All tips are really appreciated.

c++ – Error when trying to link to a shared library I created using LD_PRELOAD

I’m trying to test if I can override the glibc’s malloc interface by linking a shared library on Linux. I don’t have the details for the malloc functions yet.

So I created a nullmalloc.cpp that has the required replacements for malloc, but all returns null. The code looks like this:

# include <cstddef>

void* malloc(size_t size) { return 0; }
void* calloc(size_t n, size_t size) { return 0; }
void free(void* ptr) { return; }
void* realloc(void* ptr, size_t size) { return 0; }
void* valloc(size_t size) { return 0; }
void* memalign(size_t align, size_t s) { return 0; }
void cfree(void* ptr) { return 0; }
void* aligned_alloc(size_t align, size_t s) { return 0; }
void* pvalloc(size_t size) { return 0; }
struct mallinfo mallinfo(void);
int mallopt(int cmd, int value) { return 0; }

And then I tried to make a shared library of the cpp file by these commands:

gcc -Wall -fPIC -g -c nullmalloc.cpp // creates nullmalloc.o
gcc -shared -Wl,-soname,nullmalloc.so -o nullmalloc.so nullmalloc.o // creates nullmalloc.so

When I used LD_PRELOAD to link nullmalloc.so to a test code I wrote called test.cpp, I got an error saying that the .so file could not be found.

The command I used with LD_PRELOAD is this:

g++ -g test.cpp -o test.o -std=c++11 LD_PRELOAD=/home/nullmalloc/nullmalloc.so

And the error I got is this:

g++: error: LD_PRELOAD=/home/nullmalloc/nullmalloc.so: No such file or directory

I’m confused because the nullmalloc.so file exists when I use the ls command.

(root@a nullmalloc)$ ls
nullmalloc.cpp  nullmalloc.o  nullmalloc.so  test.cpp

I’ve only started studying about malloc, linux, and shared libraries, so I’m not sure where I’ve made a mistake. Could anyone give advice on where to start fixing?

Thank you.

How to create a custom elementor template library?

I found this website that says about a custom elementor template library.
LINK
.
But the code doesent’t work.So do can anyone tell me how to create a custom template library ?

PLEASE COMMENT WITHOUT DOWNVOTING IF YOU HAVE PROBLEMS

SharePoint 2013 Document Library – open pdfs in a new window & centre on screen

You can try opening the window with top and left parameters as shown below

<!DOCTYPE html>
<html>
<body>

<p>Click the button to open a new window with some specifications.</p>

<button onclick="myPopup('https://www.w3schools.com', 'web', 1100, 500);">Open Qries.com</button>

<script>

function myPopup(myURL, title, myWidth, myHeight) {

            var left = (screen.width - myWidth)/2;
            var top = (screen.height - myHeight)/4;           
            
            var myWindow = window.open(myURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + myWidth + ', height=' + myHeight + ', top=' + top + ', left=' + left);
         }



</script>

</body>
</html>

You can also check it here and geeks

Updating function openLinkinNewWindowForms() to open pdfs in a new windows.

Changes: New lines added and one existing line has been commented out.
Replace the entire function with the script provided here.
It has been verified with Chrome


function openLinkinNewWindowForms()
{
    //alert("clicked");
        
        //$("#onetidDoclibViewTbl0").find("a.ms-listlink.ms-draggable").each(function(){    

$(".ms-listlink").each(function(){  
//alert("inside function");     
    
if($(this).attr("href"))
{
    var targetValue=$(this).attr("href");

    //if(targetValue.indexOf(".aspx")>0)
        //{
            var anchorTag = $(this)(0);
            var linkUrl=anchorTag.href;
            anchorTag.removeAttribute("href");

            //**Begin new Lines of Code**
           
            var width=800;
            var height=600;
            var left = (screen.width - width)/2;
            var top = (screen.height - height)/4;
            var customClick =  "window.open('"+linkUrl+"','_blank','resizable=1,scrollbars=yes,height=600,width=800,modal=yes,alwaysRaised=yes" + ", top=" + top + ", left=" + left +"')";
           
           //**End of new Lines of Code**
            
            //**commented out this line
           //var customClick =  "window.open('"+linkUrl+"','_blank','resizable=1,scrollbars=yes,height=600,width=800,modal=yes,alwaysRaised=yes')";
                        //window.resizeTo( 1200,800 );
            anchorTag.setAttribute("onclick", customClick);
            anchorTag.setAttribute("style","cursor:pointer");
        //}
}
    });

}   


sharepoint online – Cannot edit Document Template of Library

today I tried to change my custom Document Template for one of my Sharepoint Librarys.
(So everytime someone click on new Excel File, he opens this template)
Unfortunately its not longer possible to modify the file, when I klick the Edit Button nothings happening. Problems occur on both Edge and IE, but the IE throws the following Error: Error Message in IE 11

Currently i am using IE 11 so that should be no problem.

Before writing this post I checked that I am still Owner of the Page.
All other Files can be open in the Browser like expected, the problem occurs only when editing a template file

Here in Edge when I try to click the Link nothings happening
Advanced Settings of Library