问:
How do I label the five-number summary of a boxplot using Matplotlib
I have created a box plot using Matplotlib. I am trying to label the five number summary of a box plot(Lower Quartile,median,Upper Quartile,minimum,maximum and outliers) using matplotlib library,but I have no idea on how to do it.Can someone help me out? Thanks in advance.

```<code>vehicle_class_ticks = np.arange(len(vehicle_class_unique))
plt.title('COE Quota grouped by categories')
plt.xlabel('Different Types of Vehicle Class')
plt.ylabel('Total Number of COE Quota')
plt.boxplot(Cat_quota_array.transpose(),labels=vehicle_class_unique,patch_artist=True)
plt.show()
print('-----------------------------------------------------------------------------------------------------------------------')
catA_min_value = min(catA_quota)
catA_max_value = max(catA_quota)
catA_median = np.median(catA_quota)
catA_upper_quartile = np.percentile(catA_quota,75)
catA_lower_quartile = np.percentile(catA_quota,25)
catA_interquartile = catA_upper_quartile - catA_lower_quartile
print('Category A shows a positively skewed box plot')
print(f'The Minimum COE Quota Value of Category A is {catA_min_value}')
print(f'The Maximum COE Quota Value of Category A is {catA_max_value}')
print(f'The Median Quota Value for Category A is {catA_median}')
print(f'The Lower Quartile Range Quota Value for Category A is {catA_lower_quartile}')
print(f'The Upper Quartile Range Quota Value for Category A is {catA_upper_quartile}')
print(f'The Interquartile range for Category A is {catA_interquartile}');print()

catB_min_value = min(catB_quota)
catB_max_value = max(catB_quota)
CatB_median = np.median(catB_quota)
catB_upper_quartile = np.percentile(catB_quota,75)
catB_lower_quartile = np.percentile(catB_quota,25)
catB_interquartile = catB_upper_quartile - catB_lower_quartile
print('Category B shows a positively skewed box plot')
print(f'The Minimum COE Quota Value of Category B is {catB_min_value}')
print(f'The Maximum COE Quota Value of Category B is {catB_max_value}')
print(f'The Median Quota Value for Category B is {CatB_median}')
print(f'The Lower Quartile Range Quota Value for Category B is {catB_lower_quartile}')
print(f'The Upper Quartile Range Quota value for Category B is {catB_upper_quartile}')
print(f'The Interquartile range for Category B is {catB_interquartile}');print()

catC_min_value = min(catC_quota)
catC_max_value = max(catC_quota)
CatC_median = np.median(catC_quota)
catC_upper_quartile = np.percentile(catC_quota,75)
catC_lower_quartile = np.percentile(catC_quota,25)
catC_interquartile = catC_upper_quartile - catC_lower_quartile
print('Category C shows a almost symmetrical box plot')
print(f'The Minimum COE Quota Value of Category C is {catC_min_value}')
print(f'The Maximum COE Quota Value of Category C is {catC_max_value}')
print(f'The Median Quota Value for Category C is {CatC_median}')
print(f'The Lower Quartile Range Quota Value for Category C is {catC_lower_quartile}')
print(f'The Upper Quartile Range Quota Value for Category C is {catC_upper_quartile}')
print(f'The Interquartile range for Category C is {catC_interquartile}')
print(f'Category C has shown to have outliers which falls around the 2000 range.');print()

catD_min_value = min(catD_quota)
catD_max_value = max(catD_quota)
CatD_median = np.median(catD_quota)
catD_upper_quartile = np.percentile(catD_quota,75)
catD_lower_quartile = np.percentile(catD_quota,25)
catD_interquartile = catD_upper_quartile - catD_lower_quartile
print('Category D shows a postively skewed box plot')
print(f'The Minimum COE Quota Value of Category D is {catD_min_value}')
print(f'The Maximum COE Quota Value of Category D is {catD_max_value}')
print(f'The Median Quota Value for Category D is {CatD_median}')
print(f'The Lower Quartile Range Quota Value for Category D is {catD_lower_quartile}')
print(f'The Upper Quartile Range Quota Value for Category D is {catD_upper_quartile}')
print(f'The Interquartile range for Category D is {catD_interquartile}')
print('Category D has shown to have multiple outliers from the estimated range of 1500 to 2100')
</code>```

Body:
I have created a box plot using Matplotlib. I am trying to label the five number summary of a box plot(Lower Quartile,median,Upper Quartile,minimum,maximum and outliers) using matplotlib library,but I have no idea on how to do it.Can someone help me out? Thanks in advance.

vehicle_class_ticks = np.arange(len(vehicle_class_unique))
plt.title('COE Quota grouped by categories')
plt.xlabel('Different Types of Vehicle Class')
plt.ylabel('Total Number of COE Quota')
plt.boxplot(Cat_quota_array.transpose(),labels=vehicle_class_unique,patch_artist=True)
plt.show()
print('-----------------------------------------------------------------------------------------------------------------------')
catA_min_value = min(catA_quota)
catA_max_value = max(catA_quota)
catA_median = np.median(catA_quota)
catA_upper_quartile = np.percentile(catA_quota,75)
catA_lower_quartile = np.percentile(catA_quota,25)
catA_interquartile = catA_upper_quartile - catA_lower_quartile
print('Category A shows a positively skewed box plot')
print(f'The Minimum COE Quota Value of Category A is {catA_min_value}')
print(f'The Maximum COE Quota Value of Category A is {catA_max_value}')
print(f'The Median Quota Value for Category A is {catA_median}')
print(f'The Lower Quartile Range Quota Value for Category A is {catA_lower_quartile}')
print(f'The Upper Quartile Range Quota Value for Category A is {catA_upper_quartile}')
print(f'The Interquartile range for Category A is {catA_interquartile}');print()

catB_min_value = min(catB_quota)
catB_max_value = max(catB_quota)
CatB_median = np.median(catB_quota)
catB_upper_quartile = np.percentile(catB_quota,75)
catB_lower_quartile = np.percentile(catB_quota,25)
catB_interquartile = catB_upper_quartile - catB_lower_quartile
print('Category B shows a positively skewed box plot')
print(f'The Minimum COE Quota Value of Category B is {catB_min_value}')
print(f'The Maximum COE Quota Value of Category B is {catB_max_value}')
print(f'The Median Quota Value for Category B is {CatB_median}')
print(f'The Lower Quartile Range Quota Value for Category B is {catB_lower_quartile}')
print(f'The Upper Quartile Range Quota value for Category B is {catB_upper_quartile}')
print(f'The Interquartile range for Category B is {catB_interquartile}');print()

catC_min_value = min(catC_quota)
catC_max_value = max(catC_quota)
CatC_median = np.median(catC_quota)
catC_upper_quartile = np.percentile(catC_quota,75)
catC_lower_quartile = np.percentile(catC_quota,25)
catC_interquartile = catC_upper_quartile - catC_lower_quartile
print('Category C shows a almost symmetrical box plot')
print(f'The Minimum COE Quota Value of Category C is {catC_min_value}')
print(f'The Maximum COE Quota Value of Category C is {catC_max_value}')
print(f'The Median Quota Value for Category C is {CatC_median}')
print(f'The Lower Quartile Range Quota Value for Category C is {catC_lower_quartile}')
print(f'The Upper Quartile Range Quota Value for Category C is {catC_upper_quartile}')
print(f'The Interquartile range for Category C is {catC_interquartile}')
print(f'Category C has shown to have outliers which falls around the 2000 range.');print()

catD_min_value = min(catD_quota)
catD_max_value = max(catD_quota)
CatD_median = np.median(catD_quota)
catD_upper_quartile = np.percentile(catD_quota,75)
catD_lower_quartile = np.percentile(catD_quota,25)
catD_interquartile = catD_upper_quartile - catD_lower_quartile
print('Category D shows a postively skewed box plot')
print(f'The Minimum COE Quota Value of Category D is {catD_min_value}')
print(f'The Maximum COE Quota Value of Category D is {catD_max_value}')
print(f'The Median Quota Value for Category D is {CatD_median}')
print(f'The Lower Quartile Range Quota Value for Category D is {catD_lower_quartile}')
print(f'The Upper Quartile Range Quota Value for Category D is {catD_upper_quartile}')
print(f'The Interquartile range for Category D is {catD_interquartile}')
print('Category D has shown to have multiple outliers from the estimated range of 1500 to 2100')


来源: stackexchange

问:
How create a LIVE Calendar with subscribe URL
Morning,
I would like to find a system to create a calendar that contains multiple events for a single user, these events are often updated with new information, I have a version that creates ICS files, but I always have problems with overwriting in case of updates, now I searched a bit on the internet and I read that in these cases it would be better to create a link where a user can subscribe and always receive the updated events, only I don't know what to do and I can't find instructions or examples of how to do it...

any advice?

ContentLicense: CC BY-SA 4.0


问:
Google Or tools Employee scheduling based on required number of employees to work in that shift
I am having an issue regarding scheduling in google or tools.

I am trying to build scheduler based on how many employees needed for a shift so during the day I need 10 and then from 17:00 to 20:00 (night shift) I may need anything from 10% to 100% of the employees working.

They can work a minimum from 8 hours a day to 12 hours.
They can work a minimum of 45 hours a week to 60 hours a week,
They can work a max of consecutive days then they need a day off.

Here is what I have so far

```<code>public class ShiftSchedulingSat
{
    static void Main(string[] args)
    {
        SolveShiftScheduling();
    }

    static void SolveShiftScheduling()
    {
        int numEmployees = 15;
        int numWeeks = 1;
        //Shift day "0" day off
        //Shift day "8" hours for the day
        //Shift day "12" hours for the day
        var shifts = new[] { "0", "8", "12" };
        var numDays = numWeeks * 7;
        var numShifts = shifts.Length;
        LinearExprBuilder obj = LinearExpr.NewBuilder();

        //The Demands needed
        var weeklyCoverDemands = new int[][] {
            new[] { 12, 12 }, // Monday
            new[] { 12, 12 }, // Tuesday
            new[] { 12, 12 }, // Wednesday
            new[] { 12, 12 }, // Thursday
            new[] { 12, 12 }, // Friday
            new[] { 12, 12 }, // Saturday
            new[] { 12, 12 }, // Sunday
        };

        var model = new CpModel();

        BoolVar[,,] work = new BoolVar[numEmployees, numDays, numShifts];

        foreach (int e in Range(numEmployees))
        {
            foreach (int d in Range(numDays))
            {
                foreach (int s in Range(numShifts))
                {
                    work[e, d, s] = model.NewBoolVar($"work{e}_{d}_{s}");
                }
            }
        }
        // Max 3 days
        foreach (int e in Range(numEmployees))
        {
            foreach (int d in Range(2, numDays-2))
            {
                foreach (int s in Range(numShifts))
                {
                    model.AddBoolOr(new ILiteral[] { work[e, d - 2, s], work[e, d, s].Not(), work[e, d + 2, s] });
                }
            }
        }

        // number of required employees for shift 8 hours.

        foreach (int e in Range(numEmployees))
        {
            var temp = new BoolVar[numEmployees];
            foreach (int d in Range(numDays))
            {
                    temp[e] = work[e, d, 1];
            }
            model.Add(LinearExpr.Sum(temp) == 12);
        }

        // 1 Type of shift per day.

        foreach (int e in Range(numEmployees))
        {

            foreach (int d in Range(numDays))
            {
                var temp = new BoolVar[numShifts];
                foreach (int s in Range(numShifts))
                {
                    temp[s] = work[e, d, s];
                }

                model.Add(LinearExpr.Sum(temp) == 1);
            }
        }

        // Objective
        model.Maximize(obj);

        // Solve model
        var solver = new CpSolver();
        solver.StringParameters = "num_search_workers:8, log_search_progress: true, max_time_in_seconds:30";

        var status = solver.Solve(model);

        // Print solution
        if (status == CpSolverStatus.Optimal || status == CpSolverStatus.Feasible)
        {
            Console.WriteLine();
            var header = "          ";
            for (int w = 0; w < numWeeks; w++)
            {
                header += "M T W T F S S ";
            }

            Console.WriteLine(header);

            foreach (int e in Range(numEmployees))
            {
                var schedule = "";
                foreach (int d in Range(numDays))
                {
                    foreach (int s in Range(numShifts))
                    {
                        if (solver.BooleanValue(work[e, d, s]))
                        {
                            schedule += shifts[s] + " ";
                        }
                    }
                }

                Console.WriteLine($"worker {e}: {schedule}");
            }

            Console.WriteLine();
            Console.WriteLine("Penalties:");

            Console.WriteLine();
            Console.WriteLine("Statistics");
            Console.WriteLine($"  - status          : {status}");
            Console.WriteLine($"  - conflicts       : {solver.NumConflicts()}");
            Console.WriteLine($"  - branches        : {solver.NumBranches()}");
            Console.WriteLine($"  - wall time       : {solver.WallTime()}");
        }
    }

    /// <summary>
    /// Filters an isolated sub-sequence of variables assigned to True.
    /// Extract the span of Boolean variables[start, start + length), negate them,
    /// and if there is variables to the left / right of this span, surround the
    /// span by them in non negated form.
    /// </summary>
    /// <param name="works">A list of variables to extract the span from.</param>
    /// <param name="start">The start to the span.</param>
    /// <param name="length">The length of the span.</param>
    /// <returns>An array of variables which conjunction will be false if the
    /// sub-list is assigned to True, and correctly bounded by variables assigned
    /// to False, or by the start or end of works.</returns>
    static ILiteral[] NegatedBoundedSpan(BoolVar[] works, int start, int length)
    {
        var sequence = new List<ILiteral>();

        if (start > 0)
            sequence.Add(works[start - 1]);

        foreach (var i in Range(length))
            sequence.Add(works[start + i].Not());

        if (start + length < works.Length)
            sequence.Add(works[start + length]);

        return sequence.ToArray();
    }

    /// <summary>
    /// C# equivalent of Python range (start, stop)
    /// </summary>
    /// <param name="start">The inclusive start.</param>
    /// <param name="stop">The exclusive stop.</param>
    /// <returns>A sequence of integers.</returns>
    static IEnumerable<int> Range(int start, int stop)
    {
        foreach (var i in Enumerable.Range(start, stop - start))
            yield return i;
    }

    /// <summary>
    /// C# equivalent of Python range (stop)
    /// </summary>
    /// <param name="stop">The exclusive stop.</param>
    /// <returns>A sequence of integers.</returns>
    static IEnumerable<int> Range(int stop)
    {
        return Range(0, stop);
    }
}
</code>```

I tried following this ShiftSchedulingSat guide

But keep getting infeasible results if add my constraints

Any suggestion? Could it be modelled in another way?

Body:
I am having an issue regarding scheduling in google or tools.

I am trying to build scheduler based on how many employees needed for a shift so during the day I need 10 and then from 17:00 to 20:00 (night shift) I may need anything from 10% to 100% of the employees working.

They can work a minimum from 8 hours a day to 12 hours.
They can work a minimum of 45 hours a week to 60 hours a week,
They can work a max of consecutive days then they need a day off.

Here is what I have so far

public class ShiftSchedulingSat
{
    static void Main(string[] args)
    {
        SolveShiftScheduling();
    }

    static void SolveShiftScheduling()
    {
        int numEmployees = 15;
        int numWeeks = 1;
        //Shift day "0" day off
        //Shift day "8" hours for the day
        //Shift day "12" hours for the day
        var shifts = new[] { "0", "8", "12" };
        var numDays = numWeeks * 7;
        var numShifts = shifts.Length;
        LinearExprBuilder obj = LinearExpr.NewBuilder();

        //The Demands needed
        var weeklyCoverDemands = new int[][] {
            new[] { 12, 12 }, // Monday
            new[] { 12, 12 }, // Tuesday
            new[] { 12, 12 }, // Wednesday
            new[] { 12, 12 }, // Thursday
            new[] { 12, 12 }, // Friday
            new[] { 12, 12 }, // Saturday
            new[] { 12, 12 }, // Sunday
        };

        var model = new CpModel();

        BoolVar[,,] work = new BoolVar[numEmployees, numDays, numShifts];

        foreach (int e in Range(numEmployees))
        {
            foreach (int d in Range(numDays))
            {
                foreach (int s in Range(numShifts))
                {
                    work[e, d, s] = model.NewBoolVar($"work{e}_{d}_{s}");
                }
            }
        }
        // Max 3 days
        foreach (int e in Range(numEmployees))
        {
            foreach (int d in Range(2, numDays-2))
            {
                foreach (int s in Range(numShifts))
                {
                    model.AddBoolOr(new ILiteral[] { work[e, d - 2, s], work[e, d, s].Not(), work[e, d + 2, s] });
                }
            }
        }

        // number of required employees for shift 8 hours.

        foreach (int e in Range(numEmployees))
        {
            var temp = new BoolVar[numEmployees];
            foreach (int d in Range(numDays))
            {
                    temp[e] = work[e, d, 1];
            }
            model.Add(LinearExpr.Sum(temp) == 12);
        }

        // 1 Type of shift per day.

        foreach (int e in Range(numEmployees))
        {

            foreach (int d in Range(numDays))
            {
                var temp = new BoolVar[numShifts];
                foreach (int s in Range(numShifts))
                {
                    temp[s] = work[e, d, s];
                }

                model.Add(LinearExpr.Sum(temp) == 1);
            }
        }

        // Objective
        model.Maximize(obj);

        // Solve model
        var solver = new CpSolver();
        solver.StringParameters = "num_search_workers:8, log_search_progress: true, max_time_in_seconds:30";

        var status = solver.Solve(model);

        // Print solution
        if (status == CpSolverStatus.Optimal || status == CpSolverStatus.Feasible)
        {
            Console.WriteLine();
            var header = "          ";
            for (int w = 0; w < numWeeks; w++)
            {
                header += "M T W T F S S ";
            }

            Console.WriteLine(header);

            foreach (int e in Range(numEmployees))
            {
                var schedule = "";
                foreach (int d in Range(numDays))
                {
                    foreach (int s in Range(numShifts))
                    {
                        if (solver.BooleanValue(work[e, d, s]))
                        {
                            schedule += shifts[s] + " ";
                        }
                    }
                }

                Console.WriteLine($"worker {e}: {schedule}");
            }

            Console.WriteLine();
            Console.WriteLine("Penalties:");

            Console.WriteLine();
            Console.WriteLine("Statistics");
            Console.WriteLine($"  - status          : {status}");
            Console.WriteLine($"  - conflicts       : {solver.NumConflicts()}");
            Console.WriteLine($"  - branches        : {solver.NumBranches()}");
            Console.WriteLine($"  - wall time       : {solver.WallTime()}");
        }
    }

    ///
    /// Filters an isolated sub-sequence of variables assigned to True.
    /// Extract the span of Boolean variables[start, start + length), negate them,
    /// and if there is variables to the left / right of this span, surround the
    /// span by them in non negated form.
    ///
    /// <param name="works">A list of variables to extract the span from.</param>
    /// <param name="start">The start to the span.</param>
    /// <param name="length">The length of the span.</param>
    /// <returns>An array of variables which conjunction will be false if the
    /// sub-list is assigned to True, and correctly bounded by variables assigned
    /// to False, or by the start or end of works.</returns>
    static ILiteral[] NegatedBoundedSpan(BoolVar[] works, int start, int length)
    {
        var sequence = new List<ILiteral>();

        if (start > 0)
            sequence.Add(works[start - 1]);

        foreach (var i in Range(length))
            sequence.Add(works[start + i].Not());

        if (start + length < works.Length)
            sequence.Add(works[start + length]);

        return sequence.ToArray();
    }

    ///
    /// C# equivalent of Python range (start, stop)
    ///
    /// <param name="start">The inclusive start.</param>
    /// <param name="stop">The exclusive stop.</param>
    /// <returns>A sequence of integers.</returns>
    static IEnumerable<int> Range(int start, int stop)
    {
        foreach (var i in Enumerable.Range(start, stop - start))
            yield return i;
    }

    ///
    /// C# equivalent of Python range (stop)
    ///
    /// <param name="stop">The exclusive stop.</param>
    /// <returns>A sequence of integers.</returns>
    static IEnumerable<int> Range(int stop)
    {
        return Range(0, stop);
    }
}

I tried following this ShiftSchedulingSat guide

But keep getting infeasible results if add my constraints

Any suggestion? Could it be modelled in another way?


问:
How to pass and test a string to a "text mining random forest algorithm" dumped to pkl
I want to submit a string to be classified to a "text mining random forest algorithm" dumped to pkl. Although with the code that have is not working as I believe it is expected of me to pass a "Bag of Words". Here is an example of the code:

```<code>classifier = joblib.load('model/textMining.pkl')
x = "Some string"
prediction = classifier.predict(x)
print(prediction)
</code>```

How can I pass a string to be classified?

Body:
I want to submit a string to be classified to a "text mining random forest algorithm" dumped to pkl. Although with the code that have is not working as I believe it is expected of me to pass a "Bag of Words". Here is an example of the code:

classifier = joblib.load('model/textMining.pkl')
x = "Some string"
prediction = classifier.predict(x)
print(prediction)

How can I pass a string to be classified?


问:
Need efficient way to get particular value from given string
Need to extract version name from by Using java code

```<code>"SignalR (lang=Java; os=%s; version=1.3)"
</code>```

One of the solution in my mind is to split string and adding for loop for parts. but it will require two for loop.

Is there any other efficient way to get version value from given string I need only 1.3 as output. Also

thanks

Body:
Need to extract version name from by Using java code

"SignalR (lang=Java; os=%s; version=1.3)"

One of the solution in my mind is to split string and adding for loop for parts. but it will require two for loop.

Is there any other efficient way to get version value from given string I need only 1.3 as output. Also

thanks


问:
How to validate SMTP through yii\swiftmailer\Mailer in Yii?
I wanna validate SMTP credentials used are valid or not before sending an email.
I tried with Yii::$app->mail->SmtpConnect() but it's throwing an error.
How to validate SMTP in Yii?


问:
Red Underline script JSON
```<code>@push('scripts')
<script>
    const csrfToken = $('meta[name="csrf-token"]').attr('content')
    const APP_URL = {!!json_encode(url('/')) !!}

    $("#chTahun").on('change', function() {
        const th = $(this).val()
        getChart(th)
    })

    getChart()
    ...
    ...
</script>
@endpush
</code>```

const APP_URL = {!!json_encode(url('/')) !!}

when I Format Selection, this code always error, this is thing annoying

Title: Red Underline script JSON

Body:
@push('scripts')

@endpush

const APP_URL = {!!json_encode(url('/')) !!}

when I Format Selection, this code always error, this is thing annoying


问:
How to use Interface or Type in node_modules in .d.ts file
How to use Interface or Type in node_modules in .d.ts file
In my project, i need to create some d.ts files . Usually, I will use the string, number and other data types provided by ts, but there are also cases where I need to reference the types defined in the package. How do I reference them?

I tried to use import type {xxx} from 'xxx' but failed

and I also tried to use /// <reference types="xxx" />, but not very good at using


问:
How CASE or select if cab be used based on some conistion to fetch data from diffrent table in mysql
there are two tables suppose (t1 and t2)

based on the constant condition I want to fetch data from different table

txn is a predefined value

I want something like this

like: if txn=0 (select * from t1;)
else (select * from t2;

used case and when, but I could get data from only one table


问:
Which parameters are involved for the following Fuzzy C -Means clustering algorithm
How can I describe the parameters for the fuzzy c-means clustering algorithm?

```<code>import numpy as np
from fcmeans import FCM

my_model = FCM(n_clusters=12)
my_model
</code>```

output: FCM(n_clusters=12, max_iter=150, m=2.0, error=1e-05, random_state=None, trained=False)

Body:
How can I describe the parameters for the fuzzy c-means clustering algorithm?

import numpy as np
from fcmeans import FCM

my_model = FCM(n_clusters=12)
my_model

output: FCM(n_clusters=12, max_iter=150, m=2.0, error=1e-05, random_state=None, trained=False)


问:
how to push user to a specific folder after creating flutter app file manager
I have 2 screens one is file manager and the second one is zip files.i want to navigate the user to a zip folder inside my file manager screen . how can i get a specific folder of a file manager.
I used file manager package to build file manager screen


问:
JSF 2.3 CDI with spring beans
JSF 2.3, CDI, Tomcat 10, Spring bean.
I would like to use the latest JSF 2.3 capabilities from Jakarta with spring jdbc. Since JSF is now part of Jakarta and covered under CDI I am struggling how to initialise spring beans and connect it with JSF. My environment is

Tomcat 10.x with boss weld (weld-servlet-shaded 5.0.0) to support CDI

JSF (jakarta.faces from glass fish 4.0.0)

Spring core, context and jdbc (6.0.2), I am not using spring-web (i do not want to use as i have jsf as my web) and no spring boot.

**I have my jsf bean as below **

```<code>@Named
@RequestScoped
public class UserProfile {

    @Inject
    private UserService userService;

    public String getMessage() {
        return userService.getMessage();
    }
}
</code>```

Spring service as

```<code>@Service
public class UserService {

    @Inject
    private UserDao userDao;

    public String getMessage() {
        return userDao.getMessage();
    }
}
</code>```

**And Dao as **

```<code>@Repository
public class UserDao  extends JdbcDaoSupport{

    @Autowired
    private DataSource dataSource;

    @PostConstruct
    public void init() {
        setDataSource(dataSource);
    }

    public String getMessage(){
        Integer empCount =  getJdbcTemplate().queryForObject("SELECT COUNT(*) FROM EMPLOYEE", Integer.class) ;
        return empCount.toString();
    }
}
</code>```

Datasource, Hikari configuration and jdbcTemplate is defined under applicationContext.xml
Unfortunately I am not getting my datasource initialised..

Any clue?

I have tried the traditional way of jsf spring integration but it did not work, my question is

Do i need spring web here ? as I have JSF i do not want to make it complex using spring web.

Do i Need Jboss weld here? or tomcat 10 support CDI 2.0 should i skip?

I want all spring beans to be initialised on tomcat start and ready for all request via JSF.

Title: JSF 2.3 CDI with spring beans

Body:
JSF 2.3, CDI, Tomcat 10, Spring bean.
I would like to use the latest JSF 2.3 capabilities from Jakarta with spring jdbc. Since JSF is now part of Jakarta and covered under CDI I am struggling how to initialise spring beans and connect it with JSF. My environment is

Tomcat 10.x with boss weld (weld-servlet-shaded 5.0.0) to support CDI

JSF (jakarta.faces from glass fish 4.0.0)

Spring core, context and jdbc (6.0.2), I am not using spring-web (i do not want to use as i have jsf as my web) and no spring boot.

**I have my jsf bean as below **

@Named
@RequestScoped
public class UserProfile {

    @Inject
    private UserService userService;

    public String getMessage() {
        return userService.getMessage();
    }
}

Spring service as

@Service
public class UserService {

    @Inject
    private UserDao userDao;

    public String getMessage() {
        return userDao.getMessage();
    }
}

**And Dao as **

@Repository
public class UserDao  extends JdbcDaoSupport{

    @Autowired
    private DataSource dataSource;

    @PostConstruct
    public void init() {
        setDataSource(dataSource);
    }

    public String getMessage(){
        Integer empCount =  getJdbcTemplate().queryForObject("SELECT COUNT(*) FROM EMPLOYEE", Integer.class) ;
        return empCount.toString();
    }
}

Datasource, Hikari configuration and jdbcTemplate is defined under applicationContext.xml
Unfortunately I am not getting my datasource initialised..

Any clue?

I have tried the traditional way of jsf spring integration but it did not work, my question is

Do i need spring web here ? as I have JSF i do not want to make it complex using spring web.

Do i Need Jboss weld here? or tomcat 10 support CDI 2.0 should i skip?

I want all spring beans to be initialised on tomcat start and ready for all request via JSF.


问:
Angular Load Component Dynamicaly by Url
I have an Angular project. I created a popup that has several tabs

Each tab has an address and when it is clicked, it should be displayed in the body of the pop-up
These tabs are added dynamically
Each tab should be loaded only once
The method I used to implement it was that I add a ng-template for each tab and load the component with the componentFactory and inject it into the ng-template and display the ng-template when the tab is active.

export class TabLoaderComponent implements OnInit {
  constructor(
    private componentFactoryResolver: ComponentFactoryResolver,
    public mapService: ComponentMapService
  ) {}
  @ViewChild(TabLoaderDirective, { static: true })
  appTabLoader: TabLoaderDirective;
  @Input() componentName: string;
  ngOnInit() {
    this.loadComponent();
    console.log("tabLoader Is Active");
  }
  loadComponent() {
    const componentFactory =
      this.componentFactoryResolver.resolveComponentFactory(
        this.mapService.getCompoent(this.componentName).component
      );
    const viewContainerRef = this.appTabLoader.viewContainerRef;
    viewContainerRef.clear();
    const componentRef = viewContainerRef.createComponent(componentFactory);
  }
}
```

But the problem is that I did this with the component name, not the router address
I want to know if there is a better way to implement it?

Body:
I have an Angular project. I created a popup that has several tabs

Each tab has an address and when it is clicked, it should be displayed in the body of the pop-up
These tabs are added dynamically
Each tab should be loaded only once
The method I used to implement it was that I add a ng-template for each tab and load the component with the componentFactory and inject it into the ng-template and display the ng-template when the tab is active.

export class TabLoaderComponent implements OnInit {
  constructor(
    private componentFactoryResolver: ComponentFactoryResolver,
    public mapService: ComponentMapService
  ) {}
  @ViewChild(TabLoaderDirective, { static: true })
  appTabLoader: TabLoaderDirective;
  @Input() componentName: string;
  ngOnInit() {
    this.loadComponent();
    console.log("tabLoader Is Active");
  }
  loadComponent() {
    const componentFactory =
      this.componentFactoryResolver.resolveComponentFactory(
        this.mapService.getCompoent(this.componentName).component
      );
    const viewContainerRef = this.appTabLoader.viewContainerRef;
    viewContainerRef.clear();
    const componentRef = viewContainerRef.createComponent(componentFactory);
  }
}

But the problem is that I did this with the component name, not the router address
I want to know if there is a better way to implement it?


问:
Second column is the tallest instead of the first one when using column-count
The second column seems to be filled first/to be the tallest, at least on certain screen sizes (as seen here). How can I make sure the first column is filled in first and and the second column last (as it would make sense in the English language, reading from left to right)?

Note: I cannot use a set height in this case.

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.

When an unknown printer took a galley of type and scrambled it to make a type specimen book.

When an unknown printer took a galley of type and scrambled it to make a type specimen book.

When an unknown printer took a galley of type and scrambled it to make a type specimen book.

When an unknown printer took a galley of type and scrambled it to make a type specimen book.

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.

When an unknown printer took a galley of type and scrambled it to make a type specimen book.

It to make a type specimen book.

It to make a type specimen book.

It to make a type specimen book.

```
<pre class="lang-css prettyprint-override"><code>.list--underline-large {
    column-count: 2;
    column-gap: 80px;
    break-inside: avoid-column;
    page-break-inside: avoid;
}

.list--underline-large li {
    border-bottom: 1px solid #143b38;
    display: inline-block;
    margin-bottom: 30px;
    padding: 0 0 30px 0;
    width: 100%;
}
</code>```

.list--underline-large {
  column-count: 2;
  column-gap: 80px;
  break-inside: avoid-column;
  page-break-inside: avoid;
}

.list--underline-large li {
  border-bottom: 1px solid #143b38;
  display: inline-block;
  margin-bottom: 30px;
  padding: 0 0 30px 0;
  width: 100%;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><ul class="list--underline-large">
  <li>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.</li>
  <li>When an unknown printer took a galley of type and scrambled it to make a type specimen book.</li>
  <li>When an unknown printer took a galley of type and scrambled it to make a type specimen book.</li>
  <li>When an unknown printer took a galley of type and scrambled it to make a type specimen book.</li>
  <li>When an unknown printer took a galley of type and scrambled it to make a type specimen book.</li>
  <li>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.</li>
  <li>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.</li>
  <li>When an unknown printer took a galley of type and scrambled it to make a type specimen book.</li>
  <li>It to make a type specimen book.</li>
  <li>It to make a type specimen book.</li>
  <li>It to make a type specimen book.</li>
</ul></code>```

Body:
The second column seems to be filled first/to be the tallest, at least on certain screen sizes (as seen here). How can I make sure the first column is filled in first and and the second column last (as it would make sense in the English language, reading from left to right)?

Note: I cannot use a set height in this case.

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.

When an unknown printer took a galley of type and scrambled it to make a type specimen book.

When an unknown printer took a galley of type and scrambled it to make a type specimen book.

When an unknown printer took a galley of type and scrambled it to make a type specimen book.

When an unknown printer took a galley of type and scrambled it to make a type specimen book.

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.

When an unknown printer took a galley of type and scrambled it to make a type specimen book.

It to make a type specimen book.

It to make a type specimen book.

It to make a type specimen book.

.list--underline-large {
    column-count: 2;
    column-gap: 80px;
    break-inside: avoid-column;
    page-break-inside: avoid;
}

.list--underline-large li {
    border-bottom: 1px solid #143b38;
    display: inline-block;
    margin-bottom: 30px;
    padding: 0 0 30px 0;
    width: 100%;
}

.list--underline-large {
  column-count: 2;
  column-gap: 80px;
  break-inside: avoid-column;
  page-break-inside: avoid;
}

.list--underline-large li {
  border-bottom: 1px solid #143b38;
  display: inline-block;
  margin-bottom: 30px;
  padding: 0 0 30px 0;
  width: 100%;
}

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.

When an unknown printer took a galley of type and scrambled it to make a type specimen book.

When an unknown printer took a galley of type and scrambled it to make a type specimen book.

When an unknown printer took a galley of type and scrambled it to make a type specimen book.

When an unknown printer took a galley of type and scrambled it to make a type specimen book.

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.

When an unknown printer took a galley of type and scrambled it to make a type specimen book.

It to make a type specimen book.

It to make a type specimen book.

It to make a type specimen book.


问:
creating csv based on certain key of db table/csvfile
Lets assume I have the following db table:

compId
Name
col3

2
ll
11

3
gg
12

4
dd
13

5
ss
14

and I wanted to export the data into seperate CSVs using compId as an identifier.
so the first csv will be named for example: compId2.csv and will give me:

compId
Name
col3

2
ll
11

and other CSVs per the amount of compId I have in my table. what would be the best approach?

so far I got:

```<code>  void ExportExcel(DataTable ds, string filename, string sheetname)
            {
               // filename = fileName("5");
                StreamWriter sw = new StreamWriter("D:\\" + filename, false);
                //headers
                for (int i = 0; i < ds.Columns.Count; i++)
                {
                    sw.Write(ds.Columns[i]);
                    if (i < ds.Columns.Count - 1)
                    {
                        sw.Write(",");
                    }
                }
                sw.Write(sw.NewLine);
                foreach (DataRow dr in ds.Rows)
                {
                    for (int i = 0; i < ds.Columns.Count; i++)
                    {
                        if (!Convert.IsDBNull(dr[i]))
                        {
                            string value = dr[i].ToString();
                            if (value.Contains(','))
                            {
                                value = String.Format("\"{0}\"", value);
                                sw.Write(value);
                            }
                            else
                            {
                                sw.Write(dr[i].ToString());
                            }
                        }
                        if (i < ds.Columns.Count - 1)
                        {
                            sw.Write(",");
                        }
                    }
                    sw.Write(sw.NewLine);
                }
                sw.Close();
            }

</code>```

which will result in a single creation of a csv
using -

```<code>                cmd.CommandText = "Select * from BAKASHOT_PIRTY_MEIDA WHERE PROD IS NULL and CHARGED = 1";

</code>```

that select statement

Body:
Lets assume I have the following db table:

compId
Name
col3

2
ll
11

3
gg
12

4
dd
13

5
ss
14

and I wanted to export the data into seperate CSVs using compId as an identifier.
so the first csv will be named for example: compId2.csv and will give me:

compId
Name
col3

2
ll
11

and other CSVs per the amount of compId I have in my table. what would be the best approach?

so far I got:

  void ExportExcel(DataTable ds, string filename, string sheetname)
            {
               // filename = fileName("5");
                StreamWriter sw = new StreamWriter("D:\\" + filename, false);
                //headers
                for (int i = 0; i < ds.Columns.Count; i++)
                {
                    sw.Write(ds.Columns[i]);
                    if (i < ds.Columns.Count - 1)
                    {
                        sw.Write(",");
                    }
                }
                sw.Write(sw.NewLine);
                foreach (DataRow dr in ds.Rows)
                {
                    for (int i = 0; i < ds.Columns.Count; i++)
                    {
                        if (!Convert.IsDBNull(dr[i]))
                        {
                            string value = dr[i].ToString();
                            if (value.Contains(','))
                            {
                                value = String.Format("\"{0}\"", value);
                                sw.Write(value);
                            }
                            else
                            {
                                sw.Write(dr[i].ToString());
                            }
                        }
                        if (i < ds.Columns.Count - 1)
                        {
                            sw.Write(",");
                        }
                    }
                    sw.Write(sw.NewLine);
                }
                sw.Close();
            }

which will result in a single creation of a csv
using -

                cmd.CommandText = "Select * from BAKASHOT_PIRTY_MEIDA WHERE PROD IS NULL and CHARGED = 1";

that select statement


问:
Why does using limit modules am getting namespace error?
I am getting below error while using mvn clean package. Even after limiting modules in pom.xml

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:2.7.0:compile (default-compile) on project com.binding.rest.runtime.schema: Compilation failure: Compilation failure: [ERROR] C:\Users\runtime\plugins\com.binding.rest.runtime.schema\src\com\runtime\schema\Wsdl4JsonUtils.java:[5] [ERROR] import javax.xml.namespace.QName;

I tried to limit modules in below manner:

```<code><plugin>
       <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-compiler-plugin</artifactId>
        <version>${tycho-version}</version>
        <configuration>
         <compilerArgs>
        <arg>-warn:none</arg>
        <arg>-err:none</arg>
        <arg>-warn:+discouraged,forbidden</arg>
        <arg>--limit-modules</arg>
        <arg>java.base,java.compiler,....</arg>
        </compilerArgs>
         </configuration>
          </plugin>
</code>```

Body:
I am getting below error while using mvn clean package. Even after limiting modules in pom.xml

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:2.7.0:compile (default-compile) on project com.binding.rest.runtime.schema: Compilation failure: Compilation failure: [ERROR] C:\Users\runtime\plugins\com.binding.rest.runtime.schema\src\com\runtime\schema\Wsdl4JsonUtils.java:[5] [ERROR] import javax.xml.namespace.QName;

I tried to limit modules in below manner:

<plugin>
       <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-compiler-plugin</artifactId>
        <version>${tycho-version}</version>
        <configuration>
         <compilerArgs>
        <arg>-warn:none</arg>
        <arg>-err:none</arg>
        <arg>-warn:+discouraged,forbidden</arg>
        <arg>--limit-modules</arg>
        <arg>java.base,java.compiler,....</arg>
        </compilerArgs>
         </configuration>
          </plugin>


问:
how i can take screenshot of specific Other software window in java?
i just try to take screenshot of a specific software every amount of time i found a way to take screenshot for active window but i need to take it for specific windows altough is not active .

thanks in advance

i tried this but as i told  is take full screenshot:

```<code>BufferedImage image = new Robot().createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
ImageIO.write(image, "png", new File("C:\\Users\\Public\\Documents\\tessdata\\Full_Image.png"));
</code>```

Body:
i just try to take screenshot of a specific software every amount of time i found a way to take screenshot for active window but i need to take it for specific windows altough is not active .

thanks in advance

i tried this but as i told  is take full screenshot:

BufferedImage image = new Robot().createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
ImageIO.write(image, "png", new File("C:\\Users\\Public\\Documents\\tessdata\\Full_Image.png"));


问:
Cloudant Change Feed missing documents
We are trying to replicate data from IBM cloudant instance and it appears that it is missing some documents. The python code is fairly simple

```<code>feed = changes(feed='continuous', include_docs=True, since=<<>>,filter=filter,)
</code>```

The size of the database is pretty huge (300 GB+). Lets say among millions of documents, a few hundred appear to go missing. Has someone come across this before and is there a solution to it?

Title: Cloudant Change Feed missing documents

Body:
We are trying to replicate data from IBM cloudant instance and it appears that it is missing some documents. The python code is fairly simple

feed = changes(feed='continuous', include_docs=True, since=<<>>,filter=filter,)

The size of the database is pretty huge (300 GB+). Lets say among millions of documents, a few hundred appear to go missing. Has someone come across this before and is there a solution to it?


问:
how to using session in NodeJS/ExpressJS - postgreSQL
I'm using express-session / connect-pg-simple modules.

Why they doesn't save session information? And they every changed sid

How can I do That. enter image description here

Anyway.

Im tried server memory store session, No save session way.

They Never saved.

I want to GET /auth/login this session userInfo -> GET / this session must has userInfo.


问:
Learning Cyclical Redundancy Check Failure Cases
I am trying to understand how likely a Cyclic Redundancy Check is to fail, given a particular divisor P(x). I am specifically interested in failures resulting from an odd number of bit flips in my message, an example to follow.

Some prerequisite info:

```<code>CRC is a very commonly used way to detect errors in computer networks.
P(x), G(x), R(x), and T(x) are all polynomials under binary field arithmetic (i.e., all coefficients are mod2: 0 or 1).'
P(x) is the polynomial that we are given and that we will divide by.
E(x) is an error pattern. It is XORed with T(x) to get T'(x). G(x) is the message that we want to send.
R(x) is the remainder of G(x)/P(x) or just G(x)modP(x).
T(x) is our sent data, (x^k)G(x)+R(x), where k is the degree of P(x).
T'(x) is our received data but potentially with errors.
When T'(x) is received, if T'(x)modP(x)=0 then it is said to be error-free. It may not actually be error-free.
</code>```
```<code>Proof:
Assume an odd number of errors has x + 1 as a factor.
Then E(x) = (x + 1)T(x).
Evaluate E(x) for x = 1 → E(x) = E(1) = 1 since there are odd number of terms.
But (x + 1)T(x) = (1 + 1)T(1) = 0.
Therefore, E(x) cannot have x + 1 as a factor.
</code>```
```<code>Example:

Say my P(x)=x^7 +1=10000001\
Let G(x)=x^7+x^6+x^3+x+1=11001011\
So, T(x)=110010111001010\
When E(x)=011111011111111\
T'(x)=E(x)XORT(x)=101101100110101\
T'(x) modulus P(x)=0, a failure.\
</code>```

I simulated the results on a particular message(T(x)), namely 11001011, and found CRC to fail 42 of the 16384 possible odd parity bit flips that I attempted. Failure means that T'(x)modP(x)=0.
I expected odd parity bit errors to be caught based on the above proof.

Is the proof wrong, or am I doing my example calculation wrong?
What I really want to know is, given P(x)=x^7 +1, what are the offs that any general message with an odd number of bit flips will be erroneous but not be caught as being erroneous?
Sorry, this is so long-winded but I just want to make sure everything is super clear.

Body:
I am trying to understand how likely a Cyclic Redundancy Check is to fail, given a particular divisor P(x). I am specifically interested in failures resulting from an odd number of bit flips in my message, an example to follow.

Some prerequisite info:

CRC is a very commonly used way to detect errors in computer networks.
P(x), G(x), R(x), and T(x) are all polynomials under binary field arithmetic (i.e., all coefficients are mod2: 0 or 1).'
P(x) is the polynomial that we are given and that we will divide by.
E(x) is an error pattern. It is XORed with T(x) to get T'(x). G(x) is the message that we want to send.
R(x) is the remainder of G(x)/P(x) or just G(x)modP(x).
T(x) is our sent data, (x^k)G(x)+R(x), where k is the degree of P(x).
T'(x) is our received data but potentially with errors.
When T'(x) is received, if T'(x)modP(x)=0 then it is said to be error-free. It may not actually be error-free.

Proof:
Assume an odd number of errors has x + 1 as a factor.
Then E(x) = (x + 1)T(x).
Evaluate E(x) for x = 1 → E(x) = E(1) = 1 since there are odd number of terms.
But (x + 1)T(x) = (1 + 1)T(1) = 0.
Therefore, E(x) cannot have x + 1 as a factor.

Example:

Say my P(x)=x^7 +1=10000001\
Let G(x)=x^7+x^6+x^3+x+1=11001011\
So, T(x)=110010111001010\
When E(x)=011111011111111\
T'(x)=E(x)XORT(x)=101101100110101\
T'(x) modulus P(x)=0, a failure.\

I simulated the results on a particular message(T(x)), namely 11001011, and found CRC to fail 42 of the 16384 possible odd parity bit flips that I attempted. Failure means that T'(x)modP(x)=0.
I expected odd parity bit errors to be caught based on the above proof.

Is the proof wrong, or am I doing my example calculation wrong?
What I really want to know is, given P(x)=x^7 +1, what are the offs that any general message with an odd number of bit flips will be erroneous but not be caught as being erroneous?
Sorry, this is so long-winded but I just want to make sure everything is super clear.


问:
How to find full path when sending a file over a post request from Next JS functions (server)?
In the Next JS server-side pages/api, I have a function that makes a post request to a service requiring two files.

I am trying to read these files using the following code:

```<code>var fullPhotoPath = process.cwd() + '/public/photos/photo.png'
var photoStream = fs.createReadStream(fullPhotoPath)
</code>```

This works when I run the app locally, but it fails with file not found error when deployed.
I assume the pathing in server changes because of webpack, though I am not familiar with NextJS.

Things I have tried:

Use relative path

Move photo files to different locations either public or private folders

Deploy in different environments: same error in both Firebase or Vercel hosting.

Workaround with getStaticProps/getServerSideProps: can't send file to API functions since they aren't JSON-able.

Thanks for suggestions.

Body:
In the Next JS server-side pages/api, I have a function that makes a post request to a service requiring two files.

I am trying to read these files using the following code:

var fullPhotoPath = process.cwd() + '/public/photos/photo.png'
var photoStream = fs.createReadStream(fullPhotoPath)

This works when I run the app locally, but it fails with file not found error when deployed.
I assume the pathing in server changes because of webpack, though I am not familiar with NextJS.

Things I have tried:

Use relative path

Move photo files to different locations either public or private folders

Deploy in different environments: same error in both Firebase or Vercel hosting.

Workaround with getStaticProps/getServerSideProps: can't send file to API functions since they aren't JSON-able.

Thanks for suggestions.


问:
sk-learn feature selection, remove redundant features according to a mutual information matrix
I made a method in python to compute a triangular mutual information matrix.

def get_mutual_information_matrix(X_train):
    p = len(X_train.columns)

    MI_matrix = np.zeros((p,p))

    for i in range(p):
        for j in range(p):
            # triangular matrix
            if i < j:
                continue
            elif i == j:
                MI_matrix[i,j] = 1
            else:
                MI_matrix[i,j] = mutual_info_regression(X_train.iloc[:,i].to_frame(), X_train.iloc[:,j], discrete_features=[False])[0]
    return MI_matrix
```

I would like to use this matrix to drop redundant features. For each feature that has a mutual information with other features above a certain treshold, I would like to remove the one that has the less mutual information with the target.

Does that make sense ? How could I do that ?

Body:
I made a method in python to compute a triangular mutual information matrix.

def get_mutual_information_matrix(X_train):
    p = len(X_train.columns)

    MI_matrix = np.zeros((p,p))

    for i in range(p):
        for j in range(p):
            # triangular matrix
            if i < j:
                continue
            elif i == j:
                MI_matrix[i,j] = 1
            else:
                MI_matrix[i,j] = mutual_info_regression(X_train.iloc[:,i].to_frame(), X_train.iloc[:,j], discrete_features=[False])[0]
    return MI_matrix

I would like to use this matrix to drop redundant features. For each feature that has a mutual information with other features above a certain treshold, I would like to remove the one that has the less mutual information with the target.

Does that make sense ? How could I do that ?


问:
MAMP (Windows) doesn't allow to choose a different PHP version
I support different WordPress web-sites (older ones on PHP5.6 and newer ones on PHP7.XX)

to modify those sites locally - MAMP on Mac allows to choose between two different PHP versions as stated here:
Is there a way to run PHP version 5.4 w/ the latest MAMP version

is it possible to choose between two different PHP versions on Windows?


问:
UnitTest for get flask
I have created a get function in my flask application which looks something similar below.

flask_app.py

```<code>_cloudenv='dev.net'

app = Flask(__name__)
csrf = CSRFProtect()
csrf.init_app(app)

@app.route('/')
@app.route('/index')
def index():
    project = "Project 1"
    framework = "Publish Framework"
    version = '0.1'
    # May require to change
    hostname = 'farid.net'
    # return render_template('index.html', title=project , description=f'{project} : {framework} v - {version}' , hostname=hostname , get_env=_cloudenv)
</code>```

test_flask.py

```<code>import flask_app as flk_app
from flask_app import app

class test_tbrp_case(unittest.TestCase):
def test_home_page_getenv(self):
    response = app.test_client().get('/')
    assert response.status_code == 200
    assert response.get_env == 'dev.net'

def test_home_page_gettitle(self):
    response = app.test_client().get('/')
    assert response.status_code == 200
    assert response.title== 'Project 1'
</code>```

when i run my test cases , it failed, anything that i did wrong here ?

Title: UnitTest for get flask

Body:
I have created a get function in my flask application which looks something similar below.

flask_app.py

_cloudenv='dev.net'

app = Flask(__name__)
csrf = CSRFProtect()
csrf.init_app(app)

@app.route('/')
@app.route('/index')
def index():
    project = "Project 1"
    framework = "Publish Framework"
    version = '0.1'
    # May require to change
    hostname = 'farid.net'
    # return render_template('index.html', title=project , description=f'{project} : {framework} v - {version}' , hostname=hostname , get_env=_cloudenv)

test_flask.py

import flask_app as flk_app
from flask_app import app

class test_tbrp_case(unittest.TestCase):
def test_home_page_getenv(self):
    response = app.test_client().get('/')
    assert response.status_code == 200
    assert response.get_env == 'dev.net'

def test_home_page_gettitle(self):
    response = app.test_client().get('/')
    assert response.status_code == 200
    assert response.title== 'Project 1'

when i run my test cases , it failed, anything that i did wrong here ?


问:
How to put protection on a word document, and the document was not distorted by means php?
I found in Google a way to set a password  php using , but my background is distorted, the text is shifting, tell me what's the problem ?, I thought in the version of the Word I save to, but how to change it?
code :

```<code>$name = basename(__FILE__, '.php');
$name="sample";
$source = __DIR__ . "/{$name}.docx";

$phpWord = \PhpOffice\PhpWord\IOFactory::load($source);

// Add Password Protection For editing
$documentProtection = $phpWord->getSettings()->getDocumentProtection();
$documentProtection->setEditing(PhpOffice\PhpWord\SimpleType\DocProtect::READ_ONLY);
$documentProtection->setPassword('123456');

// Write the output file

$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save('helloWorld.docx');
</code>```

I tried to google, but paid libraries are not suitable, I tried to change the version of the Word in the save, but it does not change :(

Body:
I found in Google a way to set a password  php using , but my background is distorted, the text is shifting, tell me what's the problem ?, I thought in the version of the Word I save to, but how to change it?
code :

$name = basename(__FILE__, '.php');
$name="sample";
$source = __DIR__ . "/{$name}.docx";

$phpWord = \PhpOffice\PhpWord\IOFactory::load($source);

// Add Password Protection For editing
$documentProtection = $phpWord->getSettings()->getDocumentProtection();
$documentProtection->setEditing(PhpOffice\PhpWord\SimpleType\DocProtect::READ_ONLY);
$documentProtection->setPassword('123456');

// Write the output file

$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save('helloWorld.docx');

I tried to google, but paid libraries are not suitable, I tried to change the version of the Word in the save, but it does not change :(


问:
ParticlesConfig not woring in angular V14
I have download particles.js from https://vincentgarreau.com/particles.js/ and paste that file in assets/data folder.
Now I am importing particles.js in my component.ts it show error "Cannot find module '../assets/data/particles' or its corresponding type declarations."

Actually I am following below link to install run particles.js in angular14.
Particle js background for angular project?

Some screenshots.
Here is my component.ts file image

Here is path of particles.json file

I just want to implement angular-particles in my angular14.


问:
Graph API Explorer returns empty response for Instagram Business Messaging
I am trying to get Instagram messages for Business Account using Graph API Explorer but it returns empty response in data object.

I have created app in Meta account and give following permissions

pages_show_list

read_page_mailboxes

pages_messaging

instagram_basic

instagram_manage_messages

pages_read_engagement

pages_manage_metadata

The instagram account is currently connected with my facebook page.

Graph API Explorer response


问:
Sound button in Pywebio
I'm trying to create button using Pywebio, but I am getting an error in the browser:

Not allowed to load local resource: file://sound.mp3/

I know, that browser can't use files from local machine. So how can I create url from file. Maybe there is another way to use mp3 file.

My code:

```<code>from pywebio import start_server
from pywebio.output import *
from pywebio.session import *

class WebApp:

    def session(self):
        put_button('Play sound', onclick=lambda: self.player())

    def player(self, audio_file='file:sound.mp3'):
        js_code = """
        let audio = new Audio();
        audio.src = audio_file;
        audio.play();
        """
        run_js(js_code, audio_file=audio_file)

def main():
    '''WebVoicer'''
    run_that = WebApp()
    run_that.session()

if __name__ == '__main__':
    start_server(main, port=8888, debug=True)
</code>```

I also know that I can start the browser with the "chrome.exe --allow-file-access-from-files" option, but this is not a solution.

Title: Sound button in Pywebio

Body:
I'm trying to create button using Pywebio, but I am getting an error in the browser:

Not allowed to load local resource: file://sound.mp3/

I know, that browser can't use files from local machine. So how can I create url from file. Maybe there is another way to use mp3 file.

My code:

from pywebio import start_server
from pywebio.output import *
from pywebio.session import *

class WebApp:

    def session(self):
        put_button('Play sound', onclick=lambda: self.player())

    def player(self, audio_file='file:sound.mp3'):
        js_code = """
        let audio = new Audio();
        audio.src = audio_file;
        audio.play();
        """
        run_js(js_code, audio_file=audio_file)

def main():
    '''WebVoicer'''
    run_that = WebApp()
    run_that.session()

if __name__ == '__main__':
    start_server(main, port=8888, debug=True)

I also know that I can start the browser with the "chrome.exe --allow-file-access-from-files" option, but this is not a solution.


问:
unable to filter/query box api response?
I am working on filtering of box folder for that I have tried to filter box folder using query (?q=name=folder name) but using this I am unable to get required filtered/queried result.

Using query based on "NAME" or "ID" parameter I am trying to get particular file/folder details, But I am unable to get the filtered  result.


问:
How to customize Editor in Reactjs
I am working with Reactjs and using nextjs framework, I am using Nextjs, Right now
I am using Editor to add blogs, But i have the following two issues

How to add video with editor, I just want if we add any video links (youtube video link) then in
frontend that video should display

How to display "table" option in editor?

Here is my current code

```<code><Editor
  onInit={(evt, ed) => {
    setEditor(ed);
  }}
  ref={editor}
  initialValue="<p>This is the initial content of the editor.</p>"
  init={{
    height: 500,
    menubar: false,
    plugins: [
      "advlist autolink lists link image charmap print preview anchor",
      "searchreplace visualblocks code fullscreen",
      "insertdatetime media table paste code help wordcount"
    ],
    toolbar:
      "undo redo | formatselect | " +
      "bold italic backcolor | alignleft aligncenter " +
      "alignright alignjustify | bullist numlist outdent indent | " +
      "removeformat | help",
    content_style:
      "body { font-family:Helvetica,Arial,sans-serif; font-size:14px }"
  }}
/>
</code>```

Title: How to customize Editor in Reactjs

Body:
I am working with Reactjs and using nextjs framework, I am using Nextjs, Right now
I am using Editor to add blogs, But i have the following two issues

How to add video with editor, I just want if we add any video links (youtube video link) then in
frontend that video should display

How to display "table" option in editor?

Here is my current code

<Editor
  onInit={(evt, ed) => {
    setEditor(ed);
  }}
  ref={editor}
  initialValue="
This is the initial content of the editor.
"
  init={{
    height: 500,
    menubar: false,
    plugins: [
      "advlist autolink lists link image charmap print preview anchor",
      "searchreplace visualblocks code fullscreen",
      "insertdatetime media table paste code help wordcount"
    ],
    toolbar:
      "undo redo | formatselect | " +
      "bold italic backcolor | alignleft aligncenter " +
      "alignright alignjustify | bullist numlist outdent indent | " +
      "removeformat | help",
    content_style:
      "body { font-family:Helvetica,Arial,sans-serif; font-size:14px }"
  }}
/>


问:
XML: Assign corresponding elements of the same hierachy level (Itemlist to its Category)
I am new to XML and I am trying to import an XML file (GAEB, construction industry format).

The XML file has categories (BoQCtgy) and optionally an Itemlist that lists the items of the category.

Itemlist and BoQCtgy are on the same hierachy level; they are not nested.

An XML file consists of multiple categories. Each category can have an Itemlist or not. If a category has an itemlist, the itemlist is positioned behind the category (see example).

`

```<code><BoQCtgy RNoPart="001">
    ...
</BoQCtgy>
<Itemlist>
    <Item RNoPart="01">
        ...
    </Item>
    <Item RNoPart="02">
        ...
    </Item>
</Itemlist>
<BoQCtgy RNoPart="002">
    ...
</BoQCtgy>
<BoQCtgy RNoPart="003">
    ...
</BoQCtgy>
<Itemlist>
    <Item RNoPart="01">
        ...
    </Item>
    <Item RNoPart="02">
        ...
    </Item>
</Itemlist>
</code>```

`

How can I assign an Itemlist to its category, so that I build a list like that:

Item 001.01

Item 001.02

(002 has no items)

Item 003.01

Item 003.02

I tried:

iterating the categories, but since an Itemlist is on the same level, this will not work.

creating 2 arrays (category and Itemlist) and looking at the positions within the arrays. But this will not work, because the category array might look like this: [001,002,003,004], and the Itemlist array might look like this: [01] (-> to which category does the itemlist belong?)

Since I am using a proprietary language (Ninox), I cannot really share my existing script.

Body:
I am new to XML and I am trying to import an XML file (GAEB, construction industry format).

The XML file has categories (BoQCtgy) and optionally an Itemlist that lists the items of the category.

Itemlist and BoQCtgy are on the same hierachy level; they are not nested.

An XML file consists of multiple categories. Each category can have an Itemlist or not. If a category has an itemlist, the itemlist is positioned behind the category (see example).

`

<BoQCtgy RNoPart="001">
    ...
</BoQCtgy>
<Itemlist>
    <Item RNoPart="01">
        ...
    </Item>
    <Item RNoPart="02">
        ...
    </Item>
</Itemlist>
<BoQCtgy RNoPart="002">
    ...
</BoQCtgy>
<BoQCtgy RNoPart="003">
    ...
</BoQCtgy>
<Itemlist>
    <Item RNoPart="01">
        ...
    </Item>
    <Item RNoPart="02">
        ...
    </Item>
</Itemlist>

`

How can I assign an Itemlist to its category, so that I build a list like that:

Item 001.01

Item 001.02

(002 has no items)

Item 003.01

Item 003.02

I tried:

iterating the categories, but since an Itemlist is on the same level, this will not work.

creating 2 arrays (category and Itemlist) and looking at the positions within the arrays. But this will not work, because the category array might look like this: [001,002,003,004], and the Itemlist array might look like this: [01] (-> to which category does the itemlist belong?)

Since I am using a proprietary language (Ninox), I cannot really share my existing script.


问:
Find all possible permutations of rows chosen from three columns
I have a dataframe with 3 columns, each with 60 rows. I want to create a loop that will loop through these columns and create create a new list (60 rows), which chooses only one of the values from these three columns for each row of the new list, and loops through and produces a list of every possible combination.

Basically column 1 is A, column 2 is B and column 3 is C.
The first iteration could choose 1B, then 2A, then 3C etc.

Importantly the values in row 1 must always stay in row 1. They can't be moved around to different positions in the list.

The order of the values in the column should not change.

I tried importing permutations from itertools however I think this won't work because it might scramble the list positions.

Any help would be appreciated.


问:
Priority in os.walk
I'm trying to find a better way to have os.walk prioritize one type of subdirectory over the other, without running the entire loop twice.

Here's an example:
Say my directory is as follows-

Root

Root/1

Root/2

Root/3

Root/1/second_task

Root/2/first_task

Root/2/second_task

Root/3/first_task

Considering that first/second_task are folders with files inside, and that for every such folder the program runs a certain follow-up code.

I want to be able to make the os.walk loop search for the first_task folders and perform the actions needed first, before doing so for any second_task folders.

For now I just run the os.walk twice, first searching for first_task, and then in the second time for any other tasks, but I've figured there must be a better way.

Thanks!

Title: Priority in os.walk


问:
how to handle server error in react query using useMutation?
how to handle server error 405 in react query. i have tried calling onError method in in UseMutation function to give an callback error.

inspite of that it does not returing anything in console. here below is the code.

```<code>   const {
    isLoading: deleteSalaryLoading,
    mutateAsync: deleteSalaryMutateAsync,
    error : deleteError,
    isError : isDeleteError
} = useMutation(DeleteSalaryComponent, {
    onSuccess: (res) => {
        if (res.data.Messages.length) {
            setIsModalOpen(false);
            setNotify({
                severity: res.data.Severity.toLowerCase(),
                message: res.data.Messages[0].Message,
            });
            refetch();
        }
    },
    onError : async (error) => {
         const errorObj = await error.json();
        console.log("Error in deletion", errorObj);
    }
});

   const handleDelete = () => {
    deleteSalaryMutateAsync({
        SalaryCompID: rowToDelete.SalaryCompID,
    });
    if(deleteError) {
        console.log("Deletion error");
    }
};

// DeleteSalaryComponent
 export const DeleteSalaryComponent = async (data: any) => {
const token = localStorage.getItem("token");

return axiosInstance({
    method: "DELETE",
    baseURL: BASE_URL,
    url: `/api/payroll/salarycomponent`,
    headers: {
        Authorization: `Bearer ${token}`,
        Accept: "application/json",
        "Content-Type": "application/json",
    },
    data,
  });
};
</code>```

Body:
how to handle server error 405 in react query. i have tried calling onError method in in UseMutation function to give an callback error.

inspite of that it does not returing anything in console. here below is the code.

   const {
    isLoading: deleteSalaryLoading,
    mutateAsync: deleteSalaryMutateAsync,
    error : deleteError,
    isError : isDeleteError
} = useMutation(DeleteSalaryComponent, {
    onSuccess: (res) => {
        if (res.data.Messages.length) {
            setIsModalOpen(false);
            setNotify({
                severity: res.data.Severity.toLowerCase(),
                message: res.data.Messages[0].Message,
            });
            refetch();
        }
    },
    onError : async (error) => {
         const errorObj = await error.json();
        console.log("Error in deletion", errorObj);
    }
});

   const handleDelete = () => {
    deleteSalaryMutateAsync({
        SalaryCompID: rowToDelete.SalaryCompID,
    });
    if(deleteError) {
        console.log("Deletion error");
    }
};

// DeleteSalaryComponent
 export const DeleteSalaryComponent = async (data: any) => {
const token = localStorage.getItem("token");

return axiosInstance({
    method: "DELETE",
    baseURL: BASE_URL,
    url: `/api/payroll/salarycomponent`,
    headers: {
        Authorization: `Bearer ${token}`,
        Accept: "application/json",
        "Content-Type": "application/json",
    },
    data,
  });
};


问:
Change ID to Customer name
I Rename at PDF netsuite with Suitelet method

```<code>var paramGet = context.request.parameters;
var customer = paramGet.salesname;
var location = paramGet.location;
var startDate = paramGet.startdate;
var endDate = paramGet.enddate;
var number = paramGet.number;
var flagExport = paramGet.flag
var trans = getSales(customer, startDate, endDate, number);

var rawPdfData = getDataSet('pdfdata', trans, checkedValue, number)
    log.debug('raw pdf data', rawPdfData)
    var dataZip = []
    for (x = 0; x < rawPdfData.length; x++) {
        var dataPdf = JSON.stringify(rawPdfData[x])
        log.debug("log data pdf", dataPdf)
        var renderer = render.create();
        log.debug("renderer", renderer)
        renderer.setTemplateByScriptId('CUSTTMPL_160_7537160_SB1_255');
        renderer.addCustomDataSource({
            alias: "record",
            format: render.DataSource.JSON,
            data: dataPdf
        })
        var tempelatePdf = renderer.renderAsPdf();
        tempelatePdf.name = ""+ number +"" + customer +"[" + x + "] KODECUSTOMER .pdf"
        dataZip.push(tempelatePdf)

    }
</code>```

But the result output at the customer has ID not a customer name

can I change ID to the customer name? Thanks for helping

Title: Change ID to Customer name

Body:
I Rename at PDF netsuite with Suitelet method

var paramGet = context.request.parameters;
var customer = paramGet.salesname;
var location = paramGet.location;
var startDate = paramGet.startdate;
var endDate = paramGet.enddate;
var number = paramGet.number;
var flagExport = paramGet.flag
var trans = getSales(customer, startDate, endDate, number);

var rawPdfData = getDataSet('pdfdata', trans, checkedValue, number)
    log.debug('raw pdf data', rawPdfData)
    var dataZip = []
    for (x = 0; x < rawPdfData.length; x++) {
        var dataPdf = JSON.stringify(rawPdfData[x])
        log.debug("log data pdf", dataPdf)
        var renderer = render.create();
        log.debug("renderer", renderer)
        renderer.setTemplateByScriptId('CUSTTMPL_160_7537160_SB1_255');
        renderer.addCustomDataSource({
            alias: "record",
            format: render.DataSource.JSON,
            data: dataPdf
        })
        var tempelatePdf = renderer.renderAsPdf();
        tempelatePdf.name = ""+ number +"" + customer +"[" + x + "] KODECUSTOMER .pdf"
        dataZip.push(tempelatePdf)

    }

But the result output at the customer has ID not a customer name

can I change ID to the customer name? Thanks for helping


问:
Cannot copy object of class derived from matlab.mixin.Copyable
I want to create a copy of an object of a class derived from  matlab.mixin.Copyable.

```<code>classdef ImageReaderAny < ImageReaderBase &  matlab.mixin.Copyable
</code>```

If I create the object using

```<code>reader = ImageReaderAny(processFolder);
</code>```

and try to create a copy using

```<code>reader2 = copy(reader);
</code>```

The original object is changed when I access the copy.

I am doing something wrong here?

Body:
I want to create a copy of an object of a class derived from  matlab.mixin.Copyable.

classdef ImageReaderAny < ImageReaderBase &  matlab.mixin.Copyable

If I create the object using

reader = ImageReaderAny(processFolder);

and try to create a copy using

reader2 = copy(reader);

The original object is changed when I access the copy.

I am doing something wrong here?


问:
Dynamic Query for multiple words search
I have written a Query in Linq in which I try to search a word in multiple columns using or operator. For Example, I try to find the word which can be the project title, project Description, Company Name of the project, Email, etc. the query works fine, and here is the query:

```<code>query = (from p in se.CompanyRepresentatives
                             join qr in questionnaires on p.ID equals qr.RespondentID

                             join ra in se.Responses on qr.ID equals ra.QuestionnaireResponseID
                             where ra.QuestionID == 11 || ra.QuestionID == 12 || ra.QuestionID == 13

                             join multiteam in se.Responses on qr.ID equals multiteam.QuestionnaireResponseID
                             where multiteam.QuestionID == ProjectViewModel.MULTI_TEAM_QUESTION_ID

                             join rc in se.Responses on qr.ID equals rc.QuestionnaireResponseID into t
                             from maxTeams in t.Where(x => x.QuestionID == ProjectViewModel.MAX_TEAMS_QUESTION_ID).DefaultIfEmpty(null)

                             where
                            qr.QuestionnaireID == SurveyEntities.PROJECT_QUESTIONNAIRE_ID
                            && (ra.Answer.Contains(projectName) || ( p.CompanyName.Contains(projectName))
                                     || (p.Email.Contains(projectName))
                                     || (p.FirstName.Contains(projectName))))

                             select new ResultViewModel
                             {
                                 CompRep = p,
                                 QuestionnaireRes = qr,
                                 Res = t.FirstOrDefault(x => x.QuestionnaireResponseID == ra.QuestionnaireResponseID && x.QuestionID == 11),
                                 MultiTeam = multiteam,
                                 MaxTeam = maxTeams,
                                 ProjectDeliverable = t.FirstOrDefault(x => x.QuestionnaireResponseID == ra.QuestionnaireResponseID && x.QuestionID == 13).Answer,
                                 ProjectDescription = t.FirstOrDefault(x => x.QuestionnaireResponseID == ra.QuestionnaireResponseID && x.QuestionID == 12).Answer,

                             }).Distinct();
</code>```

Now I need a way where user can look for multiple words, I tried to use ExpressionTrees using lambda expression but it throughs the following exception

LINQ to Entities Does not Support Invoke

Can someone please try to guide me how dynamicaly add multiple and conditions just like static one below:

```<code>where
                            qr.QuestionnaireID == SurveyEntities.PROJECT_QUESTIONNAIRE_ID
                            && (ra.Answer.Contains(projectNames[0]) || ( p.CompanyName.Contains(projectNames[0]))
                                     || ( p.Email.Contains(projectNames[0]))
                                     || (p.FirstName.Contains(projectNames[0]))
                                     )) &&

&& (ra.Answer.Contains(projectNames[1]) || ( p.CompanyName.Contains(projectNames[1]))
                                     || ( p.Email.Contains(projectNames[1]))
                                     || (p.FirstName.ToLower().Contains(projectNames[1]))))
</code>```

I don't know the number of words to be searched otherwise I would use a static query.

I tried the following but it also didn't work:

```<code>where
                            qr.QuestionnaireID == SurveyEntities.PROJECT_QUESTIONNAIRE_ID
                            && (projectNamelist.Any(search=> ra.Answer.ToLower().Contains(search)) || (p.CompanyName != null && projectNamelist.Any(search=> p.CompanyName.ToLower().Contains(search)))
                                     || (p.Email != null && projectNamelist.Any(search => p.Email.ToLower().Contains(search)))
                                     || (p.FirstName != null && projectNamelist.Any(search => p.FirstName.ToLower().Contains(search)))
                                     ))
</code>```

I tried to use expression trees but that throws the exception.

LINQ to Entities Does not Support Invoke

Title: Dynamic Query for multiple words search

Body:
I have written a Query in Linq in which I try to search a word in multiple columns using or operator. For Example, I try to find the word which can be the project title, project Description, Company Name of the project, Email, etc. the query works fine, and here is the query:

query = (from p in se.CompanyRepresentatives
                             join qr in questionnaires on p.ID equals qr.RespondentID

                             join ra in se.Responses on qr.ID equals ra.QuestionnaireResponseID
                             where ra.QuestionID == 11 || ra.QuestionID == 12 || ra.QuestionID == 13

                             join multiteam in se.Responses on qr.ID equals multiteam.QuestionnaireResponseID
                             where multiteam.QuestionID == ProjectViewModel.MULTI_TEAM_QUESTION_ID

                             join rc in se.Responses on qr.ID equals rc.QuestionnaireResponseID into t
                             from maxTeams in t.Where(x => x.QuestionID == ProjectViewModel.MAX_TEAMS_QUESTION_ID).DefaultIfEmpty(null)

                             where
                            qr.QuestionnaireID == SurveyEntities.PROJECT_QUESTIONNAIRE_ID
                            && (ra.Answer.Contains(projectName) || ( p.CompanyName.Contains(projectName))
                                     || (p.Email.Contains(projectName))
                                     || (p.FirstName.Contains(projectName))))

                             select new ResultViewModel
                             {
                                 CompRep = p,
                                 QuestionnaireRes = qr,
                                 Res = t.FirstOrDefault(x => x.QuestionnaireResponseID == ra.QuestionnaireResponseID && x.QuestionID == 11),
                                 MultiTeam = multiteam,
                                 MaxTeam = maxTeams,
                                 ProjectDeliverable = t.FirstOrDefault(x => x.QuestionnaireResponseID == ra.QuestionnaireResponseID && x.QuestionID == 13).Answer,
                                 ProjectDescription = t.FirstOrDefault(x => x.QuestionnaireResponseID == ra.QuestionnaireResponseID && x.QuestionID == 12).Answer,

                             }).Distinct();

Now I need a way where user can look for multiple words, I tried to use ExpressionTrees using lambda expression but it throughs the following exception

LINQ to Entities Does not Support Invoke

Can someone please try to guide me how dynamicaly add multiple and conditions just like static one below:

where
                            qr.QuestionnaireID == SurveyEntities.PROJECT_QUESTIONNAIRE_ID
                            && (ra.Answer.Contains(projectNames[0]) || ( p.CompanyName.Contains(projectNames[0]))
                                     || ( p.Email.Contains(projectNames[0]))
                                     || (p.FirstName.Contains(projectNames[0]))
                                     )) &&

&& (ra.Answer.Contains(projectNames[1]) || ( p.CompanyName.Contains(projectNames[1]))
                                     || ( p.Email.Contains(projectNames[1]))
                                     || (p.FirstName.ToLower().Contains(projectNames[1]))))

I don't know the number of words to be searched otherwise I would use a static query.

I tried the following but it also didn't work:

where
                            qr.QuestionnaireID == SurveyEntities.PROJECT_QUESTIONNAIRE_ID
                            && (projectNamelist.Any(search=> ra.Answer.ToLower().Contains(search)) || (p.CompanyName != null && projectNamelist.Any(search=> p.CompanyName.ToLower().Contains(search)))
                                     || (p.Email != null && projectNamelist.Any(search => p.Email.ToLower().Contains(search)))
                                     || (p.FirstName != null && projectNamelist.Any(search => p.FirstName.ToLower().Contains(search)))
                                     ))

I tried to use expression trees but that throws the exception.

LINQ to Entities Does not Support Invoke


问:
how to fix PM2 error on run a npm script?
When i try command npm install pm2 -m, i get this error enter image description here

i try reload and update nod, but this didn’t help


问:
Mongoose: Does order of sort, skip and limit matter?
I realized that I was calling sort after limit, but that didn't cause any issues (calling sort before limit achieves the same result).

```<code>function mapToSortQuery(sort, search) {
  if (sort == 'recent') {
    return { release_date: -1 }
  } else if (sort == 'popular') {
    return { rating_total: -1 }
  } else if (sort == 'best') {
    return { votes: -1 }
  } else if (sort == 'top') {
    return { rating_avg: -1 }
  } else if (sort == 'trending') {
    return { trend_score: -1 }
  } else if (search) {
    //sort by relevance
    return {
      score: { $meta: 'textScore' },
    }
  } else {
    return { _id: 1 } //sort by id by default
  }
}

router.get('/', async (req, res) => {
  try {
    const { page = 1, limit = 10, sort, search } = req.query //paginated
    const movies = await Movie.find(
      search ? { $text: { $search: search } } : {}
    )
      .limit(limit)
      .skip((page - 1) * limit)
      .sort(mapToSortQuery(sort, search))
      .exec()
    res.send(movies)
  } catch (err) {
    res.status(500).send(err)
  }
})
</code>```

I tested it on MongoDB Compass, and you can only sort on the items that are present after limit, instead of all the items which is the desired behavior.

So now I am confused by why my original code worked as intended.

Also, I am confused by the distinction between queries (find) and aggregation (match); should I be using match <s>instead of mixing find with other aggregation methods</s>(Edit: actually limit and skip are also query methods)?

Body:
I realized that I was calling sort after limit, but that didn't cause any issues (calling sort before limit achieves the same result).

function mapToSortQuery(sort, search) {
  if (sort == 'recent') {
    return { release_date: -1 }
  } else if (sort == 'popular') {
    return { rating_total: -1 }
  } else if (sort == 'best') {
    return { votes: -1 }
  } else if (sort == 'top') {
    return { rating_avg: -1 }
  } else if (sort == 'trending') {
    return { trend_score: -1 }
  } else if (search) {
    //sort by relevance
    return {
      score: { $meta: 'textScore' },
    }
  } else {
    return { _id: 1 } //sort by id by default
  }
}

router.get('/', async (req, res) => {
  try {
    const { page = 1, limit = 10, sort, search } = req.query //paginated
    const movies = await Movie.find(
      search ? { $text: { $search: search } } : {}
    )
      .limit(limit)
      .skip((page - 1) * limit)
      .sort(mapToSortQuery(sort, search))
      .exec()
    res.send(movies)
  } catch (err) {
    res.status(500).send(err)
  }
})

I tested it on MongoDB Compass, and you can only sort on the items that are present after limit, instead of all the items which is the desired behavior.

So now I am confused by why my original code worked as intended.

Also, I am confused by the distinction between queries (find) and aggregation (match); should I be using match <s>instead of mixing find with other aggregation methods</s>(Edit: actually limit and skip are also query methods)?


问:
Compiler issues "__builtin_ia32_foo" not declared in scope when importing headers from PCL installed using vcpkg (likely related to Eigen)
Problem 1) Very new to C++ and compiling in general, being mostly experienced in Python

Problem 2) I have installed Point Cloud Library (PCL) as per PCL's recommendations using vcpkg - specifically using vcpkg install pcl:x64-windows -  and am trying to follow the procedure to import .pcd files detailed in this tutorial. I had written some previous code to list .pcd's in a folder, which compiled fine, however, as soon as I include any PCL libraries, I get a number of compile errors (in cLion console) like:

```<code>====================[ Build | FallingRockDetectionPC | Debug ]==================
"C:\Program Files\JetBrains\CLion 2022.3\bin\cmake\win\bin\cmake.exe" --build C:\...\Projects\FallingRockDetectionPC\cmake-build-debug --target FallingRockDetectionPC -j 16
[1/3] Building CXX object CMakeFiles/FallingRockDetectionPC.dir/main.cpp.obj
FAILED: CMakeFiles/FallingRockDetectionPC.dir/main.cpp.obj
C:\PROGRA~1\JETBRA~1\CLION2~1.3\bin\mingw\bin\G__~1.EXE -DDISABLE_PNG -D__SSE2__ -D__SSE3__ -D__SSE4_1__ -D__SSE4_2__ -D__SSE__ -D__SSSE3__ -isystem C:/.../Programs/vcpkg/installed/x64-windows/include -isystem C:/.../Programs/vcpkg/installed/x64-windows/include/eigen3 -g -fdiagnostics-color=always -MD -MT CMakeFiles/FallingRockDetectionPC.dir/main.cpp.obj -MF CMakeFiles\FallingRockDetectionPC.dir\main.cpp.obj.d -o CMakeFiles/FallingRockDetectionPC.dir/main.cpp.obj -c C:/.../Projects/FallingRockDetectionPC/main.cpp

In file included from C:/Users/samue/Programs/vcpkg/installed/x64-windows/include/Eigen/src/Core/util/ConfigureVectorization.h:349,
                 from .../vcpkg/installed/x64-windows/include/Eigen/Core:22,
                 from .../vcpkg/installed/x64-windows/include/pcl/memory.h:48,
                 from .../vcpkg/installed/x64-windows/include/pcl/io/pcd_io.h:42,
                 .
                 .
                 .
...\mingw64\lib\gcc\x86_64-w64-mingw32\12.2.0\include\pmmintrin.h: In function '__m128 _mm_addsub_ps(__m128, __m128)':
...\mingw64\lib\gcc\x86_64-w64-mingw32\12.2.0\include\pmmintrin.h:53:19: error: '__builtin_ia32_addsubps' was not declared in this scope; did you mean '__builtin_ia32_subps'?
   53 |   return (__m128) __builtin_ia32_addsubps ((__v4sf)__X, (__v4sf)__Y);
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
      |                   __builtin_ia32_subps
</code>```

Plus many more relating to various functions prefixed with __builtins_ia32. The errors occur regardless of whether I invoke any of the PCL classes, and occur regardless of the library imported, seeming to be issues stemming from the use of the Eigen library in PCL. (I've replaced some elements of paths with ellipses)

I've done a bit of research and see these are related to machine directives or something to do with vectorising/optimising for specific architecture instruction sets, but as to how to fix it, I have no clue. I have tried recompiling PCL specifically using a x64 version of cMake in vcpkg, thinking there might be some architecture issues. I changed from cLion's bundled mingw to current 'external' versions. I deleted vcpkg and folders in their entirety because I had mistakenly installed x86 versions of packages which were being used by default, and reinstalled PCL.

In the interest of completeness, this is my cMakeLists file:

```<code>cmake_minimum_required(VERSION 3.24)
project(FallingRockDetectionPC)

find_package(PCL CONFIG REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})

set(CMAKE_CXX_STANDARD 17)

add_executable(FallingRockDetectionPC main.cpp load_sequential_pc.cpp load_sequential_pc.h)
target_link_libraries(FallingRockDetectionPC PRIVATE ${PCL_LIBRARIES})
</code>```

As said, I'm very new to C++, and was kinda using a C++ project like this to try and learn a bit. Maybe not the best one to start with. Appreciate any help anyone can provide. Cheers.

Body:
Problem 1) Very new to C++ and compiling in general, being mostly experienced in Python

Problem 2) I have installed Point Cloud Library (PCL) as per PCL's recommendations using vcpkg - specifically using vcpkg install pcl:x64-windows -  and am trying to follow the procedure to import .pcd files detailed in this tutorial. I had written some previous code to list .pcd's in a folder, which compiled fine, however, as soon as I include any PCL libraries, I get a number of compile errors (in cLion console) like:

====================[ Build | FallingRockDetectionPC | Debug ]==================
"C:\Program Files\JetBrains\CLion 2022.3\bin\cmake\win\bin\cmake.exe" --build C:\...\Projects\FallingRockDetectionPC\cmake-build-debug --target FallingRockDetectionPC -j 16
[1/3] Building CXX object CMakeFiles/FallingRockDetectionPC.dir/main.cpp.obj
FAILED: CMakeFiles/FallingRockDetectionPC.dir/main.cpp.obj
C:\PROGRA~1\JETBRA~1\CLION2~1.3\bin\mingw\bin\G__~1.EXE -DDISABLE_PNG -D__SSE2__ -D__SSE3__ -D__SSE4_1__ -D__SSE4_2__ -D__SSE__ -D__SSSE3__ -isystem C:/.../Programs/vcpkg/installed/x64-windows/include -isystem C:/.../Programs/vcpkg/installed/x64-windows/include/eigen3 -g -fdiagnostics-color=always -MD -MT CMakeFiles/FallingRockDetectionPC.dir/main.cpp.obj -MF CMakeFiles\FallingRockDetectionPC.dir\main.cpp.obj.d -o CMakeFiles/FallingRockDetectionPC.dir/main.cpp.obj -c C:/.../Projects/FallingRockDetectionPC/main.cpp

In file included from C:/Users/samue/Programs/vcpkg/installed/x64-windows/include/Eigen/src/Core/util/ConfigureVectorization.h:349,
                 from .../vcpkg/installed/x64-windows/include/Eigen/Core:22,
                 from .../vcpkg/installed/x64-windows/include/pcl/memory.h:48,
                 from .../vcpkg/installed/x64-windows/include/pcl/io/pcd_io.h:42,
                 .
                 .
                 .
...\mingw64\lib\gcc\x86_64-w64-mingw32\12.2.0\include\pmmintrin.h: In function '__m128 _mm_addsub_ps(__m128, __m128)':
...\mingw64\lib\gcc\x86_64-w64-mingw32\12.2.0\include\pmmintrin.h:53:19: error: '__builtin_ia32_addsubps' was not declared in this scope; did you mean '__builtin_ia32_subps'?
   53 |   return (__m128) __builtin_ia32_addsubps ((__v4sf)__X, (__v4sf)__Y);
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
      |                   __builtin_ia32_subps

Plus many more relating to various functions prefixed with __builtins_ia32. The errors occur regardless of whether I invoke any of the PCL classes, and occur regardless of the library imported, seeming to be issues stemming from the use of the Eigen library in PCL. (I've replaced some elements of paths with ellipses)

I've done a bit of research and see these are related to machine directives or something to do with vectorising/optimising for specific architecture instruction sets, but as to how to fix it, I have no clue. I have tried recompiling PCL specifically using a x64 version of cMake in vcpkg, thinking there might be some architecture issues. I changed from cLion's bundled mingw to current 'external' versions. I deleted vcpkg and folders in their entirety because I had mistakenly installed x86 versions of packages which were being used by default, and reinstalled PCL.

In the interest of completeness, this is my cMakeLists file:

cmake_minimum_required(VERSION 3.24)
project(FallingRockDetectionPC)

find_package(PCL CONFIG REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})

set(CMAKE_CXX_STANDARD 17)

add_executable(FallingRockDetectionPC main.cpp load_sequential_pc.cpp load_sequential_pc.h)
target_link_libraries(FallingRockDetectionPC PRIVATE ${PCL_LIBRARIES})

As said, I'm very new to C++, and was kinda using a C++ project like this to try and learn a bit. Maybe not the best one to start with. Appreciate any help anyone can provide. Cheers.


问:
Toggle Classes in between two divs in different files using buttons in reactJS
I'm fairly New to React and stuck on a problem with how to import tags from other JS files in react.js to add classes and functionality. I used useRef() but it's a little confusing

```<code>import React, { useRef } from "react";
import GPS from '../resources/gps.png'
import cloud from '../resources/Shower.png'
import location from '../resources/location.png'
export default function Today()
{
    return(
        <div>
        <div ref={clicked} className="Today">
            <div className="Nav">
                <button  className="Search">Seach for places</button>
                <img className="gps" src={GPS}></img>
            </div>
            <div className="information">
                <img className="cloud" src={cloud}></img>
                <h1>15<sub>°C</sub></h1>
                <h3>Shower</h3>
                <p> <span>Today</span> <span> Fri, 11 Dec</span> </p>
                <div className="location">
                <img className="loca" src={location} ></img>
                <p>New Delhi</p>
                </div>
            </div>
        </div>
        </div>
    )
}
</code>```

This is the first file in which I want to import the "find-location" of another file

```<code>import React from "react";
import Cross from '../resources/cross.png'

export default function Search(props)
{
    return (
        <div className="find-location ">
        <button className="cross-button"><img className="cross" src={Cross}></img></button>
        <div className="search--tab">
         <input className="field" placeholder=" search location"></input>
         <button className="clicked">Search</button>
        </div>
     </div>
    )
}
</code>```

I tried useRef and successfully imported from 2nd to first but was unable to do vice versa

Body:
I'm fairly New to React and stuck on a problem with how to import tags from other JS files in react.js to add classes and functionality. I used useRef() but it's a little confusing

import React, { useRef } from "react";
import GPS from '../resources/gps.png'
import cloud from '../resources/Shower.png'
import location from '../resources/location.png'
export default function Today()
{
    return(

                <button  className="Search">Seach for places</button>

15°C

Shower

 Today  Fri, 11 Dec

New Delhi

    )
}

This is the first file in which I want to import the "find-location" of another file

import React from "react";
import Cross from '../resources/cross.png'

export default function Search(props)
{
    return (

        <button className="cross-button"></button>

         <input className="field" placeholder=" search location"></input>
         <button className="clicked">Search</button>

    )
}

I tried useRef and successfully imported from 2nd to first but was unable to do vice versa