amqp – RabbitMQ Binding Keys – Best Practices

I am binding a queue to a topic exchange with multiple binding keys, and have the following related questions

  • Is there a maximum number of binding keys that can be used to bind a single queue to an exchange?
  • Is it considered bad practice to use a lot of binding keys for a single queue (say around 50 binding keys)?

I see from this answer here that “For topic routing, performance decreases as the number of bindings increase”. I am curious to understand a bit more specifically about how drastically performance can decrease, and generally how big the number of bindings can get before it starts affecting performance.

binding – Xaml INotifyPropertyChanged en propiedades compuestas

Tengo el siguiente trozo de código xaml en el que muestro un calendario, cuyas propiedades “Locale” y “FirstDayOfWeek” dependen de un componente, Resources que cambia según la localización que escoja el usuario. Trozo xaml:

                <StackLayout Padding="5, 10, 5, 10">
                    <calendar:SfCalendar x:Name="calendar" 
                                         ViewMode="MonthView" 
                                         YearViewMode="Month" 
                                         Margin="10, 5, 10, 5"
                                         NavigationDirection="Vertical"
                                         ShowInlineEvents="True"
                                         InlineViewMode="Agenda"
                                         VerticalOptions="FillAndExpand"
                                         Locale="{Binding Source=localization, Path=Resources}"
                                         FirstDayofWeek="{Binding Resources(LocalizationFirstDay)}">
                        <calendar:SfCalendar.MonthViewSettings>
                            <calendar:MonthViewSettings>
                                <calendar:MonthViewSettings.InlineItemTemplate>
                                    <DataTemplate>
                                        <Button AutomationId="{Binding AutomationId}" 
                                                Text="Texto" TextColor="#bbd5ed"/>
                                    </DataTemplate>
                                </calendar:MonthViewSettings.InlineItemTemplate>
                            </calendar:MonthViewSettings>
                        </calendar:SfCalendar.MonthViewSettings>
                    </calendar:SfCalendar>
                </StackLayout>

Clase model:

public class MediaViewModel : BaseViewModel
{

    public CultureInfo localization;

    public int localizationFirstDay;
    
    public MediaViewModel()
    {
        localization = Resources.CurrentCultureI();
        localizationFirstDay = (int)Resources.CurrentCultureI().DateTimeFormat.FirstDayOfWeek;
    }

}

En el BaseViewModel viene especificado el componente:

public class BaseViewModel : INotifyPropertyChanged
{

...

    public LocalizedResources Resources
    {
        get => App.LocResources;
        private set { }
    }

...

}

La clase LocaizedResources:

public class LocalizedResources : INotifyPropertyChanged
{
    const string DEFAULT_LANGUAGE = "";

    readonly ResourceManager ResourceManager;
    CultureInfo CurrentCultureInfo;

    public string this(string key)
    {
        get => ResourceManager.GetString(key, CurrentCultureInfo);
    }

    public LocalizedResources(Type resource, string language = null)
        : this(resource, new CultureInfo(language ?? DEFAULT_LANGUAGE))
    { }

    public LocalizedResources(Type resource, CultureInfo cultureInfo)
    {
        CurrentCultureInfo = cultureInfo;
        ResourceManager = new ResourceManager(resource);

        MessagingCenter.Subscribe<object, CultureChangedMessage>(this,
            String.Empty, OnCultureChanged);
    }

    public event PropertyChangedEventHandler PropertyChanged;

    private void OnCultureChanged(object s, CultureChangedMessage ccm)
    {
        CurrentCultureInfo = ccm.NewCultureInfo;
        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Item"));
    }

    public string CurrentCulture() => CurrentCultureInfo.Name;

    public CultureInfo CurrentCultureI() => CurrentCultureInfo;
}

Volviendo al xaml, la propiedad “FirstDayOfWeek” se actualiza correctamente cuando cambio el idioma, pero el Locale, que es compuesta no. Tengo otro par de casos con el mismo problema, pero supongo que es un tema de poner las propiedades adecuadas en el Binding, ¿me podéis ayudar?

Muchas gracias.

Binding a collection of objects to a collection of user controls in wpf

I reference this post WPF UserControl Reuse With MVVM because it’s similar, but not exactly what i’m hoping to achieve.

The user can retrieve multiple employees from a database based on input from the wpf app. The number of employees read in changes depending on the specific db query. Rather than putting the employees read in from the database in a datagrid, I have created a user control that represent an email with name, icon, role, etc.

The way I have done this – which I presume is wrong – is to store the read in data from the database in an observable collection eg. observablecollection employees

And for each employee in the collection there is a user control added to a stackpanel in code behind eg. employeeStackPanel.Children.Add(user control)

But I don’t quite know how to bind the user controls to the objects in the employees observable collection.

Thanks

c# – Cannot perform binding on null reference when on async operastion

I’ve got a series of functions and methods to authenticate to a web service and control various hardware parameters.

Of which, almost all of them are async – aside from the ones where I’m specifically steering some parameters.

Where I’ve come unstuck over the last few days (and finally can see now) is that I have set a new value, sent it to the server, and am waiting for a boolean to come back to tell me if it’s successful.

What’s worse – is that if I’m explicitly awaiting everything I still get the same error.

I’m got it called from a timer, so I can consolidate all updates into a single JSON object, and correctly serialise it for the endpoint.

private async void SendTimer_Elapsed(object sender, ElapsedEventArgs e)
{
    var timer = sender as Timer;
    timer.Stop();
    if (Device.JsonToSend != null && Device.JsonToSend.Count > 0)  //ensure I've got a valid dict of endpoints and JSON updates
    {
        foreach (var json in Device.JsonToSend)
        {
            //Key is path, Value is payload.
            
            if(await Device.putValue(json))  //true if update was successful
            {
                await Device.readConfigJsonFromServer(this);
                await Device.readStatusJsonFromServer(this);
            }
            logger.Debug($"JSON to Send:n{json}");
        }

    }
    Device.JsonToSend = new Dictionary<string, JObject>();
    timer.Start();

}

Timer above, putValue below.

public async Task<bool> putValue(KeyValuePair<string, JObject> json)
{
    // Initialization.  
    var handler = new HttpClientHandler()
    {
        ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
    };
    // Prepare JSON - serialise CONFIG token

    string s = JsonConvert.SerializeObject(json.Value.SelectToken("config"));
    dynamic tempJson = json.Value;
    tempJson.Value.SelectToken("config").Replace(s);


    using (var client = new HttpClient(handler))
    {
        // Access test instance
        client.BaseAddress = SNPDeviceUri;
        string putPath = "/api/elements/" + SNPDeviceUri.Host + json.Key; // construct my putValue query
        putPath += "/?partial=true";

        int retryCount = 3;
        do
        {
            --retryCount;
            // Setting content type.  
            HttpResponseMessage putResponse = null;
            try
            {
                //stuff
            }
            ...
                else if(putResponse.IsSuccessStatusCode)
                {
                    //DeviceModel.CommsStatus = DeviceState.Connected;
                    logger.Trace($"PUT Succeeded to {SNPDeviceUri.Host}{putPath}nt{putResponse.StatusCode}:{putResponse.ReasonPhrase}nnt{json.Value.ToString()}n");
                    return true;
                }

                Thread.Sleep(1000);
            } while (retryCount > 0);
            
         
        }
        return false;
    }

Even if I declare a boolean explicitly for await Device.putValue – I still get the same error – Cannot perform binding on null reference.

I think I’ve spent way too much time looking at this, and have evidently done something wrong.

Any thoughts?
Many thanks

knockoutjs – KOjs binding syntax for active minicart

I added an arrow to the minicart icon, and I want that arrow to change when the minicart is open. This is what I did so far

<span data-bind="attr: {
            class: 'porto-icon-angle-' + (this.sidebarInitialized ? 'down' : 'up')
        }"</span>

I’m trying to trigger the event on this.sidebarInitialized but while I don’t have any errors, it’s not working.
I see in the docs that I should be able to do this using something called openClass, but it doesn’t show how to use it, and I don’t understand the docs.

How can I trigger this css change based on the minicart being open or closed?

Thanks

keybindings – Keyboard binding: deleteWordForward not working

I have the following code in my ~/Library/KeyBindings/DefaultKeyBinding.dict file:

{
    "~f"        = "moveWordForward:";               /* M-f          Move forward word */
    "~b"        = "moveWordBackward:";              /* M-b          Move backward word */
    "~d"        = "deleteWordForward:";             /* M-d          Delete word forward */
}

The first two, M-f and M-b works as intended to move forward/backward one word, but the M-d button doesn’t (it doesn’t do anything). Any suggestions on how to troubleshoot this issue? Thanks!

state – React one-way data binding vs Angular two-way data binding

After hours of reading blog posts, I understand that React has one-way data binding, and Angular has two-way. But I don’t actually know what that means….

React

import { useState } from 'react';
import Switch from "./switch";

function App() {
  const (value, setValue) = useState(false);
  return (
    <Switch
      isOn={value}
      handleToggle={() => setValue(!value)}
    />
  );
}

Angular

import { Component } from '@angular/core';

@Component({
  selector: 'app',
  template: `
    <switch (ngModel)="value" (ngModelChange)="value = $event"></switch>
  `,
})
export class AppComponent {
  value = false;
}

Those look functionally identical to me.

What’s actually the difference between the data bindings?

angular9 – Angular 10 Cannot find a differ supporting object ‘[object Object]’ of type ‘object’. NgFor only supports binding to Iterables such as Arrays

I’m trying to invoke my REST API to get some data and display them in html page Using Angular 10.
here’s my my http service.

public findUsers(page: number, size: number): Observable<User()> {
    return this.http.get<User()>(AUTH_API+`users?page=${page}&size=${size}`, httpOptions);
}

And here’s my service’s call.

  export class AccountComponent implements OnInit {
  paginator: MatPaginator = {} as MatPaginator;
  loaded: boolean;
  users: User();
  data:any;

  constructor(private accountSerive: AccountService) { }

  ngOnInit(): void {
    this.paginator.pageIndex = 0;
        this.paginator.pageSize = 20;
    this.getUsers();
  }
  getUsers() {
    this.data = this.accountSerive.findUsers(this.paginator.pageIndex, this.paginator.pageSize)
    .subscribe((data) => {
      this.users = data;
      this.loaded = true; 
    });
  }

}

Here’s my HTML code

 <tr *ngFor="let user of users" >
            <td>{{user.name}}</td>
            <td>{{user.username}}</td>
            <td>{{user.email}}</td>
            <td>{{user.password}}</td>
            <td>{{user.role}}</td>
          </tr>

And finally my user Model

    export interface User {
    email: string;
    password: string;
    userName: string;
    roles: (Role); 

}
export interface Role {
    name: string; 
    
}

how to implement channel binding feature in TLS

I found some explanations with the concept of tls channel binding. But I cannot find any specific example about how to implement this feature.

I want to know if this feature needs to implement on application layer, like extracting some data related to current connection and verifying it at application level.IF it is, then should I verify this channel binding data with specific rules or just verify it as what I like.

If my understanding is wrong, can anybody correct it?