Managed Property for counting document views

I’m working with a custom search solution on SharePoint Online using the modern experience. I’m hoping to be able to sort the results from this based on the number of views per document (i.e. the documents relative popularity). Is there a managed property i can use to sort on? Or will i have to do a REST call of some sort? Any help is appreciated. Thanks

Environment variable in whm managed apache virtual host

I have an EC2 with CentOS, cpanel and whm installed.

I have multiple accounts, linked with different subdomains. I have same php application deployed in the virtual hosts.

I need to use environment variables, with different values in for different virtual hosts.

For testing, I created a php file with

<?php     echo getenv("MYVAR"); ?> 

So far, I have tried setting the environment variables in

  1. /etc/apache2/conf.d/userdata/std/2_4/user/sub.domain.com/env.conf
  2. httpd.conf even though I’m not supposed to
  3. .htaccess because I was desperate

I enabled mod_env from EasyApache from whm.
apachectl -M shows env_module (shared) though I’m not sure if its the same thing.

My userdata file just contained SetEnv MYVAR myvalue, I could not find a single example whether this was right or wrong.

After that, I did /scripts/ensure_vhost_includes --all-users and it added the include statement in httpd.conf. I restarted httpd service, it didnt help.

I even tried /scripts/rebuildhttpdconf, it didnt help.

How can I check if the managed property contains value?

I have created a managed property in Central Admin which is mapped to Start Date crawled property. These are the settings which I have set on my managed property:

  1. Type: Date and Time
  2. Queryable: true
  3. Retrievable: true
  4. Refinable: true
  5. Sortable: true
  6. Mapped crawled Property: ows_q_DATE_StartDate

There is data in the lists, but the managed property does not return any values back. It is always empty.

Managed Vulkan API Wrapper (create/destroy an instance)

I’m trying to follow this Vulkan API tutorial and have come up with an implementation that I don’t completely loathe. The VkUtf8StringArray class is my least favorite thing and would like to know if there are better ways I structure things and/or make them safer…

Note: Depends on a helper file to load the dll at run-time.

Full Code:

using ByteTerrace.Windows.Api; using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text;  namespace ByteTerrace.Vulkan.Api {     public sealed class VkAccessor : IDisposable     {         private static bool TryGetProcAddrDelegate<TDelegate>(IntPtr procAddress, out TDelegate @delegate) {             if (IntPtr.Zero == procAddress) {                 @delegate = default;                  return false;             }             else {                 @delegate = Marshal.GetDelegateForFunctionPointer<TDelegate>(procAddress);             }              return true;         }          public static int MakeVersion(int major, int minor, int patch) => (((major) << 22) | ((minor) << 12) | (patch));          private delegate IntPtr vkGetInstanceProcAddr(IntPtr instance, IntPtr pName);          private readonly vkGetInstanceProcAddr m_vkGetInstanceProcAddr;         private readonly IntPtr m_vkHandle;          private bool m_isDisposed;          public VkAccessor(string dllName) {             m_isDisposed = false;              if (!Module.TryGetModule(dllName, out m_vkHandle)) {                 throw new Exception(message: "unable to load the specified Vulkan DLL module");             }              if (!Module.TryGetDelegateForFunctionPointer(m_vkHandle, nameof(vkGetInstanceProcAddr), out m_vkGetInstanceProcAddr)) {                 throw new Exception(message: "unable to find an entry point for the vkGetInstanceProcAddr procedure");             }         }         ~VkAccessor() => Dispose(false);          private void Dispose(bool disposing) {             if (m_isDisposed) {                 return;             }             else {                 if (disposing) {                     // no managed resources to free...                 }                  if (!Module.FreeLibrary(m_vkHandle)) {                     throw new Exception(message: "unable to free the Vulkan DLL module handle");                 }                  m_isDisposed = true;             }         }         private IntPtr GetInstanceProcAddr(IntPtr instance, string procedureName) {             if (string.IsNullOrEmpty(procedureName)) {                 throw new ArgumentException(message: "name cannot be null or empty", paramName: nameof(procedureName));             }              using (var vkProcedureName = VkUtf8String.New(procedureName)) {                 return m_vkGetInstanceProcAddr(instance, vkProcedureName.Handle);             }         }          public void Dispose() {             Dispose(true);             GC.SuppressFinalize(this);         }         public bool TryGetGlobalProcDelegate<TDelegate>(string procedureName, out TDelegate @delegate) => TryGetProcAddrDelegate(GetInstanceProcAddr(IntPtr.Zero, procedureName), out @delegate);         public bool TryGetInstanceProcDelegate<TDelegate>(IntPtr instance, string procedureName, out TDelegate @delegate) => TryGetProcAddrDelegate(GetInstanceProcAddr(instance, procedureName), out @delegate);     }     public sealed class VkInstance : IDisposable     {         private delegate VkResult vkCreateInstance(ref VkInstanceCreateInfo pCreateInfo, IntPtr pAllocator, out IntPtr pInstance);         private delegate void vkDestroyInstance(IntPtr instance, IntPtr pAllocator);          private readonly vkCreateInstance m_vkCreateInstance;         private readonly vkDestroyInstance m_vkDestroyInstance;         private readonly IntPtr m_vkInstanceHandle;          private bool m_isDisposed;          public VkInstance(VkAccessor vkAccessor, ref VkInstanceCreateInfo vkInstanceCreateInfo) {             if (!vkAccessor.TryGetGlobalProcDelegate(nameof(vkCreateInstance), out m_vkCreateInstance)) {                 throw new Exception(message: "unable to create a global Vulkan delegate for the vkCreateInstance procedure");             }              var createInstanceResult = m_vkCreateInstance(ref vkInstanceCreateInfo, IntPtr.Zero, out IntPtr vkInstanceHandle);              if ((VkResult.VK_SUCCESS == createInstanceResult) && vkAccessor.TryGetInstanceProcDelegate(vkInstanceHandle, nameof(vkDestroyInstance), out m_vkDestroyInstance)) {                 m_vkInstanceHandle = vkInstanceHandle;             }         }         ~VkInstance() => Dispose(false);          private void Dispose(bool disposing) {             if (m_isDisposed) {                 return;             }             else {                 if (disposing) {                     // no managed resources to free...                 }                  m_vkDestroyInstance(m_vkInstanceHandle, IntPtr.Zero);                  m_isDisposed = true;             }         }          public void Dispose() {             Dispose(true);             GC.SuppressFinalize(this);         }     }     public sealed class VkUtf8String : IDisposable     {         public static VkUtf8String New(string value) => new VkUtf8String(value);          private readonly IntPtr m_handle; #if (DEBUG)         private readonly string m_value; #endif          private bool m_isDisposed;          public IntPtr Handle {             get {                 if (m_isDisposed) {                     return IntPtr.Zero;                 }                 else {                     return m_handle;                 }             }         } #if (DEBUG)         public string Value {             get {                 if (m_isDisposed) {                     return null;                 }                 else {                     return m_value;                 }             }         } #endif         private unsafe VkUtf8String(string value) {             if (value == null) {                 m_handle = IntPtr.Zero;             }             else {                 value = (value + char.MinValue);                  var length = value.Length;                 var maxByteCount = Encoding.UTF8.GetMaxByteCount(length);                 var valueCopyHandle = Marshal.AllocHGlobal(maxByteCount);                 var valueCopySpan = new Span<byte>(valueCopyHandle.ToPointer(), maxByteCount);                  Encoding.UTF8.GetBytes(value, valueCopySpan);                  m_handle = valueCopyHandle;             }              m_isDisposed = false; #if (DEBUG)             m_value = value; #endif         }         ~VkUtf8String() => Dispose(false);          private void Dispose(bool disposing) {             if (m_isDisposed) {                 return;             }             else {                 if (disposing) {                     // no managed resources to free...                 }                  Marshal.FreeHGlobal(m_handle);                  m_isDisposed = true;             }         }          public void Dispose() {             Dispose(true);             GC.SuppressFinalize(this);         } #if (DEBUG)         public override string ToString() => Value?.Substring(0, (Value.Length - 1)); #endif     }     public sealed class VkUtf8StringArray : IDisposable     {         public static VkUtf8StringArray New(params string[] values) => new VkUtf8StringArray(values);          private readonly int m_count;         private unsafe readonly IntPtr* m_handle;          private bool m_isDisposed;          public int Count => m_count;         public unsafe IntPtr* Handle {             get {                 if (m_isDisposed) {                     return null;                 }                 else {                     return m_handle;                 }             }         }          private unsafe VkUtf8StringArray(string[] values) {             if ((null == values) || (0 == values.Length)) {                 m_count = 0;                 m_handle = null;             }             else {                 var count = values.Length;                 var handle = ((IntPtr*)Marshal.AllocHGlobal(Unsafe.SizeOf<IntPtr>() * count));                  for (var i = 0; (i < count); i++) {                     handle[i] = VkUtf8String.New(values[i]).Handle;                 }                  m_count = count;                 m_handle = handle;             }              m_isDisposed = false;         }         ~VkUtf8StringArray() => Dispose(false);          private unsafe void Dispose(bool disposing) {             if (m_isDisposed) {                 return;             }             else {                 if (disposing) {                     // no managed resources to free...                 }                  if (null != m_handle) {                     for (int i = 0; (i < m_count); i++) {                         Marshal.FreeHGlobal(m_handle[i]);                     }                      Marshal.FreeHGlobal(new IntPtr(m_handle));                 }                  m_isDisposed = true;             }         }          public void Dispose() {             Dispose(true);             GC.SuppressFinalize(this);         }     }      public enum VkInstanceCreateFlags     {         VK_NONE = 0,     }     public enum VkResult     {         VK_SUCCESS = 0,     }     public enum VkStructureType     {         VK_STRUCTURE_TYPE_APPLICATION_INFO = 0,         VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 1,     }      [StructLayout(LayoutKind.Sequential)]     public struct VkApplicationInfo     {         public static VkApplicationInfo New(VkUtf8String applicationName, VkUtf8String engineName) => new VkApplicationInfo(applicationName.Handle, engineName.Handle);          public VkStructureType sType;         public IntPtr pNext;         public IntPtr pApplicationName;         public int applicationVersion;         public IntPtr pEngineName;         public int engineVersion;         public int apiVersion;          private VkApplicationInfo(IntPtr applicationName, IntPtr engineName) {             sType = VkStructureType.VK_STRUCTURE_TYPE_APPLICATION_INFO;             pNext = IntPtr.Zero;             pApplicationName = applicationName;             applicationVersion = VkAccessor.MakeVersion(1, 1, 0);             pEngineName = engineName;             engineVersion = VkAccessor.MakeVersion(1, 1, 0);             apiVersion = VkAccessor.MakeVersion(1, 1, 0);         }     }     [StructLayout(LayoutKind.Sequential)]     public struct VkInstanceCreateInfo     {         public unsafe static VkInstanceCreateInfo New(VkApplicationInfo* applicationInfo, VkUtf8StringArray enabledLayerNames, VkUtf8StringArray enabledExtensionNames) => new VkInstanceCreateInfo(             applicationInfo,             enabledLayerNames.Count,             enabledLayerNames.Handle,             enabledExtensionNames.Count,             enabledExtensionNames.Handle         );          public VkStructureType sType;         public IntPtr pNext;         public VkInstanceCreateFlags flags;         public unsafe VkApplicationInfo* pApplicationInfo;         public int enabledLayerCount;         public unsafe IntPtr* ppEnabledLayerNames;         public int enabledExtensionCount;         public unsafe IntPtr* ppEnabledExtensionNames;          public unsafe VkInstanceCreateInfo(VkApplicationInfo* applicationInfo, int enabledLayerCount, IntPtr* enabledLayerNames, int enabledExtensionCount, IntPtr* enabledExtensionNames) {             sType = VkStructureType.VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;             pNext = IntPtr.Zero;             flags = VkInstanceCreateFlags.VK_NONE;             pApplicationInfo = applicationInfo;             this.enabledLayerCount = enabledLayerCount;             ppEnabledLayerNames = enabledLayerNames;             this.enabledExtensionCount = enabledExtensionCount;             ppEnabledExtensionNames = enabledExtensionNames;         }     } } 

Example Usage:

using ByteTerrace.Vulkan.Api;  namespace TestBench {     unsafe class Program     {         static void Main(string[] args) {             using (var applicationName = VkUtf8String.New("ByteTerrace Vulkan API"))             using (var engineName = VkUtf8String.New("N/A"))             using (var enabledLayers = VkUtf8StringArray.New(null))             using (var enabledExtensions = VkUtf8StringArray.New("VK_KHR_surface", "VK_KHR_win32_surface")) {                 var applicationInfo = VkApplicationInfo.New(applicationName, engineName);                 var instanceCreateInfo = VkInstanceCreateInfo.New(&applicationInfo, enabledLayers, enabledExtensions);                  using (var vkAccessor = new VkAccessor("vulkan-1.dll"))                 using (var vkInstance = new VkInstance(vkAccessor, ref instanceCreateInfo)) {                     // TODO: Something useful once I bind more structures and methods...                 }             }         }     } }