c++ – Binding Lua Function to Perform tasks using std::async

I am trying to load a bunch of mesh resources in the format of .obj files. Some of the files are very high in poly count so when loading using the below method It takes more than 10 seconds. I would really like to cut this time down.

My question is how can I bind this to call loadMesh with std::async? Because I think that might help speed up the process.

Mesh *Loader::loadMesh(const std::string &path)
{
    std::shared_ptr<Mesh> mesh = Mesh::load(path);

    m_meshes.push_back(mesh);

    return m_meshes.back().get();
}

.
.
.

//this is the binding 
    luabind::module(m_world->getLua()->get())
    (
        luabind::class_<Loader>("world")
            .def("load_mesh", &Loader::loadMesh)
    )


sharepoint server – Selected value from binding dropdownlist to enable controls

I have this code to fill drop down list from sharepoint list. what I want to do is once the user select ticket number from the drop down list there an invisible label will be visible. I have no issue with this code when selecting a value from non binding drop down list.

.cs

     protected void Page_Load(object sender, EventArgs e)
            {
                
              if (!IsPostBack)
                {
                    fillServiceTypesDropDownList();
                    
    
                  
                }
                
            }
        private void fillServiceTypesDropDownList()
                {
                    ddlServiceType.DataSource = ServiceTypes();
                    ddlServiceType.DataValueField = "ID";
              
                        ddlServiceType.DataTextField = "Title";
                    ddlServiceType.DataBind();
        
                }

protected void ddlServiceType_TextChanged(object sender, EventArgs e)
        {
            if (ddlServiceType.SelectedValue == "Ticket Number")
            {
                lblChngRqust.Visible = true;
                
            }
            else
            {
                lblChngRqust.Visible = false;

            }
        }

ascx

<asp:DropDownList runat="server" ID="ddlServiceType" Width="300px"  onchange="showchngReq()" OnTextChanged="ddlServiceType_TextChanged"></asp:DropDownList>
    
<asp:Label runat="server" ID="lblChngRqust" Visible="false" Text="please write the ticket number"></asp:Label>

javascript

 function showchngReq(){
    
            var chngrquest = document.getElementById('<%=lblChngRqust.ClientID%>');
            var serviceTypeDD = document.getElementById('<%=ddlServiceType.ClientID%>');
            var selectedSrvcTyp = serviceTypeDD.options(serviceTypeDD.selectedIndex).value;
    
            if (selectedSrvcTyp == "Ticket Number") {
                chngrquest.disabled = false;
               
    
            } else {
                chngrquest.disabled = true;
            }
    
        }

process algebras – Applied $pi$-calculus: Name binding and if clauses

Assume in the applied pi-calculus we have the following process:
$$(nu n)overline{c} langle n rangle.0 | (nu n) (c(y).(text{if n=y then P else Q}))$$
where $P$ and $Q$ are further processes.

I know that the following reduction semantic holds for the applied $pi$-calculus (from wikipedia):
$$overline{x}langle z rangle.P | x(y).Q rightarrow P | Q(z/y)$$
where $Q(z/y)$ denotes the process $Q$ in which the free name $z$ has been ”substituted” for the free occurrences of $y$. If a free occurrence of $y$ occurs in a location where $z$ would not be free, alpha-conversion may be required.

Do I understand correctly, that in the above example, because $n$ is already used and thus not free, we would need to rename and thus the reduction would be like so:
$$(nu n’) (nu n) (c(y).(text{if n=n’ then P else Q}))$$

While on the other hand, in the following process:
$$(nu n)overline{c} langle n rangle.0 | c(y).(text{if n = y then P else Q}))$$
because $n$ is not bound, we can simply perform the transaction like so:
$$(nu n) (text{if n = n then P else Q})$$
(and thus those two processes are also semantically different)?

Excel VBA early/late binding in the context of application behaviour

In reference to the following changes you can make to application behaviour while running VBA in Excel, I saw a note saying that for early binding, it requires you to add an object model reference (saying In the VBA editor, click Tools > References, Select ‘Microsoft Scripting Runtime’, Click ‘OK’):

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.DisplayAlerts = False
Application.EnableEvents = False

I understand the need for that reference in other contexts (e.g. using the FSO) but what is the connection between the above four lines of code and early binding? And why the Microsoft Scripting Runtime reference for this?

ethernet – Binding NDIS based device with mac and IP in windows

I have a workaround where

  1. I need to connect n number of NDIS/RNDIS based Ethernet devices
  2. They will connect and disconnect several times
  3. Need to assign them 1 fixed IP by mapping the Mac address of each device

Thus i can connect/disconnect but whenever they gets joined as Ethernet device they gets the old internal IP

What i tried:

DHCP for windows 10
But looks like that needs 1 main Ethernet connection which i do not have.

Please help

c# – Xamarin binding Image as binary array within a ListView. Issue while removing entries from the observable collection

I have a xamarin android app which provides the option to make images. Those images will be stored into a database. The existing images will be displayed in a list view (as a preview). You need to be able to delete those images. Everything works fine except the image “removal”.
I am binding the images via ObservableCollection. Each object has a binary array property named “ImageDocumentData”. This property will be used as binding for the “Image.Source”. I am using a converter for the binding in order to convert the binary array into a ImageSource (via MemoryStream).
It does display everything correctly. However if I have more than one image in the preview listview and I start remove images from the ObservableCollection I am getting the runtime error:

System.ObjectDisposedException: ‘Cannot access a closed Stream.’

While rearranging the listview ui during runtime he is not getting into the converter functions again.
I am suspecting the following:
Each time after adding a new image to the ObservableCollection, the image control is disposing the ImageSource stream. After I remove an entry from the ObservableCollection, he is taking the internal cached ImageSource Object and is trying to read from the same stream again which he already disposed. He needs to get the Image Data again because after I delete an entry from the collection he needs to rearranging (redraw) the listview.
I really don’t know how to solve that issue. I need to use a stream within the image source because I only have a binary array (no file, no uri possible).
This is only my assumption. However I can’t see any other reasonable explanation for this runtime error. I’ve tried a few other options but so far none have worked for me, so I was hoping someone here can give me a hint into the correct direction.

This is my DTO:

    (DataContract)
    public class RequestItemImageDocument : INotifyPropertyChanged
    {

        #region Fields
        private Guid _requestItemImageDocId;
        private Guid _orderItemId;
        private byte() _imagedocData;
        private string _documentDescription;
        private DateTime? _storageDate;
        private byte _isSynced;
        #endregion

        #region Properties
        (DataMember)
        public Guid RequestItemImageDocumentId 
        {
            get 
            {
                return _requestItemImageDocId;
            }
            set 
            {
                _requestItemImageDocId = value;
                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs("RequestItemImageDocumentId"));
            } 
        }
        (DataMember)
        public Guid OrderItemId 
        {
            get
            {
                return _orderItemId;
            }
            set
            {
                _orderItemId = value;
                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs("OrderItemId"));
            }
        }

        (DataMember)
        public byte() ImageDocumentData 
        {
            get
            {
                return _imagedocData;
            }
            set
            {
                _imagedocData = value;
                if (PropertyChanged != null) 
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("ImageDocumentData"));

                }
            }
        }
        (DataMember)
        public string DocumentDescription 
        {
            get
            {
                return _documentDescription;
            }
            set
            {
                _documentDescription = value;
                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs("DocumentDescription"));
            }
        }
        (DataMember)
        public DateTime? StorageDate 
        {
            get
            {
                return _storageDate;
            }
            set
            {
                _storageDate = value;
                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs("StorageDate"));
            }
        }
        (DataMember)
        public byte IsSynced 
        {
            get
            {
                return _isSynced;
            }
            set
            {
                _isSynced = value;
                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs("IsSynced"));
            }
        }
        #endregion
        #region Constr
        public RequestItemImageDocument() 
        {

        }
        #endregion
        public event PropertyChangedEventHandler PropertyChanged;
    }

This is my view:

<?xml version="1.0" encoding="utf-8" ?>
<ui:PasAMBasePage
    x:Class="AssetManagement.Mobile.Core.UI.OrderItemImageDocumentationPage"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:actionMenu="clr-namespace:Client.ApplicationDataModel.UI.Controls.ActionMenu;assembly=Client.ApplicationDataModel.UI"
    xmlns:controls="clr-namespace:AssetManagement.Mobile.Core.Controls"
    xmlns:controls1="clr-namespace:UI.XF.Controls;assembly=UI"
    xmlns:AppList="clr-namespace:Client.ApplicationDataModel.UI.Controls.AppList;assembly=Client.ApplicationDataModel.UI"
    xmlns:res="clr-namespace:AssetManagement.Mobile.Core.Resources"
    xmlns:ui="clr-namespace:AssetManagement.Mobile.Core.UI"
    xmlns:valueconverter="clr-namespace:AssetManagement.Mobile.Core.Classes.ValueConverter"
    xmlns:viewmodel="clr-namespace:AssetManagement.Mobile.Core.ViewModels"
    Title="Bild Dokumentation" 
    x:TypeArguments="viewmodel:OrderItemImageDocuViewModel"><!--{res:Translate OrderItemImageDocumentary}-->
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <StackLayout Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3">
            <ListView ItemsSource="{Binding OrderItemImages}"
          HasUnevenRows="true"
          ItemSelected="OnListViewItemSelected"
          ItemTapped="OnListViewItemTapped" x:Name="ImagePreviewListView">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <Grid Padding="10">
                                <Grid.Resources>
                                    <valueconverter:ByteArrayToImageSourceConverter x:Key="SourceConverter" />
                                </Grid.Resources>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="*" />
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                           <Image Grid.RowSpan="2"
                           Source="{Binding ImageDocumentData, Converter={StaticResource SourceConverter}}"
                           Aspect="AspectFit"
                           HeightRequest="120"
                           WidthRequest="120" />
                                <Label Grid.Column="1"
                           Text="{Binding DocumentDescription}"
                           FontAttributes="Bold" />
                            </Grid>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </StackLayout>
        <StackLayout Grid.Row="1" Grid.ColumnSpan="3" Grid.Column="0" Orientation="Horizontal" HorizontalOptions="End" VerticalOptions="End">
            <controls:ImageButtonControl
                Clicked="btnRemove_Clicked"
                FontSize="30"
                Glyph="trash-alt"
                HeightRequest="60"
                HorizontalOptions="End"/>
            <controls:ImageButtonControl
                Clicked="btnAdd_Clicked"
                FontSize="30"
                Glyph="plus"
                HeightRequest="60"
                HorizontalOptions="End"/>
            <controls:ImageButtonControl
                Clicked="btnSave_Clicked"
                FontSize="30"
                Glyph="save"
                HeightRequest="60"
                HorizontalOptions="End"/>

        </StackLayout>
    </Grid>
</ui:PasAMBasePage>

This is the code behind of the view:

    public partial class OrderItemImageDocumentationPage : PasAMBasePage<OrderItemImageDocuViewModel>
    {
        private IAppConfiguration _appConfig;

        public OrderItemImageDocumentationPage()
        {
            InitializeComponent();
        }

        public OrderItemImageDocumentationPage(OrderItemImageDocuViewModel viewModel, IEventLogService eventLog, ILifetimeScope scope,
            IUserInterfaceService uiService, IAppConfiguration appConfig)
            : base(viewModel, eventLog, scope, uiService)
        {
            InitializeComponent();

            _appConfig = appConfig;

            ViewModel.PropertyChanged += ViewModel_PropertyChanged;
        }

        private void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == nameof(OrderItemListViewModel.Order))
            {
                //orderItemAppList.EventContext = ViewModel;
            }
        }

        private void OnListViewItemTapped(object sender, Xamarin.Forms.ItemTappedEventArgs e)
        {

        }

        private void OnListViewItemSelected(object sender, Xamarin.Forms.SelectedItemChangedEventArgs e)
        {

        }


        private async void btnAdd_Clicked(object sender, EventArgs e)
        {
            RequestItemImageDocument document = new RequestItemImageDocument();
            document.RequestItemImageDocumentId = Guid.NewGuid();
            await CrossMedia.Current.Initialize();
            if (!CrossMedia.Current.IsCameraAvailable ||
    !CrossMedia.Current.IsTakePhotoSupported)
            {
                await DisplayAlert("No Camera", "No camera available.", "OK");
                return;
            }
            var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
            {
                Directory = "AssetDocumentary",
                SaveToAlbum = true,
                CompressionQuality = 75,
                CustomPhotoSize = 50,
                PhotoSize = PhotoSize.MaxWidthHeight,
                MaxWidthHeight = 2000,
                DefaultCamera = CameraDevice.Front
            });
            if (!string.IsNullOrEmpty(file.Path)) 
            {
                var result = await UserDialogs.Instance.PromptAsync("F├╝gen Sie eine optionale Textbeschreibung hinzu.", "Beschreibung");
                document.DocumentDescription = result.Text;
                byte() data = null;
                using (var stream = file.GetStream()) 
                {
                    var fInfo = new System.IO.FileInfo(file.Path);
                    data = new byte(fInfo.Length);
                    stream.Read(data, 0, data.Length);
                }
                document.ImageDocumentData = data;
                base.ViewModel.OrderItemImages.Add(document);

                Android.Content.Context context = Android.App.Application.Context;
                Android.Net.Uri filesUri = Android.Provider.MediaStore.Files.GetContentUri("external");
                string where = Android.Provider.MediaStore.MediaColumns.Data + "=?";
                //System.IO.File.Delete(file.Path);
                context.ContentResolver.Delete(filesUri, where, new string() { file.Path });
            }

        }

        private void btnSave_Clicked(object sender, EventArgs e)
        {

        }

        private void btnRemove_Clicked(object sender, EventArgs e)
        {
            if (ImagePreviewListView.SelectedItem != null) 
            {
                var selectedItem = ImagePreviewListView.SelectedItem as RequestItemImageDocument;
                var test = ViewModel.OrderItemImages.FirstOrDefault(
                    c => c.RequestItemImageDocumentId.Equals(((RequestItemImageDocument)ImagePreviewListView.SelectedItem)
                    .RequestItemImageDocumentId));
                ImagePreviewListView.SelectedItem = null;
                ViewModel.OrderItemImages.Remove(test);
            }
        }
    }

This is my converter:

    public class ByteArrayToImageSourceConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            ImageSource xValue = null ;
            try 
            {
                if (value != null) 
                {
                    MemoryStream mem = new MemoryStream((byte())value);
                    xValue = ImageSource.FromStream(new Func<Stream>(() => { return mem; }));
                }

            }catch(Exception ex) 
            {

            }
            return xValue;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotSupportedException();
        }
    }

This is the view model:

    public class OrderItemImageDocuViewModel : ApplicationDataBaseViewModel, INavigationEventHandler
    {
        #region Klassenvariablen

        private readonly int _pagingSize = 20;
        private IAppConfiguration _appConfig;
        private ILifetimeScope _scope;
        private IBarcodeParserService _barcodeParser;
        private IEventLogService _eventLog;
        private IUserDataService _userData;
        private int _itemsToLoadCount;
        private ObservableCollection<RequestItemImageDocument> _orderItemImages = new ObservableCollection<RequestItemImageDocument>();
        private OrderItem _orderItemContext = null;
        #endregion Klassenvariablen

        #region Konstruktor

        public OrderItemImageDocuViewModel(ILifetimeScope scope, IDataRepositoryService dataRepository, IBarcodeParserService barcodeParserService, IEventLogService eventLog, IUserDataService userData, ITranslationService translationService, IAppConfiguration appConfig)
            : base(dataRepository)
        {
            _eventLog = eventLog.Initialize(typeof(OrderItemImageDocuViewModel));
            _scope = scope;
            _appConfig = appConfig;
            _userData = userData;
            _barcodeParser = barcodeParserService;
            TranslationService = translationService;

            _itemsToLoadCount = _pagingSize;


        }

        #endregion Konstruktor

        #region Properties

        (NavigationParameter)
        public Order Order { get; set; }

        public IEventLogService EventLog => _eventLog;

        public bool IsLoading { get; set; }

        public bool DatabasesMissing { get; set; }



        public ITranslationService TranslationService { get; set; }

        public IList<OrderItem> OrderItems { get; set; }

        public IOrderTypeScanHandling ScanHandler { get; set; }

        public ObservableCollection<RequestItemImageDocument> OrderItemImages 
        {
            get 
            {

                return _orderItemImages;
            }
            set 
            {
                _orderItemImages = value;
                base.OnPropertyChanged("OrderItemImages");
            }
        }
        #endregion Properties

        #region Functions

        #endregion

        public override async void OnNavigationParametersProvided(NavigationContext context)
        {
            if (!DatabasesMissing)
            {
                IsLoading = true;

                try
                {
                    //await InitializeData();

                    //await LoadDataOnDemand();
                }
                catch (Exception ex)
                {
                    //ex.TrackError();
                }

                IsLoading = false;
            }
        }

    }

variable binding – How did this Example.name came and hows its used in the following program

class Example
{

//static variable salary
public static int age;

public static String name = “Gautam”;
}

public class Person

{
public static void main(String args()){

//acess variable without object
Example.age=45;

System.out.println(” Name of a person:”+Example.name);

System.out.println(“Age of a person:”+Example.age);

dnd 5e – Can the target of a “Planar Binding” spell be forced to perform an obviously harmful or suicidal command?

The Planar Binding spell has no text excluding “obviously harmful” or “suicidal” instructions. On the other hand, all of the following spells do have such text: Command (1st level enchantment), Suggestion (2nd level enchantment, Compulsion (4th level enchantment), Geas (5th level enchantment), Planar Ally (6th level conjuration) and Mass Suggestion (6th level enchantment)

Under the meta-rule that “there are no hidden rules”, does this mean that the subject of a Planar Binding spell can be given a harmful/suicidal instruction?

I think that RAW, the answer is yes. I’m more interested in RAI and RAF, game balance, and how this helps develop an internally consistent “theory of binding magic” (see the numerous other questions about Planar Binding).

dnd 5e – Does the target of “Planar Binding” experience an irresistible compulsion?

If the target of Planar Binding fails its Charisma saving throw, it “must follow your instructions to the best of its ability”.

How does the target experience the “must” portion of the effect? Do they experience an utterly irresistible compulsion? Or does it seem completely natural to them to behave in the manner dictated by the instructions given to them?

Planar Binding

… first paragraph snipped …

A bound creature must follow your instructions to the best of its ability. You might command the creature to accompany you on an adventure, to guard a location, or to deliver a message. The creature obeys the letter of your instructions, but if the creature is hostile to you, it strives to twist your words to achieve its own objectives. If the creature carries out your instructions completely before the spell ends, it travels to you to report this fact if you are on the same plane of existence. If you are on a different plane of existence, it returns to the place where you bound it and remains there until the spell ends.

… third paragraph snipped …

The bold text above seems to suggest that the spell does NOT make instructions “completely natural”, and that the creature is thus aware of when an instruction is at odds with its own preferred behavior. For example, if an evil Dao that prefers to torture their slaves is bound with this spell and instructed to “be kind, considerate, respectful, and loving to everyone you interact with”, that they are aware of their preferences and the instruction (and the dichotomy between them).

But this leaves unanswered what exactly their experience of the magical effect is, whereby they must follow the instructions. Do they try to act normally but find themselves unconsciously acting in accordance with the instructions (like Jim Carrey in “Liar, Liar”)? Or is their experience more akin to an ongoing internal struggle that they never win, in which they try desperately, every single time, to do what they want to, but are (somehow) forced to act in accordance with the instructions?

One fact that may play a role in this is that the Planar Binding spell is an abjuration. This is somewhat problematic given that the primary effect of the spell is coercive rather than protective (enchantment would make more sense). However, having it be abjuration makes it more powerful, since numerous entities are immune to enchantment but few are immune to abjuration. Regardless, I’m left unclear how the spell enforces the instructions and what the target’s subjective experience is. Knowing the answer to this question will help answer a whole flock of related questions.

Note that there is not a great deal of RAW related to this (that I am aware of), so the standard answer is “it is up to the DM”. What I’m looking for is guidance around what is sensible in that context (preferably that aligns with game balance, related game mechanics, etc.)