问:
Transpose data in SQL with new column
I have a data like:

```<code>id maths phy chem
1   50   60   21
2   60   80   22
3   80   90   23
</code>```

Now I want it to look like:

```<code>sub   1   2   3
math 50  60  80
phy  60  80  90
chem 21  22  23
</code>```

my code:

```<code>select *
  from mrks
    pivot
(
  max(maths)
  for id in ([1], [2], [3])
) piv
</code>```

however I'm facing 2 issues

I am not able to transpose chem and phy values

Not able to group maths, phy and chem under subj

答:
This will also work</p>

```<code>DECLARE @tble TABLE (id INT, maths INT, phy INT, chem INT)
INSERT INTO @tble VALUES
(1,50,60,21),(2,60,80,22),(3,80,90,23);

select * from(
SELECT ID,maths AS Scores, 'maths' as Subjects FROM @tble
UNION
SELECT ID,phy AS Scores, 'phy' as Subjects FROM @tble
UNION
SELECT ID,chem AS Scores, 'chem' as Subjects FROM @tble
  ) s
PIVOT
(
  MIN(Scores)
  FOR id IN ([1], [2], [3])
) piv
</code>```

Title: Transpose data in SQL with new column

Body:
I have a data like:

id maths phy chem
1   50   60   21
2   60   80   22
3   80   90   23

Now I want it to look like:

sub   1   2   3
math 50  60  80
phy  60  80  90
chem 21  22  23

my code:

select *
  from mrks
    pivot
(
  max(maths)
  for id in ([1], [2], [3])
) piv

however I'm facing 2 issues

I am not able to transpose chem and phy values

Not able to group maths, phy and chem under subj

Body:
This will also work

DECLARE @tble TABLE (id INT, maths INT, phy INT, chem INT)
INSERT INTO @tble VALUES
(1,50,60,21),(2,60,80,22),(3,80,90,23);

select * from(
SELECT ID,maths AS Scores, 'maths' as Subjects FROM @tble
UNION
SELECT ID,phy AS Scores, 'phy' as Subjects FROM @tble
UNION
SELECT ID,chem AS Scores, 'chem' as Subjects FROM @tble
  ) s
PIVOT
(
  MIN(Scores)
  FOR id IN ([1], [2], [3])
) piv


来源: stackexchange

问:
Is it possible to run the Google App Engine SDK from a shell?
Is it possible to run the Google App Engine SDK from a shell so I can use the Python Debugger?  Running it from the GUI is nice, but you get no STDIN/STDOUT, so I can't set_trace and step through my code.

Barring that, is there any other way to achieve interactive debugging with GAE when developing locally?

I'm on Windows 7.

答:
I am running python GAE on windows 7. You are definitely going to want to use the Eclipse Classic IDE with the google app engine plugin. Check out this video:

http://www.youtube.com/watch?v=e1dtyQ6wqzc

It tells you step by step how to setup everything.

ContentLicense: CC BY-SA 3.0


问:
Unable to view user generated logs for azure functions python
Is it possible to view the user-generated logs for a python azure function if there is no application insights linked to it?</p>

答:
Update Answer:

As far as I know it is not necessary, all web apps are deployed on kudu. I usually choose to use kudu to view the logs when I cannot view the logs on the portal due to some problems. What do you mean by kudu not being supported on the consumption plan? Can't enter kudu page? I think maybe you haven't found the right way, you can go directly to this URL (provided that you have logged in to your azure account, otherwise you don't have permission to view): https://functionappname.scm.azurewebsites.net/DebugConsole. Replace functionappname with your function app name, this is the URL of your function app in kudu. You can then view the log in the place written in my answer.

Original Answer:

Yes, if you have not configured Application Insights, you can still view the function's health log. The method is to directly enter kudu to view, compared to using Application Insights. Follow this method dont need to delay. The method is below:

After go to the kudu, click 'Debug console'->'CMD', then go to 'D:\home\LogFiles\Application\Functions>'. Your log file is under this folder.

ContentLicense: CC BY-SA 4.0


问:
XAML UI slow using Observable collection MVVM
this is my first question. I have read topics related to my question but didn't find a solution.

There are 10 objects holding an array of buttons bound to an observable collection in my MainViewModel. I want to switch between the objects to show the current object.
Updating the ui is slow this way. I'm not sure what I can try.

EDIT: I tried to create a

Minimal, Reproducible Example:
Name od the Project: STACK_MVVM

Mainpage.xaml

```<code><Page
x:Class="STACK_MVVM.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:STACK_MVVM"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<Grid x:Name="thegrid" Margin="0,0,0,0">
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="1*"/>
        <ColumnDefinition Width="6*"/>
        <ColumnDefinition Width="2*"/>
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition Height="0.5*"/>
        <RowDefinition Height="5*"/>
        <RowDefinition Height="2*"/>
        <RowDefinition Height="2*"/>
    </Grid.RowDefinitions>
    <controls:UniformGrid x:Name="ButtonsUniformGrid"  Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="1"  Orientation="Horizontal"  Columns="16" Rows="5"  ColumnSpacing="4" RowSpacing="4">
    </controls:UniformGrid>
    <controls:UniformGrid x:Name="ButtonsUniformGrid_Copy"  Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="1"  Orientation="Horizontal"  Columns="10" Rows="3"  ColumnSpacing="4" RowSpacing="4" Margin="0,15,0,0">

    </controls:UniformGrid>
</Grid>
</Page>
</code>```

MainPage.xaml.cs

```<code>using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

namespace STACK_MVVM
{

public sealed partial class MainPage : Page
{
    public Room[] room = new Room[10];
    public ToggleButton[] channelSel = new ToggleButton[10];
    Binding[] myChanSel_Binding_Command = new Binding[10];
    public MainViewModel TheMainViewModel1 { get; set; }
    int tabentry = 0;
    public MyLogic TheLogic = null;
    public MainPage()
    {
        this.InitializeComponent();
        this.TheMainViewModel1 = new MainViewModel();
        this.TheMainViewModel1.fillItems();
         TheLogic = new MyLogic();
         TheLogic.setTheMainModel(TheMainViewModel1);

        ButtonsUniformGrid.Visibility = Visibility.Visible;
        ButtonsUniformGrid_Copy.Orientation = Orientation.Horizontal;
        ButtonsUniformGrid_Copy.Columns = 16;
        ButtonsUniformGrid_Copy.Rows = 4;
        for (int i = 0; i < 10; i++)
        {
            room[i] = new Room();
            room[i].channel = i;
            TheLogic.setTheModels(room[i].TheMainViewModel1, i);
            thegrid.Children.Add(room[i].uniformGrid1);

            Grid.SetColumn(room[i].uniformGrid1, 1);     //ToggleButtonMatrix
            Grid.SetRow(room[i].uniformGrid1, 1);

            //****
            channelSel[i] = new ToggleButton();
            channelSel[i].HorizontalAlignment = HorizontalAlignment.Stretch;
            channelSel[i].VerticalAlignment = VerticalAlignment.Stretch;
            channelSel[i].Checked += HandleChannelSelChecked;
            channelSel[i].Tag = i;

            channelSel[i].SetBinding(ToggleButton.CommandProperty, new Binding() { Source = TheMainViewModel1, Path = new PropertyPath("OKButtonClicked1") });
            channelSel[i].SetBinding(ToggleButton.CommandParameterProperty, new Binding() { Source = TheMainViewModel1, Path = new PropertyPath("MyChannel[" + i + "]") });

            ButtonsUniformGrid_Copy.Children.Add(channelSel[i]);
        }

    }
    private void HandleChannelSelChecked(object sender, RoutedEventArgs e)   // make it Visible
    {
        ToggleButton toggle = sender as ToggleButton;
        int m = (int)toggle.Tag;
        for (int i = 0; i < 10; i++)
        {
            if (i != m)
            {
                room[i].uniformGrid1.Visibility = Visibility.Collapsed;
                channelSel[i].IsChecked = false;
            }
        }
        room[m].uniformGrid1.Visibility = Visibility.Visible;
    }
}
}
</code>```

Room.cs

```<code>using Microsoft.Toolkit.Uwp.UI.Controls;
using System;
using System.Collections.Generic;
using System.Linq;

using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;

namespace STACK_MVVM
{
    public class Room
    {
        public UniformGrid uniformGrid1 = new UniformGrid();
        public Dictionary<ToggleButton, Tuple<int, int>> clientDict = new Dictionary<ToggleButton, Tuple<int, int>>();
        public ToggleButton[,] bu = new ToggleButton[5, 16];
        public int channel;

        public struct pattern
        {
            public int[,] vec_bs1;
            public int[] vec_bs;
        };
        public pattern thepattern = new pattern();
        public MainViewModel TheMainViewModel1 { get; set; }
        Binding[] Toggle_Binding = new Windows.UI.Xaml.Data.Binding[5 * 16];

    public Room()
    {
        TheMainViewModel1 = new MainViewModel();
        TheMainViewModel1.fillItems();
        thepattern.vec_bs1 = new int[5, 16];
        thepattern.vec_bs = new int[80 * 10];

        uniformGrid1.Columns = 16;
        uniformGrid1.Rows = 5;
        uniformGrid1.ColumnSpacing = 4;
        uniformGrid1.RowSpacing = 4;
        uniformGrid1.Orientation = Orientation.Horizontal;
        uniformGrid1.Visibility = Visibility.Collapsed;

        for (int i = 0; i < 5; i++)
        {
            for (int j = 0; j < 16; j++)
            {
                bu[i, j] = new ToggleButton();

                clientDict.Add(bu[i, j], new Tuple<int, int>(i, j));
                bu[i, j].HorizontalAlignment = HorizontalAlignment.Stretch;
                bu[i, j].VerticalAlignment = VerticalAlignment.Stretch;
                uniformGrid1.Children.Add(bu[i, j]);
                //BINDINGS
                Toggle_Binding[(j) + (i * 16)] = new Windows.UI.Xaml.Data.Binding();
                Toggle_Binding[(j) + (i * 16)].Source = this.TheMainViewModel1;
                string ppath = "MyItemsbool[" + ((j) + (i * 16)) + "]";
                Toggle_Binding[(j) + (i * 16)].Path = new PropertyPath(ppath);
                Toggle_Binding[(j) + (i * 16)].Mode = BindingMode.TwoWay;
                Toggle_Binding[(j) + (i * 16)].UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
                BindingOperations.SetBinding(bu[i, j], ToggleButton.IsCheckedProperty, Toggle_Binding[(j) + (i * 16)]);

            }
        }
    }
    private void HandleToggleButtonUnChecked(object sender, RoutedEventArgs e)
    {
       ToggleButton toggle = sender as ToggleButton;
       var client = clientDict[sender as ToggleButton];
       // Debug.WriteLine(client.Item1 + " " + client.Item2);
        thepattern.vec_bs1[client.Item1, client.Item2] = 0;
    }
    public void HandleToggleButtonChecked(object sender, RoutedEventArgs e)
    {
        ToggleButton toggle = sender as ToggleButton;
        var client = clientDict[sender as ToggleButton];
       // Debug.WriteLine(client.Item1 + " " + client.Item2);
        this.thepattern.vec_bs1[client.Item1, client.Item2] = 1;
    }
}//Class
}
</code>```

MyLogic.cs

```<code>using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace STACK_MVVM
{   public class MyLogic
   {
        public static MainViewModel[] TheModels = new MainViewModel[10];
        public MainViewModel TheMainModel = new MainViewModel();

        public void setTheModels(MainViewModel themodel, int num)
        {
            TheModels[num] = themodel;
            //Debug.WriteLine("THEMODELS" + TheModels[0].MyItemsbool[0]);
        }
        public void setTheMainModel(MainViewModel themainmodel)
        {
            TheMainModel = themainmodel;
        }
        public static void LoadPattern(object parameter)
        {
           for (int x = 0; x < 10; x++)
           {
                TheModels[x].pattern_load_struct((int)parameter);
           }
            Debug.Write("CHANNELNUM: " + parameter);
        }
   }
}
</code>```

MainViewModelBase.cs

```<code>using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using Windows.ApplicationModel.Core;
using Windows.UI.Core;

namespace STACK_MVVM
{
    public abstract class MainViewModelBase : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        private CoreDispatcher _dispatcher = CoreApplication.MainView.Dispatcher;
        protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            if (_dispatcher.HasThreadAccess)
            {
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
            }
            else
            {
                _dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
                });
            }
        }
    }
}
</code>```

MainViewModel.cs

```<code>using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace STACK_MVVM
{
    public class MainViewModel : MainViewModelBase
    {
        public struct pattern
        {
            public int[] vec_bs1;
            public int[] vec_bs;
        };
        public pattern thepattern = new pattern();

        private ObservableCollection<int> _myChannel = new ObservableCollection<int>(new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 });
        private ObservableCollection<bool> _myItemsbool = new ObservableCollection<bool>(new[] { true, false, true });
        public MainViewModel()
        {
            thepattern.vec_bs1 = new int[5 * 16];
            thepattern.vec_bs = new int[80 * 10];
        }
        public ObservableCollection<bool> MyItemsbool
        {
            get { return _myItemsbool; }
            set
            {
                _myItemsbool = value;
            }
        }
        public ObservableCollection<int> MyChannel { get => _myChannel; set => _myChannel = value; }
        public void fillItems()
        {

            for (int i = 0; i < 5; i++)
                for (int j = 0; j < 16; j++)
                {
                    {

                        MyItemsbool.Add(true);
                        MyItemsbool[(j) + (i * 16)] = true;
                        //MyItemsbool[(j) + (i * 16)] = rnd.Next(2) !=0;
                    }
                }
        }
        public ICommand OKButtonClicked1
        {
            get
            {
               return new DelegateCommand1<object>(MyLogic.LoadPattern);
            }
        }

       public void pattern_save_struct(int tabentry)
       {
            for (int i = 0; i < 5; i++)
            {
                for (int j = 0; j < 16; j++)
                {
                    thepattern.vec_bs[(j) + (i * 16) + ((80) * tabentry)] = (MyItemsbool[(j) + (i * 16)]) ? 1 : 0;
                    //  thepattern.vec_bs[(j) + (i * 16) + ((80) * tabentry)] = thepattern.vec_bs1[i, j];
                    // thepattern.vec_bs[(j) + (i * 16) + ((80) * tabentry)] = thepattern.vec_bs1[i, j];
                }
            }
       }
        public async Task pattern_load_struct(int tabentry)
        {
            var rnd = new Random();  //this is just for testing - Randomly Activate Cell

                await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                Array.Copy(thepattern.vec_bs, 80 * tabentry, thepattern.vec_bs1, 0, 80);
                // Array.Copy(thepattern.vec_bs1, 0, MyItemsbool, 0, 80); //DONT WORK

                for (int i = 0; i < 80; i++)
                {
                     thepattern.vec_bs1[i] = rnd.Next(2);            // Randomly activate Cell - this line can be deletet.

                    MyItemsbool[i] = thepattern.vec_bs1[i] != 0;
                }
            });
        }
    }
}
</code>```

DelegateCommand1.cs

```<code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace STACK_MVVM
{
    class DelegateCommand1<T> : ICommand
    {
        private readonly Action<T> handler;
        private bool isEnabled = true;
        public event EventHandler CanExecuteChanged;
        public delegate void SimpleEventHandler();
        public DelegateCommand1(Action<T> handler)
        {
            this.handler = handler;
        }
        public bool IsEnabled
        {
            get
            {
                return this.isEnabled;
            }
        }
        void ICommand.Execute(object org)
        {
            this.handler((T)org);
        }
        bool ICommand.CanExecute(object org)
        {
            return this.IsEnabled;
        }
        private void OnCanExecuteChanged()
        {
            if (this.CanExecuteChanged != null)
            {
                this.CanExecuteChanged(this, EventArgs.Empty);
            }
        }
    }
}
</code>```

答:
I looked at your code and you seem to have created all the controls (including UniformGrid and a lots of ToggleButtons) in the C# code and filled them into the UI when needed.

This is actually a huge overhead for the system and it is not convenient to debug.

Your problem is that it does not follow the design pattern of MVVM. In MVVM, please do not to create controls directly in C# code, but operate it with data class (Model).

The View in MVVM(Model, View, View-Model) can be regarded as a DataTemplate in UWP. The recommended method is as follows:

Create a class for room and a class for apartment:

public class Room
{
    public bool IsOpened { get; set; }
    public string Name { get; set; }
}
public class Apartment
{
    public string Name { get; set; }
    public List<Room> Rooms { get; set; }
}
```

<ol start="2">
<li>Create a <code>DataTemplate</code> in <code>MainPage.xaml</code> and use the binding to bind the corresponding properties.</li>
</ol>

<pre class="lang-xml prettyprint-override"><code><Page.Resources>
    <DataTemplate x:DataType="local:Room" x:Key="RoomItemTemplate">
        <ToggleButton IsChecked="{x:Bind IsOpened}"/>
    </DataTemplate>
    <DataTemplate x:DataType="local:Apartment" x:Key="ApartmentItemTemplate">
        <ToggleButton Content="{x:Bind Name}"/>
    </DataTemplate>
</Page.Resources>
</code>```

Use GridView to bind collections.

xaml

...
<GridView ItemTemplate="{StaticResource RoomItemTemplate}"
          x:Name="RoomGridView"
          />

<GridView ItemTemplate="{StaticResource ApartmentItemTemplate}"
          x:Name="ApartmentGridView"
          IsItemClickEnabled="True"
          ItemsSource="{x:Bind ApartmentCollection}"
          ItemClick="ApartmentGridView_ItemClick"/>
...
```

<p><strong>xaml.cs</strong></p>

<pre class="lang-cs prettyprint-override"><code>public ObservableCollection<Apartment> ApartmentCollection = new ObservableCollection<Apartment>();
//...
private void ApartmentGridView_ItemClick(object sender, ItemClickEventArgs e)
{
    var item = e.ClickedItem as Apartment;
    RoomGridView.ItemsSource = item.Rooms;
}
</code>```

It should be noted that the above code is simplified code. If you want to migrate the current code to this mode, you need to reorganize your code.

With GridView, you can use the virtualization of the control itself to reduce resource consumption. At the same time, this DataTemplate method can greatly simplify the code writing.

Regarding what you said to change the state of a single item, ObservableCollection has no response. This is normal, because ObservableCollection only responds to changes in the number of items in the collection. If you want to notify the UI when changing the properties of the data class, you need to implement the INotifyPropertyChanged interface for the Model.

Here are some documents that might help you:

Data binding

Data binding and MVVM

Xaml Bind Sample

Update

If the GridView is still stuck, this may be caused by its default animation calculation. You can use ItemsControl to solve this problem.

<ItemsControl ItemTemplate="{StaticResource RoomItemTemplate}"
  x:Name="RoomGridView"
          Grid.Column="0" Grid.Row="0">
    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <controls:UniformGrid Columns="16" Rows="5" />
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>
</ItemsControl>
```

Body:
this is my first question. I have read topics related to my question but didn't find a solution.

There are 10 objects holding an array of buttons bound to an observable collection in my MainViewModel. I want to switch between the objects to show the current object.
Updating the ui is slow this way. I'm not sure what I can try.

EDIT: I tried to create a

Minimal, Reproducible Example:
Name od the Project: STACK_MVVM

Mainpage.xaml

<Page
x:Class="STACK_MVVM.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:STACK_MVVM"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<Grid x:Name="thegrid" Margin="0,0,0,0">
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="1*"/>
        <ColumnDefinition Width="6*"/>
        <ColumnDefinition Width="2*"/>
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition Height="0.5*"/>
        <RowDefinition Height="5*"/>
        <RowDefinition Height="2*"/>
        <RowDefinition Height="2*"/>
    </Grid.RowDefinitions>
    <controls:UniformGrid x:Name="ButtonsUniformGrid"  Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="1"  Orientation="Horizontal"  Columns="16" Rows="5"  ColumnSpacing="4" RowSpacing="4">
    </controls:UniformGrid>
    <controls:UniformGrid x:Name="ButtonsUniformGrid_Copy"  Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="1"  Orientation="Horizontal"  Columns="10" Rows="3"  ColumnSpacing="4" RowSpacing="4" Margin="0,15,0,0">

    </controls:UniformGrid>
</Grid>
</Page>

MainPage.xaml.cs

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

namespace STACK_MVVM
{

public sealed partial class MainPage : Page
{
    public Room[] room = new Room[10];
    public ToggleButton[] channelSel = new ToggleButton[10];
    Binding[] myChanSel_Binding_Command = new Binding[10];
    public MainViewModel TheMainViewModel1 { get; set; }
    int tabentry = 0;
    public MyLogic TheLogic = null;
    public MainPage()
    {
        this.InitializeComponent();
        this.TheMainViewModel1 = new MainViewModel();
        this.TheMainViewModel1.fillItems();
         TheLogic = new MyLogic();
         TheLogic.setTheMainModel(TheMainViewModel1);

        ButtonsUniformGrid.Visibility = Visibility.Visible;
        ButtonsUniformGrid_Copy.Orientation = Orientation.Horizontal;
        ButtonsUniformGrid_Copy.Columns = 16;
        ButtonsUniformGrid_Copy.Rows = 4;
        for (int i = 0; i < 10; i++)
        {
            room[i] = new Room();
            room[i].channel = i;
            TheLogic.setTheModels(room[i].TheMainViewModel1, i);
            thegrid.Children.Add(room[i].uniformGrid1);

            Grid.SetColumn(room[i].uniformGrid1, 1);     //ToggleButtonMatrix
            Grid.SetRow(room[i].uniformGrid1, 1);

            //****
            channelSel[i] = new ToggleButton();
            channelSel[i].HorizontalAlignment = HorizontalAlignment.Stretch;
            channelSel[i].VerticalAlignment = VerticalAlignment.Stretch;
            channelSel[i].Checked += HandleChannelSelChecked;
            channelSel[i].Tag = i;

            channelSel[i].SetBinding(ToggleButton.CommandProperty, new Binding() { Source = TheMainViewModel1, Path = new PropertyPath("OKButtonClicked1") });
            channelSel[i].SetBinding(ToggleButton.CommandParameterProperty, new Binding() { Source = TheMainViewModel1, Path = new PropertyPath("MyChannel[" + i + "]") });

            ButtonsUniformGrid_Copy.Children.Add(channelSel[i]);
        }

    }
    private void HandleChannelSelChecked(object sender, RoutedEventArgs e)   // make it Visible
    {
        ToggleButton toggle = sender as ToggleButton;
        int m = (int)toggle.Tag;
        for (int i = 0; i < 10; i++)
        {
            if (i != m)
            {
                room[i].uniformGrid1.Visibility = Visibility.Collapsed;
                channelSel[i].IsChecked = false;
            }
        }
        room[m].uniformGrid1.Visibility = Visibility.Visible;
    }
}
}

Room.cs

using Microsoft.Toolkit.Uwp.UI.Controls;
using System;
using System.Collections.Generic;
using System.Linq;

using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;

namespace STACK_MVVM
{
    public class Room
    {
        public UniformGrid uniformGrid1 = new UniformGrid();
        public Dictionary<ToggleButton, Tuple<int, int>> clientDict = new Dictionary<ToggleButton, Tuple<int, int>>();
        public ToggleButton[,] bu = new ToggleButton[5, 16];
        public int channel;

        public struct pattern
        {
            public int[,] vec_bs1;
            public int[] vec_bs;
        };
        public pattern thepattern = new pattern();
        public MainViewModel TheMainViewModel1 { get; set; }
        Binding[] Toggle_Binding = new Windows.UI.Xaml.Data.Binding[5 * 16];

    public Room()
    {
        TheMainViewModel1 = new MainViewModel();
        TheMainViewModel1.fillItems();
        thepattern.vec_bs1 = new int[5, 16];
        thepattern.vec_bs = new int[80 * 10];

        uniformGrid1.Columns = 16;
        uniformGrid1.Rows = 5;
        uniformGrid1.ColumnSpacing = 4;
        uniformGrid1.RowSpacing = 4;
        uniformGrid1.Orientation = Orientation.Horizontal;
        uniformGrid1.Visibility = Visibility.Collapsed;

        for (int i = 0; i < 5; i++)
        {
            for (int j = 0; j < 16; j++)
            {
                bu[i, j] = new ToggleButton();

                clientDict.Add(bu[i, j], new Tuple<int, int>(i, j));
                bu[i, j].HorizontalAlignment = HorizontalAlignment.Stretch;
                bu[i, j].VerticalAlignment = VerticalAlignment.Stretch;
                uniformGrid1.Children.Add(bu[i, j]);
                //BINDINGS
                Toggle_Binding[(j) + (i * 16)] = new Windows.UI.Xaml.Data.Binding();
                Toggle_Binding[(j) + (i * 16)].Source = this.TheMainViewModel1;
                string ppath = "MyItemsbool[" + ((j) + (i * 16)) + "]";
                Toggle_Binding[(j) + (i * 16)].Path = new PropertyPath(ppath);
                Toggle_Binding[(j) + (i * 16)].Mode = BindingMode.TwoWay;
                Toggle_Binding[(j) + (i * 16)].UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
                BindingOperations.SetBinding(bu[i, j], ToggleButton.IsCheckedProperty, Toggle_Binding[(j) + (i * 16)]);

            }
        }
    }
    private void HandleToggleButtonUnChecked(object sender, RoutedEventArgs e)
    {
       ToggleButton toggle = sender as ToggleButton;
       var client = clientDict[sender as ToggleButton];
       // Debug.WriteLine(client.Item1 + " " + client.Item2);
        thepattern.vec_bs1[client.Item1, client.Item2] = 0;
    }
    public void HandleToggleButtonChecked(object sender, RoutedEventArgs e)
    {
        ToggleButton toggle = sender as ToggleButton;
        var client = clientDict[sender as ToggleButton];
       // Debug.WriteLine(client.Item1 + " " + client.Item2);
        this.thepattern.vec_bs1[client.Item1, client.Item2] = 1;
    }
}//Class
}

MyLogic.cs

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace STACK_MVVM
{   public class MyLogic
   {
        public static MainViewModel[] TheModels = new MainViewModel[10];
        public MainViewModel TheMainModel = new MainViewModel();

        public void setTheModels(MainViewModel themodel, int num)
        {
            TheModels[num] = themodel;
            //Debug.WriteLine("THEMODELS" + TheModels[0].MyItemsbool[0]);
        }
        public void setTheMainModel(MainViewModel themainmodel)
        {
            TheMainModel = themainmodel;
        }
        public static void LoadPattern(object parameter)
        {
           for (int x = 0; x < 10; x++)
           {
                TheModels[x].pattern_load_struct((int)parameter);
           }
            Debug.Write("CHANNELNUM: " + parameter);
        }
   }
}

MainViewModelBase.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using Windows.ApplicationModel.Core;
using Windows.UI.Core;

namespace STACK_MVVM
{
    public abstract class MainViewModelBase : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        private CoreDispatcher _dispatcher = CoreApplication.MainView.Dispatcher;
        protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            if (_dispatcher.HasThreadAccess)
            {
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
            }
            else
            {
                _dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
                });
            }
        }
    }
}

MainViewModel.cs

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace STACK_MVVM
{
    public class MainViewModel : MainViewModelBase
    {
        public struct pattern
        {
            public int[] vec_bs1;
            public int[] vec_bs;
        };
        public pattern thepattern = new pattern();

        private ObservableCollection<int> _myChannel = new ObservableCollection<int>(new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 });
        private ObservableCollection<bool> _myItemsbool = new ObservableCollection<bool>(new[] { true, false, true });
        public MainViewModel()
        {
            thepattern.vec_bs1 = new int[5 * 16];
            thepattern.vec_bs = new int[80 * 10];
        }
        public ObservableCollection<bool> MyItemsbool
        {
            get { return _myItemsbool; }
            set
            {
                _myItemsbool = value;
            }
        }
        public ObservableCollection<int> MyChannel { get => _myChannel; set => _myChannel = value; }
        public void fillItems()
        {

            for (int i = 0; i < 5; i++)
                for (int j = 0; j < 16; j++)
                {
                    {

                        MyItemsbool.Add(true);
                        MyItemsbool[(j) + (i * 16)] = true;
                        //MyItemsbool[(j) + (i * 16)] = rnd.Next(2) !=0;
                    }
                }
        }
        public ICommand OKButtonClicked1
        {
            get
            {
               return new DelegateCommand1<object>(MyLogic.LoadPattern);
            }
        }

       public void pattern_save_struct(int tabentry)
       {
            for (int i = 0; i < 5; i++)
            {
                for (int j = 0; j < 16; j++)
                {
                    thepattern.vec_bs[(j) + (i * 16) + ((80) * tabentry)] = (MyItemsbool[(j) + (i * 16)]) ? 1 : 0;
                    //  thepattern.vec_bs[(j) + (i * 16) + ((80) * tabentry)] = thepattern.vec_bs1[i, j];
                    // thepattern.vec_bs[(j) + (i * 16) + ((80) * tabentry)] = thepattern.vec_bs1[i, j];
                }
            }
       }
        public async Task pattern_load_struct(int tabentry)
        {
            var rnd = new Random();  //this is just for testing - Randomly Activate Cell

                await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                Array.Copy(thepattern.vec_bs, 80 * tabentry, thepattern.vec_bs1, 0, 80);
                // Array.Copy(thepattern.vec_bs1, 0, MyItemsbool, 0, 80); //DONT WORK

                for (int i = 0; i < 80; i++)
                {
                     thepattern.vec_bs1[i] = rnd.Next(2);            // Randomly activate Cell - this line can be deletet.

                    MyItemsbool[i] = thepattern.vec_bs1[i] != 0;
                }
            });
        }
    }
}

DelegateCommand1.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace STACK_MVVM
{
    class DelegateCommand1<T> : ICommand
    {
        private readonly Action<T> handler;
        private bool isEnabled = true;
        public event EventHandler CanExecuteChanged;
        public delegate void SimpleEventHandler();
        public DelegateCommand1(Action<T> handler)
        {
            this.handler = handler;
        }
        public bool IsEnabled
        {
            get
            {
                return this.isEnabled;
            }
        }
        void ICommand.Execute(object org)
        {
            this.handler((T)org);
        }
        bool ICommand.CanExecute(object org)
        {
            return this.IsEnabled;
        }
        private void OnCanExecuteChanged()
        {
            if (this.CanExecuteChanged != null)
            {
                this.CanExecuteChanged(this, EventArgs.Empty);
            }
        }
    }
}

Body:
I looked at your code and you seem to have created all the controls (including UniformGrid and a lots of ToggleButtons) in the C# code and filled them into the UI when needed.

This is actually a huge overhead for the system and it is not convenient to debug.

Your problem is that it does not follow the design pattern of MVVM. In MVVM, please do not to create controls directly in C# code, but operate it with data class (Model).

The View in MVVM(Model, View, View-Model) can be regarded as a DataTemplate in UWP. The recommended method is as follows:

Create a class for room and a class for apartment:

public class Room
{
    public bool IsOpened { get; set; }
    public string Name { get; set; }
}
public class Apartment
{
    public string Name { get; set; }
    public List<Room> Rooms { get; set; }
}

Create a DataTemplate in MainPage.xaml and use the binding to bind the corresponding properties.

<Page.Resources>
    <DataTemplate x:DataType="local:Room" x:Key="RoomItemTemplate">
        <ToggleButton IsChecked="{x:Bind IsOpened}"/>
    </DataTemplate>
    <DataTemplate x:DataType="local:Apartment" x:Key="ApartmentItemTemplate">
        <ToggleButton Content="{x:Bind Name}"/>
    </DataTemplate>
</Page.Resources>

Use GridView to bind collections.

xaml

...
<GridView ItemTemplate="{StaticResource RoomItemTemplate}"
          x:Name="RoomGridView"
          />

<GridView ItemTemplate="{StaticResource ApartmentItemTemplate}"
          x:Name="ApartmentGridView"
          IsItemClickEnabled="True"
          ItemsSource="{x:Bind ApartmentCollection}"
          ItemClick="ApartmentGridView_ItemClick"/>
...

xaml.cs

public ObservableCollection<Apartment> ApartmentCollection = new ObservableCollection<Apartment>();
//...
private void ApartmentGridView_ItemClick(object sender, ItemClickEventArgs e)
{
    var item = e.ClickedItem as Apartment;
    RoomGridView.ItemsSource = item.Rooms;
}

It should be noted that the above code is simplified code. If you want to migrate the current code to this mode, you need to reorganize your code.

With GridView, you can use the virtualization of the control itself to reduce resource consumption. At the same time, this DataTemplate method can greatly simplify the code writing.

Regarding what you said to change the state of a single item, ObservableCollection has no response. This is normal, because ObservableCollection only responds to changes in the number of items in the collection. If you want to notify the UI when changing the properties of the data class, you need to implement the INotifyPropertyChanged interface for the Model.

Here are some documents that might help you:

Data binding

Data binding and MVVM

Xaml Bind Sample

Update

If the GridView is still stuck, this may be caused by its default animation calculation. You can use ItemsControl to solve this problem.

<ItemsControl ItemTemplate="{StaticResource RoomItemTemplate}"
  x:Name="RoomGridView"
          Grid.Column="0" Grid.Row="0">
    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <controls:UniformGrid Columns="16" Rows="5" />
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>
</ItemsControl>


问:
How does the client knows which transport protocol to use?
Let's assume that I start a server at one of the computers in my private network (192.168.10.10:9900).

Now when making a request from some other computer in the same network, how does the client computer (OS?) knows which protocol to use / which protocol the server follows ? [TCP or UDP]

EDIT: As mentioned in the answers, I was basically looking for a default protocol which will be used by the client in the absence of any transport protocol information.

答: The answers here are pointing to some default protocol. Its' not that, Whenever you start an application let say HTTP server, the server's internal has code to open a socket(which can be TCP or UDP), since HTTP:80 is a TCP protocol the code creates a TCP socket. Similarly for other network application it depends on their requirement what kind of transport layer protocol to use (TCP Or UDP). Like a DNS client will create a UDP socket to connect to DNS server, since DNS:53 is mostly over UDP. Both TCP and UDP have different use cases, advantages and disadvantages. Depending on there uses cases / advantages / disadvantages of UDP/TCP decision is taken to implement server using either of them.


问:
QTP, QC, Load Runner and RFT tutorials
I am newbie in testing. Can you please suggest me some good tutorials of

Quality Center

Quick Test Professional

RFT

Thanx in advance

答: Please refer to IBM RFT Release notes for Tutorials on RFT.</p>

ContentLicense: CC BY-SA 2.5

Title: QTP, QC, Load Runner and RFT tutorials


问:
How to launch logback + logstash on local machine?
I have to test some features on logback + logstash bunch with tcp connection. I have downloaded logstash application. Configured that like this:

```<code>input {
tcp {
    port => "4560"
    codec => json_lines
}

} output {
  stdout { codec => rubydebug }
}
</code>```

start it with

```<code>.\bin\logstash.bat -f .\config\logstash-tcp.conf
</code>```

It was start with message:

```<code>[2020-02-18T10:33:23,910][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9600}
</code>```

Now, i have a Java app in my ide, which one should log info with logback into local lockstash via tcp connection. I have logback.xml file configured like this:

```<code>    <appender name="LOGSTASH_TCP" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
    <destination>127.0.0.1:4560</destination>
    <writeBufferSize>65536</writeBufferSize>
    <ringBufferSize>65536</ringBufferSize>
    <reconnectionDelay>5 second</reconnectionDelay>
    <droppedWarnFrequency>100</droppedWarnFrequency>
    <encoder class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>

<root level="debug">
    <appender-ref ref="STDOUT" />
    <appender-ref ref="LOGSTASH_TCP"/>
</root>
</code>```

Now, when i'am trying to log somthing, in logstash console i seeing that message:

```<code>[2020-02-18T10:40:23,373][ERROR][logstash.inputs.tcp      ][main] Error in Netty pipeline: java.io.IOException: An existing connection was forcibly closed by the remote host
</code>```

I would very appreciate if someone could help with this issue.

答: Ok, it was not a problem. My app really was and it's work and shut down connection)</p>

Body:
I have to test some features on logback + logstash bunch with tcp connection. I have downloaded logstash application. Configured that like this:

input {
tcp {
    port => "4560"
    codec => json_lines
}

} output {
  stdout { codec => rubydebug }
}

start it with

.\bin\logstash.bat -f .\config\logstash-tcp.conf

It was start with message:

[2020-02-18T10:33:23,910][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9600}

Now, i have a Java app in my ide, which one should log info with logback into local lockstash via tcp connection. I have logback.xml file configured like this:

    <appender name="LOGSTASH_TCP" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
    <destination>127.0.0.1:4560</destination>
    <writeBufferSize>65536</writeBufferSize>
    <ringBufferSize>65536</ringBufferSize>
    <reconnectionDelay>5 second</reconnectionDelay>
    <droppedWarnFrequency>100</droppedWarnFrequency>
    <encoder class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>

<root level="debug">
    <appender-ref ref="STDOUT" />
    <appender-ref ref="LOGSTASH_TCP"/>
</root>

Now, when i'am trying to log somthing, in logstash console i seeing that message:

[2020-02-18T10:40:23,373][ERROR][logstash.inputs.tcp      ][main] Error in Netty pipeline: java.io.IOException: An existing connection was forcibly closed by the remote host

I would very appreciate if someone could help with this issue.


问:
How to Compare two files using AWK or GREP
So I have two questions, I have two files where I am trying to sort and filter. In these two files they each have two columns wherein file1 there is IP and Port and in file2 there is domain and IP.

```<code>file1:

Address,Port
1.2.3.4,8080
4.5.6.7,80
6.7.8.9,443

file2:

Domain,IP
google.com,1.2.3.4
google.fe,6.7.8.9
admin.ko,3.2.4.5
</code>```

So the first question: I want to find IPs in file1 that don't match any IP's located in file2.

I have tried using awk, and here is what I used:

```<code>awk -F',' FNR==NR{ a[$2]; next } !($1 in a)' file2 file1
</code>```

So I really don't understand awk really well, so could someone also assist me in understanding each section of that awk command you provide :)

```<code>Desired output:

Address,Port,Status
1.2.3.4,8080,Present
4.5.6.7,80,Not-Present
6.7.8.9,443,Present
</code>```

The next question, I have no idea how to do it so kindly assist.

Second question: so I want to list the same desired Output as the first one but this time I want to add the domain column.

```<code>Desired output:

Address,Port,Domain,Status
1.2.3.4,8080,google.com,Present
4.5.6.7,80,NULL,Not-Present
6.7.8.9,443,google.fe,Present
</code>```

Thank you in advance.

答:
1) This one is very close to your original try... We just add column 3 differently based upon FNR.

Notes:

The header never contains an IP, so storing it in a[] makes no real difference.

The 1 at the end of the script is important, the side effect prints to stdout.

```<code>    awk -F, -v OFS=, '
        FNR == NR { a[$2] = ""; next }
        FNR == 1  { $3 = "Status" }
        FNR != 1  { $3 = (($1 in a) ? "Present" : "Not-Present") }
        1' file2 file1
</code>```

2) We leverage a[] to store the domain in this case, and modify columns 3 and 4 this time accordingly.

```<code>    awk -F, -v OFS=, '
        FNR == NR { a[$2] = $1; next }
        FNR == 1  { $3 = "Domain"; $4 = "Status" }
        FNR != 1  {
            if ($1 in a) {
                $3 = a[$1];  $4 = "Present"
            } else {
                $3 = "NULL"; $4 = "Not-Present"
            }
        }
        1' file2 file1
</code>```

Body:
So I have two questions, I have two files where I am trying to sort and filter. In these two files they each have two columns wherein file1 there is IP and Port and in file2 there is domain and IP.

file1:

Address,Port
1.2.3.4,8080
4.5.6.7,80
6.7.8.9,443

file2:

Domain,IP
google.com,1.2.3.4
google.fe,6.7.8.9
admin.ko,3.2.4.5

So the first question: I want to find IPs in file1 that don't match any IP's located in file2.

I have tried using awk, and here is what I used:

awk -F',' FNR==NR{ a[$2]; next } !($1 in a)' file2 file1

So I really don't understand awk really well, so could someone also assist me in understanding each section of that awk command you provide :)

Desired output:

Address,Port,Status
1.2.3.4,8080,Present
4.5.6.7,80,Not-Present
6.7.8.9,443,Present

The next question, I have no idea how to do it so kindly assist.

Second question: so I want to list the same desired Output as the first one but this time I want to add the domain column.

Desired output:

Address,Port,Domain,Status
1.2.3.4,8080,google.com,Present
4.5.6.7,80,NULL,Not-Present
6.7.8.9,443,google.fe,Present

Thank you in advance.

Body:
1) This one is very close to your original try... We just add column 3 differently based upon FNR.

Notes:

The header never contains an IP, so storing it in a[] makes no real difference.

The 1 at the end of the script is important, the side effect prints to stdout.

    awk -F, -v OFS=, '
        FNR == NR { a[$2] = ""; next }
        FNR == 1  { $3 = "Status" }
        FNR != 1  { $3 = (($1 in a) ? "Present" : "Not-Present") }
        1' file2 file1

2) We leverage a[] to store the domain in this case, and modify columns 3 and 4 this time accordingly.

    awk -F, -v OFS=, '
        FNR == NR { a[$2] = $1; next }
        FNR == 1  { $3 = "Domain"; $4 = "Status" }
        FNR != 1  {
            if ($1 in a) {
                $3 = a[$1];  $4 = "Present"
            } else {
                $3 = "NULL"; $4 = "Not-Present"
            }
        }
        1' file2 file1


问:
Entity Framework - Preserving Data
Using Model First, what is the best way to approach preservation of existing database data when the model changes and the database has to be regenerated?

The Database Power Pack extension no longer works (I've been trying to contact the author). I can't find anything that provides similar functionality.

R.

答: If database power pack doesn't work there is no other automatic way. Manual way requires running created SQL script on another database and using Visual Studio Database tools to create difference script between the current and the newly created database.</p>

Title: Entity Framework - Preserving Data


问:
PL/SQL regex validation how to escape from '
I'm working on a fullName validation function, examples that can go are :

John Deep

JohnDeep

John-Deep

I want to use this regex:

```<code>^\p{L}+[\p{L}\p{Pd}\p{Zs}']*\p{L}+$|^\p{L}+$
</code>```

My validation function is :

```<code> create or replace FUNCTION is_valid_fullName (str IN VARCHAR2) RETURN VARCHAR2 AS
        bln BOOLEAN;
    begin
     if regexp_like(str, '^\p{L}+[\p{L}\p{Pd}\p{Zs}']*\p{L}+$|^\p{L}+$') then

            return 1;
      else
        return 0;
     end if;
     end;
</code>```

However I have a problem with syntax.

PLS-00103: Encountered the symbol "]" when ...

How can I solve this?

答:
```<code>regexp_like(str, '^\p{L}+[\p{L}\p{Pd}\p{Zs}']*\p{L}+$|^\p{L}+$')
</code>```

I think it's the second single quote just between p{Zs} and ]*\p

Edit:
When doing regex I like online too like,  : regexTester or regex101
There is example for some useful regex too.

Body:
I'm working on a fullName validation function, examples that can go are :

John Deep

JohnDeep

John-Deep

I want to use this regex:

^\p{L}+[\p{L}\p{Pd}\p{Zs}']*\p{L}+$|^\p{L}+$

My validation function is :

 create or replace FUNCTION is_valid_fullName (str IN VARCHAR2) RETURN VARCHAR2 AS
        bln BOOLEAN;
    begin
     if regexp_like(str, '^\p{L}+[\p{L}\p{Pd}\p{Zs}']*\p{L}+$|^\p{L}+$') then

            return 1;
      else
        return 0;
     end if;
     end;

However I have a problem with syntax.

PLS-00103: Encountered the symbol "]" when ...

How can I solve this?

Body:
regexp_like(str, '^\p{L}+[\p{L}\p{Pd}\p{Zs}']*\p{L}+$|^\p{L}+$')

I think it's the second single quote just between p{Zs} and ]*\p

Edit:
When doing regex I like online too like,  : regexTester or regex101
There is example for some useful regex too.


问:
Kafka console Consume Command not accepting bootstrap-servers
I have installed Kafka on my windows machine. My Kafka version is kafka_2.12-2.4.0.
I have started the Zookeeper server, then Kafka server then creates the topic and then produces the message to created Topic. Till here everything is fine.
But when I run the Consume command, it is giving me below error.

'--bootstrap-servers' is not recognized as an internal or external
  command, operable program or batch file.

I am using the below command.

```<code>.\bin\windows\kafka-console-consumer.bat --bootstrap-servers localhost:9092 --topic TEST_TOPIC --from-beginning
</code>```

Please suggest me what could be the problem.

答:
You should use --bootstrap-server instead of --bootstrap-servers (note 's' at the end):

Try:

```<code>kafka/bin/kafka-console-consumer.bat \
    --bootstrap-server localhost:9092 \
    --topic TEST_TOPIC \
    --from-beginning
</code>```

Body:
I have installed Kafka on my windows machine. My Kafka version is kafka_2.12-2.4.0.
I have started the Zookeeper server, then Kafka server then creates the topic and then produces the message to created Topic. Till here everything is fine.
But when I run the Consume command, it is giving me below error.

'--bootstrap-servers' is not recognized as an internal or external
  command, operable program or batch file.

I am using the below command.

.\bin\windows\kafka-console-consumer.bat --bootstrap-servers localhost:9092 --topic TEST_TOPIC --from-beginning

Please suggest me what could be the problem.

Body:
You should use --bootstrap-server instead of --bootstrap-servers (note 's' at the end):

Try:

kafka/bin/kafka-console-consumer.bat \
    --bootstrap-server localhost:9092 \
    --topic TEST_TOPIC \
    --from-beginning


问:
Animate images in uiimageview
How to animate the images from web service. I got the code to animate the images from bundle.How to load the images from the url  an array

That code is attached below

```<code>UIImageView* animatedImageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
animatedImageView.animationImages = [NSArray arrayWithObjects:
                               [UIImage imageNamed:@"image1.gif"],
                               [UIImage imageNamed:@"image2.gif"],
                               [UIImage imageNamed:@"image3.gif"],
                               [UIImage imageNamed:@"image4.gif"], nil];
animatedImageView.animationDuration = 1.0f;
animatedImageView.animationRepeatCount = 0;
[animatedImageView startAnimating];
[self.view addSubview: animatedImageView];
</code>```

答:
Got a Perfect code for animation
can automatically change images in image view in swift4

```<code>class ViewController: UIViewController {

var imgarray = [UIImage(named:"f1.png")!,
                UIImage(named:"f2.png")!,
                UIImage(named:"f3.png")!,
                UIImage(named:"f4.png")!,
                UIImage(named:"f5.png")!,
                UIImage(named:"index1.png")!,
                UIImage(named:"index2.png")!,
                UIImage(named:"index3.png")!]

@IBOutlet weak var imgview: UIImageView!
override func viewDidLoad() {
    super.viewDidLoad()

    self.imgview.animationImages = imgarray
    self.imgview.animationDuration = 10.0
    self.imgview.animationRepeatCount = 0
    self.imgview.startAnimating()
    }
}
</code>```

Title: Animate images in uiimageview

Body:
How to animate the images from web service. I got the code to animate the images from bundle.How to load the images from the url  an array

That code is attached below

UIImageView* animatedImageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
animatedImageView.animationImages = [NSArray arrayWithObjects:
                               [UIImage imageNamed:@"image1.gif"],
                               [UIImage imageNamed:@"image2.gif"],
                               [UIImage imageNamed:@"image3.gif"],
                               [UIImage imageNamed:@"image4.gif"], nil];
animatedImageView.animationDuration = 1.0f;
animatedImageView.animationRepeatCount = 0;
[animatedImageView startAnimating];
[self.view addSubview: animatedImageView];

Body:
Got a Perfect code for animation
can automatically change images in image view in swift4

class ViewController: UIViewController {

var imgarray = [UIImage(named:"f1.png")!,
                UIImage(named:"f2.png")!,
                UIImage(named:"f3.png")!,
                UIImage(named:"f4.png")!,
                UIImage(named:"f5.png")!,
                UIImage(named:"index1.png")!,
                UIImage(named:"index2.png")!,
                UIImage(named:"index3.png")!]

@IBOutlet weak var imgview: UIImageView!
override func viewDidLoad() {
    super.viewDidLoad()

    self.imgview.animationImages = imgarray
    self.imgview.animationDuration = 10.0
    self.imgview.animationRepeatCount = 0
    self.imgview.startAnimating()
    }
}


问:
Retrieve Request Payload from Post Request
So I made a JavaScript Post Request with ajax (axios) which looks like this:

```<code>axios({
        method: 'post',
        url: 'placeholder-url',
        data: {
            test1: 'test',
            test2: 3
        }
    }).then(response => (console.log(response)));
</code>```

Which correctly fills the Request Payload:

The Request definitely Arrives correctly, because I can receive a response and i can successfully send Query Parameters in the Url, however i can't read the request payload.

$_POST, $_GET, $_REQUEST, $this->arguments, $this->request do not contain them and file_get_contents('php://input') is empty.

Here's my TypoScript Configuration:

```<code>ajax = PAGE
ajax {
    config {
        disableAllHeaderCode = 1
        //additionalHeaders = Content-type:application/json
        xhtml_cleaning = 0
        admPanel = 0
        debug = 0
        no_cache = 1
    }
    typeNum = 1000
    10 < tt_content.list.20.ext_action
}
</code>```

How can i retrieve the content of the Request Payload?

答:
Whenever I use an ActionController that needs direct access to GET/POST-Parameters, I use

```<code>TYPO3\CMS\Core\Utility\GeneralUtility::_GP('parameterName')
</code>```

Do not bother inspecting $_GET or $POST, but let the framework do the work for you (More info on _GP()).

Body:
So I made a JavaScript Post Request with ajax (axios) which looks like this:

axios({
        method: 'post',
        url: 'placeholder-url',
        data: {
            test1: 'test',
            test2: 3
        }
    }).then(response => (console.log(response)));

Which correctly fills the Request Payload:

The Request definitely Arrives correctly, because I can receive a response and i can successfully send Query Parameters in the Url, however i can't read the request payload.

$_POST, $_GET, $_REQUEST, $this->arguments, $this->request do not contain them and file_get_contents('php://input') is empty.

Here's my TypoScript Configuration:

ajax = PAGE
ajax {
    config {
        disableAllHeaderCode = 1
        //additionalHeaders = Content-type:application/json
        xhtml_cleaning = 0
        admPanel = 0
        debug = 0
        no_cache = 1
    }
    typeNum = 1000
    10 < tt_content.list.20.ext_action
}

How can i retrieve the content of the Request Payload?

Body:
Whenever I use an ActionController that needs direct access to GET/POST-Parameters, I use

TYPO3\CMS\Core\Utility\GeneralUtility::_GP('parameterName')

Do not bother inspecting $_GET or $POST, but let the framework do the work for you (More info on _GP()).


问:
How to replace special character in string with tcl script?
In file.txt

```<code>obj = "hi/this/is[1]/script"
</code>```

convert the string to

```<code>obj = "hi/this/is\[1]/script"
</code>```

Is there a way to do this in tcl?

答:
One way is using string map:

```<code>% set obj {obj = "hi/this/is[1]/script"}
obj = "hi/this/is[1]/script"
% string map {\[ \\\[} $obj
obj = "hi/this/is\[1]/script"
</code>```

Body:
In file.txt

obj = "hi/this/is[1]/script"

convert the string to

obj = "hi/this/is\[1]/script"

Is there a way to do this in tcl?

Body:
One way is using string map:

% set obj {obj = "hi/this/is[1]/script"}
obj = "hi/this/is[1]/script"
% string map {\[ \\\[} $obj
obj = "hi/this/is\[1]/script"


问:
how to assign values to an array using .subscribe in angular?
I am using a HttpClient calling.I am trying to assign values to posts[] which i hav defined as type any.

I am getting error as follows:

The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
    Type 'Object' is missing the following properties from type 'any[]': length, pop, push, concat, and 26 more.

My code for posts.component.html

import { Component, OnInit } from '@angular/core';
import { HttpClientModule, HttpClient } from '@angular/common/http';

@Component({
  selector: 'app-posts',
  templateUrl: './posts.component.html',
  styleUrls: ['./posts.component.css']
})
export class PostsComponent implements OnInit {

  posts: any[];

  constructor(http:HttpClient) {

    http.get('http://jsonplaceholder.typicode.com/posts').subscribe(response =>{
      this.posts=response;})
  }

  ngOnInit(): void {
  }

}
```

答:
You have to specify the type of the response:</p>

```<code>http.get<any[]>('http://jsonplaceholder.typicode.com/posts').subscribe(response => {
  this.posts = response;
})
</code>```

Body:
You have to specify the type of the response:

http.get<any[]>('http://jsonplaceholder.typicode.com/posts').subscribe(response => {
  this.posts = response;
})


问:
Python3 not recogninzing face_recognition as a module
I am trying to use the implement the face_recognition module, so far without success. When I try to run it with an import in python it just says that there is no such module, however when i just try to run face_recognition on it's own it works just fine.</p>

答:
Case 1: Same directory name

Maybe your main folder name is face_recognition. If that's the case, then try to change it because if you try to import it, the python will import it from your main folder rather than importing it from the package folder.

Case 2: Permission

If you're using Linux, then make sure that the package folder is accessible. To verify that this the issue, try to run the program with elevated privileges using sudo command. You can try using the --user flag with pip (pip install face_recognition --user).

Case 3: Environment variables

It might be the case that your environment variables are not updated. May reference to the package folder is not present. That's why your python interpreter is unable to find the package. For path details:

import sys
print(sys.path)
```

Using this, you will get an idea of whether your interpreter searches for the package or not.

Body:
Case 1: Same directory name

Maybe your main folder name is face_recognition. If that's the case, then try to change it because if you try to import it, the python will import it from your main folder rather than importing it from the package folder.

Case 2: Permission

If you're using Linux, then make sure that the package folder is accessible. To verify that this the issue, try to run the program with elevated privileges using sudo command. You can try using the --user flag with pip (pip install face_recognition --user).

Case 3: Environment variables

It might be the case that your environment variables are not updated. May reference to the package folder is not present. That's why your python interpreter is unable to find the package. For path details:

import sys
print(sys.path)

Using this, you will get an idea of whether your interpreter searches for the package or not.


问:
When should copy-local be set to true and when should it not?
I am wondering if there are any heuristics for when to set copy-local=true for references?

If referenced types are only used internally can I set copy-local to true but if referenced types are exposed as parameters or return values I set copy-local to false and indicate that a specific version of the dependency should be referenced when my library should be used?

Can anyone clarify this for me?

答:
This option only affects build phase. It just copies the reference to local directory of the built assembly.

If another assembly (T) wants to use a method from the assembly you are building (A) which has return type or parameters from another referenced assembly (R), it (T) should be able to access that assembly (R). It might be able to do so without doing anything special if the referenced assembly (R) is installed in GAC. Otherwise, it needs a local copy of that.

OwnerDisplayName: Fadeproof

LastEditorDisplayName: Gortok

OwnerDisplayName: Mehrdad Afshari


问:
How to create horizontal scrolling grid view in android?
I want to create a gridview (not recycler view) that can scroll horizontally. How do I do that?

The benefit is that you avoid adding recycler view from support library and minimize apk size.

答:
Answer 1

If the items in the list are limited (if it contain large bitmaps creating even 10 such items could result in stack overflow, if it's just text, you might go on for 50-100 items or even more), use HorizontalScrollView.

```<code>            <HorizontalScrollView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@android:color/transparent"
                android:padding="10dp">

                <LinearLayout
                    android:id="@+id/hgrid"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@android:color/transparent"
                    android:orientation="horizontal" />
            </HorizontalScrollView>
</code>```

Then add items to the LinearLayout in your onCreate() method

```<code>LinearLayout layout = findViewById('hgrid');
if(layout.getChildCount()==0){
// add views to layout
}
</code>```

Body:
Answer 1

If the items in the list are limited (if it contain large bitmaps creating even 10 such items could result in stack overflow, if it's just text, you might go on for 50-100 items or even more), use HorizontalScrollView.

            <HorizontalScrollView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@android:color/transparent"
                android:padding="10dp">

                <LinearLayout
                    android:id="@+id/hgrid"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@android:color/transparent"
                    android:orientation="horizontal" />
            </HorizontalScrollView>

Then add items to the LinearLayout in your onCreate() method

LinearLayout layout = findViewById('hgrid');
if(layout.getChildCount()==0){
// add views to layout
}


问:
How to find out which DataGridView rows are currently onscreen?
In my C# (2010) application I have a DataGridView in Virtual Mode which holds several thousand rows.  Is it possible to find out which cells are onscreen at the moment?</p>

答:
```<code>    private bool RowIsVisible(DataGridViewRow row)
    {
        DataGridView dgv = row.DataGridView;
        int firstVisibleRowIndex = dgv.FirstDisplayedCell.RowIndex;
        int lastVisibleRowIndex = firstVisibleRowIndex + dgv.DisplayedRowCount(false) - 1;
        return row.Index >= firstVisibleRowIndex && row.Index <= lastVisibleRowIndex;
    }
</code>```

IMHO
Regards

Body:
    private bool RowIsVisible(DataGridViewRow row)
    {
        DataGridView dgv = row.DataGridView;
        int firstVisibleRowIndex = dgv.FirstDisplayedCell.RowIndex;
        int lastVisibleRowIndex = firstVisibleRowIndex + dgv.DisplayedRowCount(false) - 1;
        return row.Index >= firstVisibleRowIndex && row.Index <= lastVisibleRowIndex;
    }

IMHO
Regards


问:
how to open pdf in xmarine android?
Hi am new in xmarine android,I am working in a xmarin android c# project to open a pdf file which is in the mobile internal storage "testpdf" folder. a dummy pdf file is in the "testpdf" folder. The app is asking user to choose preferred pdf viewer apps to open that pdf. but after selecting the preferred apps pdf is not showing. I have followed the below steps:

add FileProvider to the app manifest:

```<code><?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="RunTimePerm.RunTimePerm" android:versionCode="1" android:versionName="1.0" android:installLocation="auto">
    <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="27" />
    <application android:allowBackup="true" android:label="@string/app_name" android:supportsRtl="true">
        <provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
        </provider>
    </application>
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
</manifest>
</code>```

also created Resources\xml folder with file_paths.xml

```<code><?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
  <external-files-path name="root" path="."/>
  <external-files-path name="files" path="files" />
  <external-path name="external_files" path="."/>
</paths>
</code>```

then added the reference Xmarin.Android.Support.V4 from NuGet.

then the following code:

```<code>var externalPath = global::Android.OS.Environment.ExternalStorageDirectory.Path + "/testpdf";
                Java.IO.File file = new Java.IO.File(externalPath, "test.pdf");
                if (file.Exists())
                {
                    var context = Android.App.Application.Context;
                    try
                    {
                        Android.Net.Uri pdfPath = Android.Support.V4.Content.FileProvider.GetUriForFile(context, context.ApplicationContext.PackageName + ".provider", file);
                        context.GrantUriPermission(context.PackageName, pdfPath, ActivityFlags.GrantReadUriPermission);
                        Intent intent = new Intent();
                        intent.SetFlags(ActivityFlags.GrantReadUriPermission);
                        intent.SetAction(Android.Content.Intent.ActionView);
                        intent.SetFlags(ActivityFlags.NoHistory);
                        intent.SetFlags(ActivityFlags.ClearWhenTaskReset | ActivityFlags.NewTask);
                        intent.SetDataAndType(pdfPath, "application/pdf");
                        context.StartActivity(intent);
                    }
                    catch (Exception ex)
                    {
                        Toast.MakeText(Application.Context, "problem", ToastLength.Long).Show();
                    }
                }
</code>```

I have 3 options present in my mobile to open a pdf to test the scenario, i) wps office ii) Drive PDF viewer iii)Adobe Acrobat Reader.After opening wps office -- it is saying "wps office is determining the type of document" and PDF is not showing. In Drive PDF viewer-- after opening it is showing nothing. and in acrobat reader-- it is saying "file colud not be accessed. check your location" but the pdf is present in the correct location.how to resolve?

答:
got the solution,</p>

```<code>try
                    {
                        string extension = MimeTypeMap.GetFileExtensionFromUrl(Android.Net.Uri.FromFile(file).ToString());
                        string mimeType = MimeTypeMap.Singleton.GetMimeTypeFromExtension(extension);
                        Intent intent = new Intent(Intent.ActionView);
                        intent.SetFlags(ActivityFlags.ClearTop | ActivityFlags.NewTask);
                        Android.Net.Uri path = FileProvider.GetUriForFile(Application.Context, Android.App.Application.Context.PackageName + ".provider", file);
                        intent.SetDataAndType(path, mimeType);
                        intent.AddFlags(ActivityFlags.GrantReadUriPermission);
                        Application.Context.StartActivity(Intent.CreateChooser(intent, "Choose App"));
                    }
                    catch (Exception ex)
                    {
                        Toast.MakeText(Application.Context, "problem", ToastLength.Long).Show();
                    }
</code>```

Title: how to open pdf in xmarine android?

Body:
Hi am new in xmarine android,I am working in a xmarin android c# project to open a pdf file which is in the mobile internal storage "testpdf" folder. a dummy pdf file is in the "testpdf" folder. The app is asking user to choose preferred pdf viewer apps to open that pdf. but after selecting the preferred apps pdf is not showing. I have followed the below steps:

add FileProvider to the app manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="RunTimePerm.RunTimePerm" android:versionCode="1" android:versionName="1.0" android:installLocation="auto">
    <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="27" />
    <application android:allowBackup="true" android:label="@string/app_name" android:supportsRtl="true">
        <provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
        </provider>
    </application>
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
</manifest>

also created Resources\xml folder with file_paths.xml

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
  <external-files-path name="root" path="."/>
  <external-files-path name="files" path="files" />
  <external-path name="external_files" path="."/>
</paths>

then added the reference Xmarin.Android.Support.V4 from NuGet.

then the following code:

var externalPath = global::Android.OS.Environment.ExternalStorageDirectory.Path + "/testpdf";
                Java.IO.File file = new Java.IO.File(externalPath, "test.pdf");
                if (file.Exists())
                {
                    var context = Android.App.Application.Context;
                    try
                    {
                        Android.Net.Uri pdfPath = Android.Support.V4.Content.FileProvider.GetUriForFile(context, context.ApplicationContext.PackageName + ".provider", file);
                        context.GrantUriPermission(context.PackageName, pdfPath, ActivityFlags.GrantReadUriPermission);
                        Intent intent = new Intent();
                        intent.SetFlags(ActivityFlags.GrantReadUriPermission);
                        intent.SetAction(Android.Content.Intent.ActionView);
                        intent.SetFlags(ActivityFlags.NoHistory);
                        intent.SetFlags(ActivityFlags.ClearWhenTaskReset | ActivityFlags.NewTask);
                        intent.SetDataAndType(pdfPath, "application/pdf");
                        context.StartActivity(intent);
                    }
                    catch (Exception ex)
                    {
                        Toast.MakeText(Application.Context, "problem", ToastLength.Long).Show();
                    }
                }

I have 3 options present in my mobile to open a pdf to test the scenario, i) wps office ii) Drive PDF viewer iii)Adobe Acrobat Reader.After opening wps office -- it is saying "wps office is determining the type of document" and PDF is not showing. In Drive PDF viewer-- after opening it is showing nothing. and in acrobat reader-- it is saying "file colud not be accessed. check your location" but the pdf is present in the correct location.how to resolve?

Body:
got the solution,

try
                    {
                        string extension = MimeTypeMap.GetFileExtensionFromUrl(Android.Net.Uri.FromFile(file).ToString());
                        string mimeType = MimeTypeMap.Singleton.GetMimeTypeFromExtension(extension);
                        Intent intent = new Intent(Intent.ActionView);
                        intent.SetFlags(ActivityFlags.ClearTop | ActivityFlags.NewTask);
                        Android.Net.Uri path = FileProvider.GetUriForFile(Application.Context, Android.App.Application.Context.PackageName + ".provider", file);
                        intent.SetDataAndType(path, mimeType);
                        intent.AddFlags(ActivityFlags.GrantReadUriPermission);
                        Application.Context.StartActivity(Intent.CreateChooser(intent, "Choose App"));
                    }
                    catch (Exception ex)
                    {
                        Toast.MakeText(Application.Context, "problem", ToastLength.Long).Show();
                    }


问:
WildFly 18 update Hibernate to 5.4.12.Final
I am trying to update the Hibernate version of my WildFly 18.0.1 server. But I encounter a problem with Infinispan, which is used for caching.
The classic WildFly distribution hast Hibernate 5.3.13.Final and Infinispan 9.4.16.Final.

In order to update I use the wildfly-server-provisioning-maven-plugin with the following server-provisioning.xml:

```<code><server-provisioning xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="urn:wildfly:server-provisioning:1.2" extract-schemas="true" copy-module-artifacts="true"
                 extract-schemas-groups="org.jboss.as org.wildfly org.wildfly.core org.jboss.metadata">
<feature-packs>
    <feature-pack
            groupId="org.hibernate"
            artifactId="hibernate-orm-jbossmodules"
            version="5.4.12.Final" />
    <feature-pack
            groupId="org.hibernate"
            artifactId="hibernate-search-jbossmodules-orm"
            version="5.10.7.Final" />
    <feature-pack
            groupId="org.infinispan"
            artifactId="infinispan-feature-pack-client"
            version="10.1.2.Final" />
    <feature-pack
            groupId="org.infinispan"
            artifactId="infinispan-feature-pack-client"
            version="10.1.2.Final" />
    <feature-pack
            groupId="org.infinispan"
            artifactId="infinispan-feature-pack-embedded"
            version="10.1.2.Final" />
    <feature-pack
            groupId="org.infinispan"
            artifactId="infinispan-feature-pack-embedded-query"
            version="10.1.2.Final" />
    <feature-pack
            groupId="org.infinispan"
            artifactId="infinispan-feature-pack-commons"
            version="10.1.2.Final" />
    <feature-pack
            groupId="org.infinispan"
            artifactId="infinispan-feature-pack-wf-modules"
            version="10.1.2.Final" />
    <feature-pack
            groupId="org.hibernate.lucene-jbossmodules"
            artifactId="lucene-jbossmodules"
            version="5.5.5.hibernate06"/>
    <feature-pack
            groupId="org.wildfly"
            artifactId="wildfly-feature-pack"
            version="${wildfly.version}" />
</feature-packs>
</code>```

I have tried different verions like 9.4.18.Final or 10.0.1.Final. Using the built WildFly with the new versions I get the following exception:

```<code>15:40:15,510 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service org.wildfly.clustering.infinispan.cache-container.hibernate: org.jboss.msc.service.StartException in service org.wildfly.clustering.infinispan.cache-container.hibernate: java.lang.NoClassDefFoundError: Failed to link org/infinispan/hibernate/cache/commons/util/SecondLevelCacheMetadataModuleFinder (Module "org.infinispan.hibernate-cache" version 9.4.16.Final from local module loader @5f2108b5 (finder: local module finder @31a5c39e (roots: D:\Dev\Servers\wildfly-hibernate-5.4.11\modules,D:\Dev\Servers\wildfly-hibernate-5.4.11\modules\system\layers\base,D:\Dev\Servers\wildfly-hibernate-5.4.11\modules\system\add-ons\ispn))): org/infinispan/factories/components/ModuleMetadataFileFinder
at org.wildfly.clustering.service.FunctionalService.start(FunctionalService.java:70)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoClassDefFoundError: Failed to link org/infinispan/hibernate/cache/commons/util/SecondLevelCacheMetadataModuleFinder (Module "org.infinispan.hibernate-cache" version 9.4.16.Final from local module loader @5f2108b5 (finder: local module finder @31a5c39e (roots: D:\Dev\Servers\wildfly-hibernate-5.4.11\modules,D:\Dev\Servers\wildfly-hibernate-5.4.11\modules\system\layers\base,D:\Dev\Servers\wildfly-hibernate-5.4.11\modules\system\add-ons\ispn))): org/infinispan/factories/components/ModuleMetadataFileFinder
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:423)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:555)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:339)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:126)
at org.jboss.modules.Module.loadModuleClass(Module.java:731)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:247)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:370)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at org.infinispan.commons.util.ServiceFinder.addServices(ServiceFinder.java:63)
at org.infinispan.commons.util.ServiceFinder.load(ServiceFinder.java:44)
at org.infinispan.util.ModuleProperties.getModuleMetadataFiles(ModuleProperties.java:47)
at org.infinispan.factories.GlobalComponentRegistry.<init>(GlobalComponentRegistry.java:107)
at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:257)
at org.jboss.as.clustering.infinispan.subsystem.CacheContainerServiceConfigurator.get(CacheContainerServiceConfigurator.java:100)
at org.jboss.as.clustering.infinispan.subsystem.CacheContainerServiceConfigurator.get(CacheContainerServiceConfigurator.java:73)
at org.wildfly.clustering.service.FunctionalService.start(FunctionalService.java:67)
... 8 more
</code>```

How I understand it this exception is thrown because the module org.infinispan.hibernate-cache is missing in the update. Since I could not figure out how to update it, I added the jars manually. If I am using Infinispan 10.1.2.Final and add the hibernate-cache module I still get an exception:

```<code>15:43:53,638 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service org.wildfly.clustering.infinispan.cache-container.hibernate: org.jboss.msc.service.StartException in service org.wildfly.clustering.infinispan.cache-container.hibernate: org.infinispan.commons.CacheException: Unable to load component metadata!
at org.wildfly.clustering.service.FunctionalService.start(FunctionalService.java:70)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.infinispan.commons.CacheException: Unable to load component metadata!
at org.infinispan.factories.components.ComponentMetadataRepo.initialize(ComponentMetadataRepo.java:175)
at org.infinispan.factories.GlobalComponentRegistry.<init>(GlobalComponentRegistry.java:107)
at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:257)
at org.jboss.as.clustering.infinispan.subsystem.CacheContainerServiceConfigurator.get(CacheContainerServiceConfigurator.java:100)
at org.jboss.as.clustering.infinispan.subsystem.CacheContainerServiceConfigurator.get(CacheContainerServiceConfigurator.java:73)
at org.wildfly.clustering.service.FunctionalService.start(FunctionalService.java:67)
... 8 more
Caused by: java.lang.NullPointerException
at org.infinispan.factories.components.ComponentMetadataRepo.readMetadata(ComponentMetadataRepo.java:44)
at org.infinispan.factories.components.ComponentMetadataRepo.initialize(ComponentMetadataRepo.java:173)
... 13 more
</code>```

I am not sure about this exception, but it seems to indicates wrong configuration. I am using the default standalone.xml from WildFly:

```<code>    <subsystem xmlns="urn:jboss:domain:infinispan:9.0">
        <cache-container name="web" default-cache="passivation" module="org.wildfly.clustering.web.infinispan">
            <local-cache name="passivation">
                <locking isolation="REPEATABLE_READ" />
                <transaction mode="BATCH" />
                <file-store passivation="true" purge="false" />
            </local-cache>
            <local-cache name="sso">
                <locking isolation="REPEATABLE_READ" />
                <transaction mode="BATCH" />
            </local-cache>
            <local-cache name="routing" />
        </cache-container>
        <cache-container name="server" default-cache="default" module="org.wildfly.clustering.server">
            <local-cache name="default">
                <transaction mode="BATCH" />
            </local-cache>
        </cache-container>
        <cache-container name="ejb" aliases="sfsb" default-cache="passivation" module="org.wildfly.clustering.ejb.infinispan">
            <local-cache name="passivation">
                <locking isolation="REPEATABLE_READ" />
                <transaction mode="BATCH" />
                <file-store passivation="true" purge="false" />
            </local-cache>
        </cache-container>
        <cache-container name="hibernate" module="org.infinispan.hibernate-cache">
            <local-cache name="entity">
                <object-memory size="10000" />
                <expiration max-idle="100000" />
            </local-cache>
            <local-cache name="local-query">
                <object-memory size="10000" />
                <expiration max-idle="100000" />
            </local-cache>
            <local-cache name="timestamps" />
        </cache-container>
    </subsystem>
</code>```

If there are changes in this configuration schema I was not able to figure out the correct schema to use here.
To put everything in a nutshell I would like to know which Infinispan version is compatible with the current Hibernate version and what changes I have to do if I have to update Infinispan to 10.1.2.Final.

答: Replacing Hibernate and Infinispan inside of WildFly is a non trivial endeavour, especially since there are server internals which depend on these components (the JPA susbsystem, the clustering subsystem, etc). If you want to use newer components you should either package them in your deployment or create a parallel module structure using a dedicated slot (instead of 'main') under the modules/system/add-ons hierarchy, and importing them via the deployment structure XML or the MANIFEST. Be aware, however, that in this case you will lose any "assistance" from the server (e.g. automatic detection of persistence units, caches defined outside of the application)</p>

Body:
I am trying to update the Hibernate version of my WildFly 18.0.1 server. But I encounter a problem with Infinispan, which is used for caching.
The classic WildFly distribution hast Hibernate 5.3.13.Final and Infinispan 9.4.16.Final.

In order to update I use the wildfly-server-provisioning-maven-plugin with the following server-provisioning.xml:

<server-provisioning xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="urn:wildfly:server-provisioning:1.2" extract-schemas="true" copy-module-artifacts="true"
                 extract-schemas-groups="org.jboss.as org.wildfly org.wildfly.core org.jboss.metadata">
<feature-packs>
    <feature-pack
            groupId="org.hibernate"
            artifactId="hibernate-orm-jbossmodules"
            version="5.4.12.Final" />
    <feature-pack
            groupId="org.hibernate"
            artifactId="hibernate-search-jbossmodules-orm"
            version="5.10.7.Final" />
    <feature-pack
            groupId="org.infinispan"
            artifactId="infinispan-feature-pack-client"
            version="10.1.2.Final" />
    <feature-pack
            groupId="org.infinispan"
            artifactId="infinispan-feature-pack-client"
            version="10.1.2.Final" />
    <feature-pack
            groupId="org.infinispan"
            artifactId="infinispan-feature-pack-embedded"
            version="10.1.2.Final" />
    <feature-pack
            groupId="org.infinispan"
            artifactId="infinispan-feature-pack-embedded-query"
            version="10.1.2.Final" />
    <feature-pack
            groupId="org.infinispan"
            artifactId="infinispan-feature-pack-commons"
            version="10.1.2.Final" />
    <feature-pack
            groupId="org.infinispan"
            artifactId="infinispan-feature-pack-wf-modules"
            version="10.1.2.Final" />
    <feature-pack
            groupId="org.hibernate.lucene-jbossmodules"
            artifactId="lucene-jbossmodules"
            version="5.5.5.hibernate06"/>
    <feature-pack
            groupId="org.wildfly"
            artifactId="wildfly-feature-pack"
            version="${wildfly.version}" />
</feature-packs>

I have tried different verions like 9.4.18.Final or 10.0.1.Final. Using the built WildFly with the new versions I get the following exception:

15:40:15,510 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service org.wildfly.clustering.infinispan.cache-container.hibernate: org.jboss.msc.service.StartException in service org.wildfly.clustering.infinispan.cache-container.hibernate: java.lang.NoClassDefFoundError: Failed to link org/infinispan/hibernate/cache/commons/util/SecondLevelCacheMetadataModuleFinder (Module "org.infinispan.hibernate-cache" version 9.4.16.Final from local module loader @5f2108b5 (finder: local module finder @31a5c39e (roots: D:\Dev\Servers\wildfly-hibernate-5.4.11\modules,D:\Dev\Servers\wildfly-hibernate-5.4.11\modules\system\layers\base,D:\Dev\Servers\wildfly-hibernate-5.4.11\modules\system\add-ons\ispn))): org/infinispan/factories/components/ModuleMetadataFileFinder
at org.wildfly.clustering.service.FunctionalService.start(FunctionalService.java:70)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoClassDefFoundError: Failed to link org/infinispan/hibernate/cache/commons/util/SecondLevelCacheMetadataModuleFinder (Module "org.infinispan.hibernate-cache" version 9.4.16.Final from local module loader @5f2108b5 (finder: local module finder @31a5c39e (roots: D:\Dev\Servers\wildfly-hibernate-5.4.11\modules,D:\Dev\Servers\wildfly-hibernate-5.4.11\modules\system\layers\base,D:\Dev\Servers\wildfly-hibernate-5.4.11\modules\system\add-ons\ispn))): org/infinispan/factories/components/ModuleMetadataFileFinder
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:423)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:555)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:339)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:126)
at org.jboss.modules.Module.loadModuleClass(Module.java:731)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:247)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:370)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at org.infinispan.commons.util.ServiceFinder.addServices(ServiceFinder.java:63)
at org.infinispan.commons.util.ServiceFinder.load(ServiceFinder.java:44)
at org.infinispan.util.ModuleProperties.getModuleMetadataFiles(ModuleProperties.java:47)
at org.infinispan.factories.GlobalComponentRegistry.<init>(GlobalComponentRegistry.java:107)
at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:257)
at org.jboss.as.clustering.infinispan.subsystem.CacheContainerServiceConfigurator.get(CacheContainerServiceConfigurator.java:100)
at org.jboss.as.clustering.infinispan.subsystem.CacheContainerServiceConfigurator.get(CacheContainerServiceConfigurator.java:73)
at org.wildfly.clustering.service.FunctionalService.start(FunctionalService.java:67)
... 8 more

How I understand it this exception is thrown because the module org.infinispan.hibernate-cache is missing in the update. Since I could not figure out how to update it, I added the jars manually. If I am using Infinispan 10.1.2.Final and add the hibernate-cache module I still get an exception:

15:43:53,638 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service org.wildfly.clustering.infinispan.cache-container.hibernate: org.jboss.msc.service.StartException in service org.wildfly.clustering.infinispan.cache-container.hibernate: org.infinispan.commons.CacheException: Unable to load component metadata!
at org.wildfly.clustering.service.FunctionalService.start(FunctionalService.java:70)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.infinispan.commons.CacheException: Unable to load component metadata!
at org.infinispan.factories.components.ComponentMetadataRepo.initialize(ComponentMetadataRepo.java:175)
at org.infinispan.factories.GlobalComponentRegistry.<init>(GlobalComponentRegistry.java:107)
at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:257)
at org.jboss.as.clustering.infinispan.subsystem.CacheContainerServiceConfigurator.get(CacheContainerServiceConfigurator.java:100)
at org.jboss.as.clustering.infinispan.subsystem.CacheContainerServiceConfigurator.get(CacheContainerServiceConfigurator.java:73)
at org.wildfly.clustering.service.FunctionalService.start(FunctionalService.java:67)
... 8 more
Caused by: java.lang.NullPointerException
at org.infinispan.factories.components.ComponentMetadataRepo.readMetadata(ComponentMetadataRepo.java:44)
at org.infinispan.factories.components.ComponentMetadataRepo.initialize(ComponentMetadataRepo.java:173)
... 13 more

I am not sure about this exception, but it seems to indicates wrong configuration. I am using the default standalone.xml from WildFly:

    <subsystem xmlns="urn:jboss:domain:infinispan:9.0">
        <cache-container name="web" default-cache="passivation" module="org.wildfly.clustering.web.infinispan">
            <local-cache name="passivation">
                <locking isolation="REPEATABLE_READ" />
                <transaction mode="BATCH" />
                <file-store passivation="true" purge="false" />
            </local-cache>
            <local-cache name="sso">
                <locking isolation="REPEATABLE_READ" />
                <transaction mode="BATCH" />
            </local-cache>
            <local-cache name="routing" />
        </cache-container>
        <cache-container name="server" default-cache="default" module="org.wildfly.clustering.server">
            <local-cache name="default">
                <transaction mode="BATCH" />
            </local-cache>
        </cache-container>
        <cache-container name="ejb" aliases="sfsb" default-cache="passivation" module="org.wildfly.clustering.ejb.infinispan">
            <local-cache name="passivation">
                <locking isolation="REPEATABLE_READ" />
                <transaction mode="BATCH" />
                <file-store passivation="true" purge="false" />
            </local-cache>
        </cache-container>
        <cache-container name="hibernate" module="org.infinispan.hibernate-cache">
            <local-cache name="entity">
                <object-memory size="10000" />
                <expiration max-idle="100000" />
            </local-cache>
            <local-cache name="local-query">
                <object-memory size="10000" />
                <expiration max-idle="100000" />
            </local-cache>
            <local-cache name="timestamps" />
        </cache-container>
    </subsystem>

If there are changes in this configuration schema I was not able to figure out the correct schema to use here.
To put everything in a nutshell I would like to know which Infinispan version is compatible with the current Hibernate version and what changes I have to do if I have to update Infinispan to 10.1.2.Final.


问:
What's the difference between a Magento Website, a Store and a Store View?
I couldn't find a clear answer on this: What's the difference between a Magento Website and a Store View?</p>

答:
There's actually three things: A Website, a Store and a Store View.

The most important part about Websites is that each websites has its unique customer and order base.

Stores can be used to define for example different (looking) stores with the same information.

Store Views are mostly used to handle different languages on your website. You will typically have one Store View per language.