text:
Q: Depending of clicked button to open different activity android On my start(home) screen I have 3 buttons. Button_1, Button_2 and Button_3. They are all open same Activity B. So here I need depending on which button is clicked on home screen to open different Activity C after second activity. I can make it with 2 buttons but when I try with third button with elseif it doesn't work properly. Here is how I trying it.
Home screen
Button_1.setOnClickListener(new View.OnClickListener() {

    @Override
    public void onClick(View v) {
        Intent intent = new Intent(MainActivity.this, SecondActivity.class);
        intent.putExtra("isButtonClicked",true);
        startActivity(intent);

    }
});

Button_2.setOnClickListener(new View.OnClickListener() {

    @Override
    public void onClick(View v) {
        Intent intent = new Intent(MainActivity.this, SecondActivity.class);
        intent.putExtra("button", true);
        startActivity(intent);

    }
});
Button_3.setOnClickListener(new View.OnClickListener() {

    @Override
    public void onClick(View v) {
        Intent intent = new Intent(MainActivity.this, SecondActivity.class);
        intent.putExtra("isButtonClicked",false);
        startActivity(intent);

    }
});

Here is SecondActivity
boolean isButton = getIntent().getBooleanExtra("isButtonClicked",false);
boolean button = getIntent().getBooleanExtra("button",true);
            if(isButton)
            {
                Intent newActivity = new Intent(SecondActivity.this, ThirdActivity.class);
                newActivity.putExtra("Position", Position);
                newActivity.putExtra("resultServer", resultServer);

                newActivity.putExtra("text", MyArrList.get(position).get("text").toString());
                newActivity.putExtra("name", MyArrList.get(position).get("name").toString());
                startActivity(newActivity);
            }
            else if (button)
            {

                Intent newActivity = new Intent(SecondActivity.this, FourthActivity.class);
                newActivity.putExtra("Position", Position);
                newActivity.putExtra("resultServer", resultServer);
                newActivity.putExtra("id", MyArrList.get(position).get("id").toString());
                startActivity(newActivity);
            }
            else
            {
                Intent newActivity = new Intent(SecondActivity.this, FifthActivity.class);
                newActivity.putExtra("Position", Position);
                newActivity.putExtra("resultServer", resultServer);
                newActivity.putExtra("id", MyArrList.get(position).get("id").toString());
                startActivity(newActivity);
            }

As you can see after second activity which is same for all 3 buttons then I want to load different. If I put it just with if{}else{} i.e. for two buttons is working good. But now I get same result on Button_2 and Button_3.

A: Just found that:
boolean button = getIntent().getBooleanExtra("button",true);

should always return true. As it has a default value set to true. So your elseif will work always..if Button_1 is not clicked!
Fix:
boolean button = getIntent().getBooleanExtra("button",false);

A: You have:
boolean button = getIntent().getBooleanExtra("button",true);

So in 2nd and 3rd option this value will be true, so this is the reason of it.
Change to:
boolean button = getIntent().getBooleanExtra("button",false);

and should be ok.


text:
Q: Powershell 7.2 Profile can't create In my pc with Windows 10 I installed Powershell 7.2.2 from Microsoft Store and now I wanna use Oh My Posh but i can't find, create or edit the $PROFILE file.

*

*If I type echo $PROFILE this no return nothing.

*If I type notepad $PROFILE, it open a empty notepad and i don't know where store it (file > save > path is my desktop)

*If I type New-item –type file –force $profile, a message says error "path can't be null" ($profile not exists).

Any can help me?

redpajama_set_name: RedPajamaStackExchange


text:
Q: I need to find the distribution of data, which is from a retail chain network. No distribution fits the data I need to find the distribution of data, which is from a retail chain network( demand of product across all stores). I tried to fit distribution using EasyFit (which has 82 distribution to check the best distributions) but no distribution fits the data. What can be done? Is there any way to find if the data distribution is a sum or convolution of multiple distribution? I have removed the spikes or seasonality or promotional data from the dataset but still no distribution fits.

A: It depends on what you mean by " no distribution fits the data". You get the best fit by ranking the distributions (using Kolmogorov-Smirnov, Anderson Darling, chi-squared or other test statistics). You won't get a perfect fit as the distributions are theoretical, you work with the best fit, or don't work with it at all. Post some of the data, and the best fit test statistic, or elaborate on the question. Sometimes you just need to accept that the data is either poorly constructed, or that it just makes no sense in analysing it.
If the question is purely statistical in nature, you might be better off posting it on https://stats.stackexchange.com/.

A: Have you tried transforming the data? Simulate multiple transformations and take the best approximation to a distribution amenable for statistical inference.


text:
Q: How can I compose the result object of a linq to sql query to maximize code reuse? Setup
I am using a linq-to-sql query (using Linq2db) to perform a search.
Depending on which part of the application the user runs this search from, the result will have certain additional fields populated. The result object thus contains some properties that are common between parts, and some that are unique.
class UserSearchResult
{
    // always populated
    public int    UserId { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public string Supervisor { get; set; }

    // only populated in user maintenance
    public string RoleName { get; set; }

    // only populated in user scheduling
    public int    PTOAccrued { get; set; }
    public int    ScheduleId { get; set; }
    public string ScheduleName { get; set; }
}

The columns that are specific to one part of the application are expensive to query. As such, I am currently a different query for each part:
// query for maintenance area
IQueryable<UserSearchResult> UserMaintenanceResultQry(IQueryable<User> filteredUsers) =>
    from user in filteredUsers
    join utor in db.UserToRole on user.UserId equals utor.UserId
    select new UserSearchResult()
    {
        UserId = user.UserId,
        FirstName = user.FirstName,
        LastName = user.LastName,
        Supervisor = $"{user.Supervisor.FirstName} {user.Supervisor.LastName} ({user.SupervisorId})",

        RoleName = utor.Role.RoleName // uses navigation property
    };

// query for scheduling area
IQueryable<UserSearchResult> UserSchedulingResultQry(IQueryable<User> filteredUsers) =>
    from user in filteredUsers
    join utos in db.UserToSchedule on user.UserId equals utos.UserId
    join pto  in db.PTO on user.UserId equals pto.UserId
    select new UserSearchResult()
    {
        UserId = user.UserId,
        FirstName = user.FirstName,
        LastName = user.LastName,
        Supervisor = $"{user.Supervisor.FirstName} {user.Supervisor.LastName} ({user.SupervisorId})",

        PTOAccured = pto.PTOAccrued,
        ScheduleId = utos.ScheduleId,
        ScheduleName = utos.Schedule.ScheduleName
    };

This is, of course, example code. There are lots of properties (both common and unique) and the joins are often complex and expensive.
My Question
In my real code, there are about 20 common properties and 3 areas. That means I duplicate the exact same common property-setting code in 3 different places. I would like a way to eliminate this duplication.
What I've Tried
One method that actually works is to create a constructor for UserSearchResult:
// constructor
public UserSearchResult(User user)
{
    UserId = user.UserId;
    FirstName = user.FirstName;
    // ...etc
}

// and then in the query ...
    from user in filteredUsers
    join utor in db.UserToRole on user.UserId equals utor.UserId
    select new UserSearchResult(user)
    {
        // perfect! Now I can just set the unique properties!
        RoleName = utor.Role.RoleName // uses navigation property
    };

There are two major problems with this approach:

*

*Using the User object as a constructor parameter causes every field from the User table to be queried, even if it's not used. This query often 10s of thousands of results, so pulling (a lot of) additional columns isn't acceptable.

*Navigation properties cannot be used within the constructor, so the Supervisor field cannot  be set in the constructor. I COULD use linq2db's LoadWith method to load the navigation objects, but that in turn would load the entire navigation object instead of just the properties needed.

Conclusion
Is there any way to compose my queries to avoid needing to repeat the common properties that need to be set?


text:
Q: How to animated SVG to draw the lines instead of outlines? I am trying to animate an SVG file to look like the gif below as much as possible, i'm getting pretty close i think but i'm stuck on an issue where i don't know why the outlines are drawed then the entire thing is filled. I would like the entire lines to be animated as shown in the gif.
Do anyone know what i could change in my CSS or if i there is something in the SVG that i need to modify to make this possible, i'm quite new to animating SVGs.
Current Animation

<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1244.41 201.57">
    <defs>
      <style>
      .cls-1 {
        fill:#f59e00;
      }
      .cls-2 {
        fill:#7a1331;
      }
      #Dots circle {
        fill:#1e9a64;
      }
      #Lines path {
        animation: draw 3s linear forwards;
        animation-delay: 1.2s;
      }

      #Years_Text {
        animation: 1s ease-out 0s 1 slideInFromRight;
      }

      .line-1 {
        stroke-dasharray: 2150;
        stroke-dashoffset: 2150;
      }
      .line-2 {
        stroke-dasharray: 1600;
        stroke-dashoffset: 1600;
      }
      .line-3 {
        stroke-dasharray: 1000;
        stroke-dashoffset: 1000;
      }
      .line-4 {
        stroke-dasharray: 650;
        stroke-dashoffset: 650;
      }
      .line-5 {
        stroke-dasharray: 1600;
        stroke-dashoffset: 1600;
      }
      .line-6 {
        stroke-dasharray: 1300;
        stroke-dashoffset: 1300;
      }

        @keyframes draw {
          to {
            stroke-dashoffset: 0;
            fill: #1e9a64;
          }
        }

        .dot-1 {
          animation: 1s ease-out 0s 1 slideInFromLeft;
        }
        .dot-2 {
          animation: 1s ease-out 0s 1 slideInFromCenterToLeft;
        }
        .dot-3 {
          animation: 1s ease-out 0s 1 slideInFromCenterToLeft;
        }
        .dot-4 {
          animation: 1s ease-out 0s 1 slideInFromCenterToLeft;
        }
        .dot-5 {
          animation: 1s ease-out 0s 1 slideInFromLeft;
        }
        .dot-6 {
          animation: 1s ease-out 0s 1 slideInFromLeft;
        }
        .dot-7 {
          animation: 1s ease-out 0s 1 slideInFromCenterToRight;
        }
        .dot-8 {
          animation: 1s ease-out 0s 1 slideInFromCenterToRight;
        }
        .dot-9 {
          animation: 1s ease-out 0s 1 slideInFromTop;
        }
        .dot-10 {
          animation: 1s ease-out 0s 1 slideInFromLeft;
        }
        .dot-11 {
          animation: 1s ease-out 0s 1 slideInFromRight;
        }
        .dot-12 {
          animation: 1s ease-out 0s 1 slideInFromRight;
        }

        @keyframes slideInFromLeft {
          0% {
            transform: translate(-20%, -20%);
          }
          100% {
            transform: translate(0, 0);

          }
        }
        @keyframes slideInFromRight {
          0% {
            transform: translate(+20%, +20%);
          }
          100% {
            transform: translate(0, 0);

          }
        }
        @keyframes slideInFromCenterToRight {
          0% {
            transform: translate(-5%, +50%);
          }
          100% {
            transform: translate(0, 0);

          }
        }
        @keyframes slideInFromCenterToLeft {
          0% {
            transform: translate(+15%, +30%);
          }
          100% {
            transform: translate(0, 0);

          }
        }
        @keyframes slideInFromTop {
          0% {
            transform: translate(-5%, -5%);
          }
          100% {
            transform: translate(0, 0);

          }
        }

        </style>
    </defs>

<g id="Lines">
        <path class="line-1" fill="none" stroke="#1e9a64" stroke-width="2" d="M1155.49,188.09h-69.85A3.74,3.74,0,0,1,1083,187l-20.2-20.19a3.73,3.73,0,0,1-1.09-2.64v-137a3.73,3.73,0,0,1,1.09-2.64L1083,4.35a3.74,3.74,0,0,1,2.64-1.1h24.21a3.74,3.74,0,0,1,0,7.47h-22.67l-18,18V162.61l18,18h66.76l18-18V28.73l-18-18h-23.45a3.74,3.74,0,1,1,0-7.47h25a3.74,3.74,0,0,1,2.64,1.1l20.2,20.19a3.73,3.73,0,0,1,1.09,2.64v137a3.73,3.73,0,0,1-1.09,2.64L1158.13,187A3.74,3.74,0,0,1,1155.49,188.09Z" />
        <path class="line-2" fill="none" stroke="#1e9a64" stroke-width="2" d="M1145.2,169.43h-14.71a3.74,3.74,0,1,1,0-7.47h13.11l9.7-10.21V39.25l-9.67-9.87H1098.2l-10.37,9.93V151.68l10.4,10.28h11.62a3.74,3.74,0,0,1,0,7.47H1096.7a3.73,3.73,0,0,1-2.62-1.08l-12.6-12.46a3.71,3.71,0,0,1-1.11-2.65V37.72a3.69,3.69,0,0,1,1.15-2.69L1094.12,23a3.71,3.71,0,0,1,2.58-1h48.5a3.79,3.79,0,0,1,2.67,1.12l11.82,12.08a3.72,3.72,0,0,1,1.07,2.61V153.24a3.72,3.72,0,0,1-1,2.57l-11.82,12.45A3.73,3.73,0,0,1,1145.2,169.43Z" />
        <path class="line-3" fill="none" stroke="#1e9a64" stroke-width="2" d="M1131.61,150.77h-23.15a3.76,3.76,0,0,1-2.6-1.05l-5.69-5.51a3.71,3.71,0,0,1-1.14-2.68V106a3.73,3.73,0,1,1,7.46,0v34l3.48,3.36h20.31l4.36-3.55V52.26L1130.13,48h-20l-3.63,4V85.35a3.73,3.73,0,0,1-7.46,0V50.64a3.73,3.73,0,0,1,1-2.49l5.7-6.34a3.74,3.74,0,0,1,2.78-1.24h23.15a3.73,3.73,0,0,1,2.55,1l6.76,6.34a3.75,3.75,0,0,1,1.18,2.72v90.89a3.74,3.74,0,0,1-1.38,2.89l-6.76,5.51A3.73,3.73,0,0,1,1131.61,150.77Z" />
        <path class="line-4" fill="none" stroke="#1e9a64" stroke-width="2" d="M974.43,150.77H938a3.74,3.74,0,0,1,0-7.47H970.7v-84l-11.33,5.72A3.73,3.73,0,0,1,956,58.41L972.75,50a3.72,3.72,0,0,1,5.41,3.33V147A3.73,3.73,0,0,1,974.43,150.77Z" />
        <path class="line-5" fill="none" stroke="#1e9a64" stroke-width="2" d="M1048.22,188.09H938a3.73,3.73,0,0,1-3.73-3.74V165.69A3.73,3.73,0,0,1,938,162h51.39V29.38h-6.5L949.75,46.73a3.73,3.73,0,1,1-3.46-6.61l33.92-17.78a3.72,3.72,0,0,1,1.73-.43h11.15a3.73,3.73,0,0,1,3.73,3.73V165.69a3.73,3.73,0,0,1-3.73,3.74H941.7v11.19h106.52a3.74,3.74,0,0,1,0,7.47Z" />
        <path class="line-6" fill="none" stroke="#1e9a64" stroke-width="2" d="M1048.22,169.43h-36.47a3.74,3.74,0,0,1,0-7.47h32.73V150.77h-32.73A3.73,3.73,0,0,1,1008,147V10.72H975.33L940.84,28.36a3.73,3.73,0,1,1-3.4-6.64L972.73,3.66a3.74,3.74,0,0,1,1.7-.41h37.32A3.73,3.73,0,0,1,1015.48,7V143.3h32.74A3.73,3.73,0,0,1,1052,147v18.66A3.73,3.73,0,0,1,1048.22,169.43Z" />
    </g>

    <g id="Dots">
        <circle class="dot-1" cx="941.03" cy="147.03" r="6.98" />
        <circle class="dot-2" cx="941.23" cy="23.59" r="6.98" />
        <circle class="dot-3" cx="958.83" cy="61.32" r="6.98" />
        <circle class="dot-4" cx="949.22" cy="42.96" r="6.98" />
        <circle class="dot-5" cx="1014.77" cy="165.69" r="6.98" />
        <circle class="dot-6" cx="1045.08" cy="184.35" r="6.98" />
        <circle class="dot-7" cx="1109.85" cy="6.98" r="6.98" />
        <circle class="dot-8" cx="1130.49" cy="6.98" r="6.98" />
        <circle class="dot-9" cx="1109.85" cy="165.69" r="6.98" />
        <circle class="dot-10" cx="1130.49" cy="165.69" r="6.98" />
        <circle class="dot-11" cx="1102.87" cy="105.99" r="6.98" />
        <circle class="dot-12" cx="1102.87" cy="85.35" r="6.98" />
    </g>
</svg>

Wanted Animation

A: The basic issue is:
@keyframes draw {
  to {
    stroke-dashoffset: 0;
    fill: #1e9a64; <=== this
  }
}

You can't fill as the path draws only after  the path is complete.
I'd suggest adjusting the paths so that the space between the path "sides* is approximately half the stroke width.
Alternatively, adjust the stroke width (say stroke-width="7.5") and make the circles a little larger (say r="9.98)...
Something like this (poor approximation):

svg {
  margin: 5vh
}
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1244.41 201.57">
    <defs>
      <style>
      .cls-1 {
        fill:#f59e00;
      }
      .cls-2 {
        fill:#7a1331;
      }
      #Dots circle {
        fill:#1e9a64;
      }
      #Lines path {
        animation: draw 3s linear forwards;
        animation-delay: 1.2s;
      }

      #Years_Text {
        animation: 1s ease-out 0s 1 slideInFromRight;
      }

      .line-1 {
        stroke-dasharray: 2150;
        stroke-dashoffset: 2150;
      }
      .line-2 {
        stroke-dasharray: 1600;
        stroke-dashoffset: 1600;
      }
      .line-3 {
        stroke-dasharray: 1000;
        stroke-dashoffset: 1000;
      }
      .line-4 {
        stroke-dasharray: 650;
        stroke-dashoffset: 650;
      }
      .line-5 {
        stroke-dasharray: 1600;
        stroke-dashoffset: 1600;
      }
      .line-6 {
        stroke-dasharray: 1300;
        stroke-dashoffset: 1300;
      }

        @keyframes draw {
          to {
            stroke-dashoffset: 0;
          }
        }

        .dot-1 {
          animation: 1s ease-out 0s 1 slideInFromLeft;
        }
        .dot-2 {
          animation: 1s ease-out 0s 1 slideInFromCenterToLeft;
        }
        .dot-3 {
          animation: 1s ease-out 0s 1 slideInFromCenterToLeft;
        }
        .dot-4 {
          animation: 1s ease-out 0s 1 slideInFromCenterToLeft;
        }
        .dot-5 {
          animation: 1s ease-out 0s 1 slideInFromLeft;
        }
        .dot-6 {
          animation: 1s ease-out 0s 1 slideInFromLeft;
        }
        .dot-7 {
          animation: 1s ease-out 0s 1 slideInFromCenterToRight;
        }
        .dot-8 {
          animation: 1s ease-out 0s 1 slideInFromCenterToRight;
        }
        .dot-9 {
          animation: 1s ease-out 0s 1 slideInFromTop;
        }
        .dot-10 {
          animation: 1s ease-out 0s 1 slideInFromLeft;
        }
        .dot-11 {
          animation: 1s ease-out 0s 1 slideInFromRight;
        }
        .dot-12 {
          animation: 1s ease-out 0s 1 slideInFromRight;
        }

        @keyframes slideInFromLeft {
          0% {
            transform: translate(-20%, -20%);
          }
          100% {
            transform: translate(0, 0);

          }
        }
        @keyframes slideInFromRight {
          0% {
            transform: translate(+20%, +20%);
          }
          100% {
            transform: translate(0, 0);

          }
        }
        @keyframes slideInFromCenterToRight {
          0% {
            transform: translate(-5%, +50%);
          }
          100% {
            transform: translate(0, 0);

          }
        }
        @keyframes slideInFromCenterToLeft {
          0% {
            transform: translate(+15%, +30%);
          }
          100% {
            transform: translate(0, 0);

          }
        }
        @keyframes slideInFromTop {
          0% {
            transform: translate(-5%, -5%);
          }
          100% {
            transform: translate(0, 0);

          }
        }

        </style>
    </defs>

<g id="Lines">
        <path class="line-1" fill="none" stroke="#1e9a64" stroke-width="7.5" d="M1155.49,188.09h-69.85A3.74,3.74,0,0,1,1083,187l-20.2-20.19a3.73,3.73,0,0,1-1.09-2.64v-137a3.73,3.73,0,0,1,1.09-2.64L1083,4.35a3.74,3.74,0,0,1,2.64-1.1h24.21a3.74,3.74,0,0,1,0,7.47h-22.67l-18,18V162.61l18,18h66.76l18-18V28.73l-18-18h-23.45a3.74,3.74,0,1,1,0-7.47h25a3.74,3.74,0,0,1,2.64,1.1l20.2,20.19a3.73,3.73,0,0,1,1.09,2.64v137a3.73,3.73,0,0,1-1.09,2.64L1158.13,187A3.74,3.74,0,0,1,1155.49,188.09Z" />
        <path class="line-2" fill="none" stroke="#1e9a64" stroke-width="7.5" d="M1145.2,169.43h-14.71a3.74,3.74,0,1,1,0-7.47h13.11l9.7-10.21V39.25l-9.67-9.87H1098.2l-10.37,9.93V151.68l10.4,10.28h11.62a3.74,3.74,0,0,1,0,7.47H1096.7a3.73,3.73,0,0,1-2.62-1.08l-12.6-12.46a3.71,3.71,0,0,1-1.11-2.65V37.72a3.69,3.69,0,0,1,1.15-2.69L1094.12,23a3.71,3.71,0,0,1,2.58-1h48.5a3.79,3.79,0,0,1,2.67,1.12l11.82,12.08a3.72,3.72,0,0,1,1.07,2.61V153.24a3.72,3.72,0,0,1-1,2.57l-11.82,12.45A3.73,3.73,0,0,1,1145.2,169.43Z" />
        <path class="line-3" fill="none" stroke="#1e9a64" stroke-width="7.5" d="M1131.61,150.77h-23.15a3.76,3.76,0,0,1-2.6-1.05l-5.69-5.51a3.71,3.71,0,0,1-1.14-2.68V106a3.73,3.73,0,1,1,7.46,0v34l3.48,3.36h20.31l4.36-3.55V52.26L1130.13,48h-20l-3.63,4V85.35a3.73,3.73,0,0,1-7.46,0V50.64a3.73,3.73,0,0,1,1-2.49l5.7-6.34a3.74,3.74,0,0,1,2.78-1.24h23.15a3.73,3.73,0,0,1,2.55,1l6.76,6.34a3.75,3.75,0,0,1,1.18,2.72v90.89a3.74,3.74,0,0,1-1.38,2.89l-6.76,5.51A3.73,3.73,0,0,1,1131.61,150.77Z" />
        <path class="line-4" fill="none" stroke="#1e9a64" stroke-width="7.5" d="M974.43,150.77H938a3.74,3.74,0,0,1,0-7.47H970.7v-84l-11.33,5.72A3.73,3.73,0,0,1,956,58.41L972.75,50a3.72,3.72,0,0,1,5.41,3.33V147A3.73,3.73,0,0,1,974.43,150.77Z" />
        <path class="line-5" fill="none" stroke="#1e9a64" stroke-width="7.5" d="M1048.22,188.09H938a3.73,3.73,0,0,1-3.73-3.74V165.69A3.73,3.73,0,0,1,938,162h51.39V29.38h-6.5L949.75,46.73a3.73,3.73,0,1,1-3.46-6.61l33.92-17.78a3.72,3.72,0,0,1,1.73-.43h11.15a3.73,3.73,0,0,1,3.73,3.73V165.69a3.73,3.73,0,0,1-3.73,3.74H941.7v11.19h106.52a3.74,3.74,0,0,1,0,7.47Z" />
        <path class="line-6" fill="none" stroke="#1e9a64" stroke-width="7.5" d="M1048.22,169.43h-36.47a3.74,3.74,0,0,1,0-7.47h32.73V150.77h-32.73A3.73,3.73,0,0,1,1008,147V10.72H975.33L940.84,28.36a3.73,3.73,0,1,1-3.4-6.64L972.73,3.66a3.74,3.74,0,0,1,1.7-.41h37.32A3.73,3.73,0,0,1,1015.48,7V143.3h32.74A3.73,3.73,0,0,1,1052,147v18.66A3.73,3.73,0,0,1,1048.22,169.43Z" />
    </g>

    <g id="Dots">
        <circle class="dot-1" cx="941.03" cy="147.03" r="9.98" />
        <circle class="dot-2" cx="941.23" cy="23.59" r="9.98" />
        <circle class="dot-3" cx="958.83" cy="61.32" r="9.98" />
        <circle class="dot-4" cx="949.22" cy="42.96" r="9.98" />
        <circle class="dot-5" cx="1014.77" cy="165.69" r="9.98" />
        <circle class="dot-6" cx="1045.08" cy="184.35" r="9.98" />
        <circle class="dot-7" cx="1109.85" cy="6.98" r="9.98" />
        <circle class="dot-8" cx="1130.49" cy="6.98" r="9.98" />
        <circle class="dot-9" cx="1109.85" cy="165.69" r="9.98" />
        <circle class="dot-10" cx="1130.49" cy="165.69" r="9.98" />
        <circle class="dot-11" cx="1102.87" cy="105.99" r="9.98" />
        <circle class="dot-12" cx="1102.87" cy="85.35" r="9.98" />
    </g>
</svg>

BTW, there is an attribute in SVG called pathLength which can be set manually say to pathLength=""`.
From CSS-Tricks

That doesn't do anything by itself (as far as I know). It's not like that only draws part of the path — it still draws the whole thing like as if you did nothing, only now the "math" of the path length is based on a value of 1.
Now we can set the stroke-dasharray to 1, and animate the offset in CSS!

E.g
@keyframes dash {
  from {
    stroke-dashoffset: 1;
  }
  to {
    stroke-dashoffset: 0;
  }
}

You can use significantly reduce repetition in your CSS.


text:
Q: How can I determine which UIControlEvents type caused a UIEvent? What I want to do is set up a bunch of UIControl objects to send all events through the same handler. That handler than needs to determine what the appropriate action is based on the UIControlEvents type that triggered.
- (void)handleEventFromControl:(id)sender withEvent:(UIEvent *)event {
    UIControl *control = sender;
    NSIndexPath *indexPath = [controlIndexPaths objectForKey:control];
    UIControlEvents controlEventType = event.type; //PROBLEM HERE

    BOOL fire = NO;
    NSNumber *eventCheck = [registeredEventsByToolkitIndex objectAtIndex:indexPath.toolkit];
    fire = ([eventCheck integerValue] & controlEventType);

    if(!fire) {
        eventCheck = [registeredEventsByControlIndex objectAtIndex:indexPath.control];
        fire = ([eventCheck integerValue] & controlEventType);
    }

    if(!fire) {
        eventCheck = [registeredEventsByIndexPath objectForKey:indexPath];
        fire = ([eventCheck integerValue] & controlEventType);
    }

    if(fire) {
        [self.delegate toolkit:self indexPath:indexPath firedEvent:event];
    }
}

As best as I can tell, event.type doesn't work this way. I want to avoid having a subclass of UIControl because that is severe overkill for what I want to do. The rest of the moving parts here aren't really that important; what I want is a way to check against UIControlEvents after the target:action: pair is used in the following setup:
- (void)addTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents

If there is a different way to setup of a target:action: that sends back the UIControlEvents, I'd take that. But I am not seeing it in the documentation. Or, at the very least, get access outside of the UIControl object such that I can get the type I want.

A: You're correct; UIEvent.type does not work that way.  Internally, UIControl subclasses are basically using the sendActionsForControlEvents: method, which means they can choose to put anything they want as the parameter.
As for how to know, the simple answer is to have a separate method for each control event.


text:
Q: Upgrading large solution to .NET 6 There is some good documentation here how to manually upgrade to .NET 6: https://learn.microsoft.com/en-us/aspnet/core/migration/50-to-60
But I have a large solution with many projects that references many of NuGet-packages that need to be upgraded. Is there any automatic way to do upgrade the project files?

A: I used to do it with the "replace-in-files option" and NuGet-Manager in Visual Studio. Worked out for me in a 181 projects solution.

*

*Open any *.csproj-file

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>
</Project>

*Press Shift+Ctrl+H

*Open NuGet-Manager for Solution (not project itself). Select all packages and update them all (if possible, else leave out the once you know are not compatible)

A: You can set properties for all projects in the solution using a Directory.Build.props file, see: https://learn.microsoft.com/en-us/visualstudio/msbuild/customize-your-build?view=vs-2022#directorybuildprops-and-directorybuildtargets
In your case you'd use something like this:
<Project>
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
  </PropertyGroup>
</Project>

Place the file in the root of your solution, above all project folders.

A: You could try this PowerShell script that that upgrade all csproj-files from .NET 5 to .NET 6, including NuGet-packages:
https://gist.github.com/pekspro/24fca2eb1cad8c30333a910b163a3f6a
On the same location there is a script that downgrades to .NET 5. But do not trust this, make sure you have a backup if something goes wrong.


text:
Q: solve an inequality with Log terms I get the following inequality to solve (after some manipulations/transformations). Special I want to write $x$ or $y$ in terms of other parameters. I even tried to convert this into form which we can solve using the Lambert W function, but I could not do it. It seems difficult for me at this stage.
If someone has smart tips, please share with me.
$$y\ln\left[1+an\left(\frac{1-x}{n-x}\right)\right]>\ln\left[1+abxy\right]$$
where $x\in[0,1];~~y\in[0,\infty);~ a,b>0;~ n>1$.


text:
Q: How can I copy and deep copy a muldtidimesional array with [][][] structure I have a multidimensional array => mda [][][]. What I want to do is copy
mda [0][all][all] to mda [ 1 ][][] and then make some operations on  the newly created mda[ 1 ][][] section.
I checked stack overflaw and all other tutorials on the internet and came across tutorials with [][] structure not the [][][] structure. I'll accept links as answers as long as they specifically solve the problem and I am not seeking long iterations and that kind of solution. Probably a clone() or copy() type of function solution is what I am seeking.
Thank you in advance

A: The only way to deep copy (which is what you want) a multi dimensional array in Java is to iterate.
So in your case you'll end up with something like this:
public static void main(String[] args) {
    // First we create the mda:
    String[][][] mda = new String[2][][];

    // Now we fill the mda[0][0][0] with 8
    mda[0] = new String[][] { {"8"} };

    // We make a deepCopy of mda[0] and put it in mda[1]:
    mda[1] = deepCopy(mda[0]);

    // Now we change the value of mda[1][0][0]:
    mda[1][0][0] = "42";

    // And here we show it is truly a copy, mda[0][0][0] isn't changed:
    System.out.println(mda[0][0][0]);
    System.out.println(mda[1][0][0]);
}

private static String[][] deepCopy(String[][] input) {
    String[][] output = new String[input.length][];
    for(int index = 0; index < input.length; index++) {
        output[index] = input[index].clone();
    }
    return output;
}

The output will be a true copy:
8
42


text:
Q: What Apple ID should I use for my work computer? I have a Mac for my work computer (that is company property).  Should I use my personal Apple ID, create an Apple ID with my work email, or ask for a corporate wide Apple ID (if that's possible).
I've heard that it's possible to mix accounts, but am not sure of the consequence of doing so.  For example, what if I use my account, but wind up leaving the company?
p.s. The problems I've heard about mixing accounts are automatic updates for only one account and possible iCloud problems.

A: There are arguments and reasons to go either way.
First the facts we know (excluding jailbreak and cracking app store DRM):

*

*You can never change the Apple ID for each purchase once made. However, with MDM solutions evolving and VPP, there is the ability to purchase apps in bulk and then revoke the "purchase" by a subsequent AppleID and return a purchase to the pool for re-issue to another AppleID on later iOS versions. Perhaps that will come to the Mac at some future point.

*Apple has a Volume Purchase Program to make the App Store work better for business use.

*The consumer level Gift Program also exists to let one party pay and another redeem.

*You can change the payment option on your account with great ease.

*There is a 5 account limit on most devices.

*Updating apps is a chore each time you have to:

*

*get updates for account A

*go to store preferences

*enter account B and the password

*go back to the app store for updates

*update again - entering password B a second time

*go to store preferences

*enter account A and the password

*iTunes only backs up apps for which that computer is authorized. (this can be a benefit or a hassle)
Now for some assumptions and commentary. Starting from the simplest scenario, you will either have to use a work credit card or work gift card on your personal Apple ID (juggling the payment options and providing these receipts to account for these purchases just like you would a cup of coffee, a hotel room and other petty expenses that the business just writes off.)
Having a "work" id means in theory - the work could ask you for the password (or force a reset of the password since they would likely maintain control of the email or request/force you to put their email as the contact when you leave the company). They could then issue that Apple ID to another person that would  then have use of the apps you once purchased. In practice - how would you feel getting a "recycled" Apple ID as the new employee or the boss welcoming a new team member. Even $1000 a year in app purchases pales in comparison to the training costs to a business for losing an employee. Company "ownership" of these app purchases is not a big deal in practice.
If you ask your employees to switch in the business account - what happens when someone fails to do that - you'll end up with an expense report anyhow or you'll have a grumpy employee. Banning personal Apple ID is a potential solution as well. That also is demeaning to someone that's going to be taking their work on the go with them - especially if work didn't buy the hardware.
There are times when I really want my work persona to be totally different than my personal. Having that work Apple ID separate from my home ID doesn't seem to work at all to have that separation. I would not be able to remember to switch my account - I would go to purchase - see the password and enter it. About half way through the download I would realize my mistake. I can see this working for some, but think through this if you embark on a two ID strategy.
I would draft an addendum to your normal expense reporting policy to call for quarterly reports (if you don't report these expenses as they happen), urge you to use existing work credit cards to buy gift cards or have one work account gift apps to users that don't need many or are getting started. Once your company hits thousands of dollars of apps - you can look into the Volume Purchase Program which still lets the business send redemption codes to individual Apple ID. Make it a point to educate everyone - an executive summary (this is what we're doing/ how it will be controlled) as well as a detailed guide - who does what and when.
Once you think it through - the idea of work asking for a work Apple ID might make as little sense to you as it does to me. I would however, be sensitive to the finance department - the have long held practices on how to purchase software. Sitting down with them and showing them my purchase history and educating them how this all works. Handing them my phone and letting them buy an app - seeing it download and start using it is an eye opener.

A: Work (current, previous, or the next) is not legally entitled to know whether I have a personal Apple ID or not, nor what I use it for (music, apps, job search or whistle-blowing emails, etc.) on my own Mac at home.

A: This is a really tough issue to tackle.  Depending on the size of the organization and the type of roll out, I might just issue each employee a gift card and let them purchase the apps they need and then let them keep them after they leave.  I'd just chalk up the gift card cost to the cost of hiring someone.


text:
Q: Add a computed column in SQLAlchemy ORM Suppose I have the following table declaration in SQLAlchemy:
class RowEntry(Base):
    __tablename__ = 'entries'

    id: int = Column(Integer, primary_key=True)
    name: str = Column(String, index=True)

I wish to have a computed column (say, string_id) that's calculated automatically from id (by casting it to string), but ACTUALLY exists in the DB (for example, to index over):
For example:
class RowEntry(Base):
    __tablename__ = 'entries'

    id: int = Column(Integer, primary_key=True)
    name: str = Column(String, index=True)

RowEntry.string_id = CalcualatedColumn(func.cast(RowEntry.__table__.c.id, sqlalchemy.String), index=True)

Any suggestions?


text:
Q: C++ оптимизация функции перебора массива Подскажите пожалуйста, можно ли оптимизировать мою функцию перебора массива ?
vector<string> brute(vector<string> alphabet, unsigned int max)
{
    vector<int> temp{ -1 };
    vector<string> result;

    for (size_t i = 0; i < max; i++)
    {
        bool over = true;

        for (size_t n = 0; n < temp.size(); n++)
        {
            if (abs(temp[n]) < alphabet.size() - 1) {
                over = false;
            }
        }

        if (over == true)
        {
            for (int n = 0; n < temp.size(); n++)
            {
                temp[n] = 0;
            }
            temp.resize(temp.size() + 1);
            string str;
            for (int n = 0; n < temp.size(); n++)
            {
                str = str + alphabet[temp[n]];
            }
            result.push_back(str);
        }
        else
        {
            temp[0] = temp[0] + 1;
            for (int n = 0; n < temp.size() - 1; n++)
            {
                if (temp[n] > alphabet.size() - 1)
                {
                    temp[n] = 0;
                    temp[n + 1] = temp[n + 1] + 1;
                }
            }

            string str;
            for (int n = 0; n < temp.size(); n++)
            {
                str = str + alphabet[temp[n]];
            }
            result.push_back(str);
        }

    }
    return result;

}

A: Ну, я бы поступил так:
vector<string> brute(const vector<string>& al, int max)
{
    vector<string> res = al;
    for(int pos = 0; res.size() < max; ++pos)
    {
        for(int sym = 0; sym < al.size() && res.size() < max; ++sym)
            res.push_back(res[pos] + al[sym]);
    }
    return res;
}

Правда, не понимаю логики перебора с подстроками (почему алфавит - набор строк, а не символов), ну да хозяин-барин, вдруг он точно знает, что пароль состоит только из подстрок "khren" и "podberesh" в каком-то порядке...

A: Правильный ответ на Ваш вопрос: конечно можно. Для начала нужно избавиться от выделения динамической памяти. Она выделяется там, где вы добавляете что-то к строке или к вектору или делаете resize. Память нужно выделить сразу где-то в глобальной области. Затем нужно избавиться от операторов типа + и им подобных, кроме дикой траты ресурсов в угоду удобству от них мало пользы. Короче, напишите всё как будто на чистом Си, тогда будет значительно быстрее. Если бы я понимал суть алгоритма, то, скорее всего, сообщил бы, что он написан не оптимально, но я не знаю, что Вы хотите, а читать код без пояснений как-то не хочется.


text:
Q: Are C# delegates thread-safe? If you have a class instance with a delegate member variable and multiple threads invoke that delegate (assume it points to a long-running method), is there any contention issues?
Do you need to lock around the delegate or is it safe for each thread to call the method the delegate points to, since each thread gets it's own call stack?

A: No they are not thread-safe and yes you'll have to manage concurrency yourself.

A: Directly from the documentation of MulticastDelegate:

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

The Delegate class contains the same information, so there you have it.

A: Regarding the invocation of the delegate the answer is yes.
Invoking a delegate is thread-safe because delegates are immutable. However, you must make sure that a delegate exists first. This check may require some synchronization mechanisms depending on the level of safety desired.
For example, the following could throw a NullReferenceException if SomeDelegate were set to null by another thread between the null check and the invocation.
if (SomeDelegate != null)
{
  SomeDelegate();
}

The following is a little more safe. Here we are exploiting the fact that delegates are immutable. Even if another thread modifies SomeDelegate the code is harded to prevent that pesky NullReferenceException.
Action local = SomeDelegate;
if (local != null)
{
  local();
}

However, this might result in the delegate never being executed if SomeDelegate was assigned a non-null value in another thread. This has to do with a subtle memory barrier problem. The following is the safest method.
Action local = Interlocked.CompareExchange(ref SomeDelegate, null, null);
if (local != null)
{
  local();
}

Regarding the execution of the method referenced by the delegate the answer is no.
You will have to provide your own thread-safety guarentees via the use of synchronization mechanisms. This is because the CLR does not automatically provide thread-safety guarentees for the execution of delegates. It might be the case that the method does not require any further synchronization to make it safe especially if it never access shared state. However, if the method reads or writes from a shared variable then you will have to consider how to guard against concurrent access from multiple threads.

A: Modifying an event is not thread-safe, but invoking a delegate is.
Since a delegate is immutable, it is thread-safe.  See remarks here MSDN Delegate class:
Borrowed from here:
In CLR Via C# Richter points out a few subtle points about event invocation in multi-threaded classes:
A delegate chain is immutable; a new chain is created to replace the first.
A delegate chain with zero subscribers is null.
That means (if your event is public) it may transition from null to non-null and vice versa, at any time.


text:
Q: HTTPS/ SSL RSS integration with Feedburner 404 Error Since I have upgraded my website to https (ssl) due to recent change of GOOGLE Search Updates. But it was not easy for me. The google too is not using HTTPS in Feedburner Syndication service.
I have used Yahoo Pipes to deliever my HTTPS contents and then I used Yahoo Output Pipe as the Feedburner RSS Link and it is working fine.
But I need some other way Like (.htaccess) mod-rewrite or other way to directly communicate with feedburner.

A: I am also looking for the same. Found two solutions
One is by using subdomain with php command file_get_contents(); must be enabled on your host.
Complete tutorial
https://www.webhostinghero.com/https-source-urls-google-feedburner/
And another with .htaccess
https://pabst-socialmedia.com/fixing-feedburner-rss-feed-problem-https-wordpress-websites/
Hopefully these will solve your problem.


text:
Q: Basic dynamic memory allocation and delete triggers an asssertion failed I am doing some reviewing of the basics of C++, and I have some troubles understanding why my code is triggering an assertion failed.
void fonctionPointeur(int a)
{
    int* p = new int;
    p = &a;
    std::cout << p << "----" << *p << std::endl;
    delete p;
}

int main()
{
    std::cout << "Hello World!" << std::endl;
    int a = 6;
    fonctionPointeur(a);
}

The assertion failed that I'm triggering is always different, which leads me to think that the delete of p is accessing some unknown memory slot.
When I remove the delete p; or the p = &a; then everything work just fine.
It seems to me that I'm not supposed to delete p and that it will be delete at the end of the scope, but it's dynamic allocation it's not supposed to be the case...
What am I missing here ?

A: In this expression
int* p = new int;

you are assigning to p a memory block allocated by new.
In this expression
p = &a;

you are assigning to p the address of mere temporary, a copy of the original variable a (as you pass it by copy in fonctionPointeur), that temporary cannot be deleted.
This is to be specific, even if you passed it by reference (void fonctionPointeur(int &a)) the problem remains, you also can't delete it as wasn't dynamically allocated.
Moreover, because p is now pointing to a, you lost access to the memory previously allocated, you cannot delete it anymore, this is a memory leak.

A:
It seems to me that I'm not supposed to delete p

This is either correct or not correct depending on which value you are referring to:

int* p = new int;

This is the first value that you give for p. You must delete the result of new int or else the memory leaks.

p = &a;

Here, you assign a new value for p, overwriting the old value. You must not delete the result of &a because it is a pointer to an object with automatic storage. If you do delete this, then behaviour of the program is undefined.
You must have deleted p before overwriting the value because the previous value will be lost. Otherwise since this is the only copy of the pointer, this overwriting of the value guarantees a memory leak.

and that it will be delete at the end of the scope,

a which p points to will be destroyed automatically and its automatic storage will be deallocated.
The dynamic object which p used to point to will not be destroyed automatically and its dynamic storage will not be deallocated.

P.S. It his hardly ever useful to dynamically allocate an int. I recommend avoiding unnecessary dynamic allocation.
P.P.S I recommend avoiding owning bare pointers.


text:
Q: C#, WPF - VisualBrush and OpacityMask I'm needing to create a UserControl, that has a portion of the control's background transparent.  The transparent portion is cutout in the shape of a Border with CornerRadius of 2--it's required because of the design.
Here is my code that is not working:
    <UserControl Margin="1" x:Name="Box">
        <UserControl.Resources>
            <Style TargetType="UserControl">
                <Setter Property="Height" Value="16" />
            </Style>
        </UserControl.Resources>
        <Grid>
            <Border CornerRadius="2" BorderThickness="0">
                <Border.Background>
                    <SolidColorBrush Color="Black" Opacity=".3" />
                </Border.Background>
                <Border.OpacityMask>
                    <VisualBrush>
                        <VisualBrush.Visual>
                            <Grid
                                Background="Black"
                                Width="{Binding ElementName=Box, Path=ActualWidth}"
                                Height="{Binding ElementName=Box, Path=ActualHeight}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="50" />
                                    <ColumnDefinition />
                                </Grid.ColumnDefinitions>
                                <Border Grid.Column="1" Margin="1" CornerRadius="2" Background="Transparent" BorderThickness="0" />
                            </Grid>
                        </VisualBrush.Visual>
                    </VisualBrush>
                </Border.OpacityMask>
            </Border>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="50" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>

                <TextBlock
                    VerticalAlignment="Center" TextAlignment="Right" FontSize="10" Margin="2"
                    Foreground="White" Text="Property" />

                <TextBlock
                    Grid.Column="1" VerticalAlignment="Center" TextAlignment="Center" FontSize="10" Margin="2"
                    Text="Value" />
            </Grid>
        </Grid>
    </UserControl>

I made a few changes, so you guys should be able to drop this straight into XamlPad.
For some reason my VisualBrush that is set to the Border's OpacityMask is not working at all.  The OpacityMask is just displaying everything fully visible.  For a test, I dropped a quick LinearGradientBrush in and it worked as expected.
Is there some issue using VisualBrush and OpacityMask together?  What is going wrong here?
Here is a screenshot of what I'm trying to achieve:
ScreenShot http://monitor.utopiaselfscan.com/Screen.png
The UserControl are the headers saying Entity No, Progress, Hours, etc.  They are black with  30% transparency and have a rounded rectangle opacity mask cutout.  I normally use images to render stuff like this, b/c our graphic artist can get crazy with glass-looking effects.

A: Who is the Box in your code? Could you also add an image of what you want to achieve?
Have you tried Paths to get what you want? E.g. the following path:
<Path Stroke="Black" Stretch="Fill" StrokeThickness="1" Fill="#CCCCFF">
    <Path.Data>
     <GeometryGroup FillRule="EvenOdd" >
      <EllipseGeometry Center="40,70" RadiusX="30" RadiusY="30" />
      <RectangleGeometry Rect="30,55 100 30" />
    </GeometryGroup>
  </Path.Data>
</Path>

Gives you this cutout:
alt text http://img704.imageshack.us/img704/928/cutw.jpg
EDIT: Here is one way to achieve your design:
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
   <Page.Resources>
      <SolidColorBrush x:Key="FillBrush" Color="Gray" Opacity="0.3"/>
   </Page.Resources>
   <Grid>
   <!-- Set background image here, instead of border-->
      <Border>
         <Border.Background>
            <LinearGradientBrush>
               <GradientStop Color="#FFcacaca"/>
               <GradientStop Offset="1" Color="#FF353535"/>
            </LinearGradientBrush>
         </Border.Background>
      </Border>
   <!-- Content goes here -->
      <Grid>
         <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
         </Grid.ColumnDefinitions>
         <Border
            MinHeight="24"
            MinWidth="100"
            HorizontalAlignment="Left"
            VerticalAlignment="Top"
            Background="{StaticResource FillBrush}"
            CornerRadius="15, 0, 0, 15"
            Padding="0, 0, 5, 0">
            <TextBlock
               HorizontalAlignment="Right"
               VerticalAlignment="Center"
               Foreground="White"
               Text="From"/>
         </Border>
         <Border
            MinHeight="24"
            MinWidth="100"
            Grid.Column="1"
            HorizontalAlignment="Left"
            VerticalAlignment="Top"
            BorderBrush="{StaticResource FillBrush}"
            BorderThickness="1"
            CornerRadius="0, 15, 15, 0">
            <TextBox
               Margin="5, 0, 5, 0"
               VerticalAlignment="Center"
               Background="Transparent"
               BorderThickness="0"
               Foreground="#2f3740"
               Text="Verylongname, Johnathan"/>
         </Border>
      </Grid>
   </Grid>
</Page>

The main point is to use the two borders and one brush. For header fields you paint border's background and for content fields you paint border's border :).
Cheers, Anvaka.

A: I am using a created Path to create this opacity mask.
You can find the object I use as a mask from this post:
Odd-Shape Geometry


text:
Q: XBee Send To All I have a simple xbee network operating where there are a bunch of slaves operating remotely and all talking to one master, who is connected to the server computer. That works no problem.
The slaves all send their ID as part of the packet and I'd like to have the master deliberately send an Ack after a delay. I'm trying to figure out how to do this efficiently and it seems that the only plausible way that doesn't involve reprogramming the master before each Ack is to send the Ack to all slaves and have them ignore the packet if it's not meant for them.
That solution is ok - I just can't figure out the command to use to do this. Is there some sort of Serial sendAll command? All of the devices are on the same ATID.

A: Typically in this situation, you would configure the master in API mode so you would get "Receive Explicit" frames with source addressing information, and could send with the "Transmit Explicit" frame type, and include addressing information in your frames.
If you use AT mode (transparent serial mode), then you're stuck having to change the DH and DL parameters on your coordinator every time you want to change who you send to.  You should avoid using broadcast packets, since each one results in lots of network traffic (IIRC, each router will send the broadcast packet three times).
I do not know of a good XBee library on the Arduino, but it might be possible to port Digi's Open Source ANSI C XBee Host Library to that platform.


text:
Q: После обновления WP до вер 4.9.6 выпадает ошибка После обновления wordpress до вер. 4.9.6. на месте, где находится the_content(); появляется ошибка: Error: The attempt to query the database when not connected и загрузка останавливается. Перерыл инет, но адекватного решения не нашёл. Может кто сталкивался?

A: Какая-то ошибка соединения с БД. Вначале проверьте что есть вход в админ-панель и там можно отредактировать запись, поменять настройки и т.п. Если это не работает, то проверяйте параметры доступа к базе. Так же возможна ситуация, что база повреждена. Для этого войдите в phpMyAdmin с этимим же параметрами входа и там сделайте «оптимизацию» (есть такой пункт) со всеми таблицами.
Если там все ок, то дальше последовательность такая: переключитесь на дефолтный шаблон и отключите все плагины. Возможно проблема в каком-то из них: последовательно включаете и смотрите результат.
Если проблема как-то связана с обновлением wp, то придется откатиться к предыдущему бэкапу и выполнить обновление заново, предварительно переключив шаблон на дефолтный и отключив все плагины (у них может быть конфликт с обновлением или новой версией).


text:
Q: Logging credentials passed to a WCF Web Service I have a web service client configured with transport security and Basic clientCredentialType.
The service is using a HTTPS endpoint and I have a difficult to diagnose error. I was trying to add a log to the application that stores the request and response messages, as well as the Credentials passed (at least the username).
For the messages I added a custom Behavior with a MessageInspector.
How can I log the credentials also? Is there any extension point in WCF to do this? Any other suggestion?
Thanks
Edit: The error I am getting is this:
[NotSupportedException: This method is not supported by this class.]
System.Net.BasicClient.Lookup(HttpWebRequest httpWebRequest, ICredentials credentials) +2544984
System.Net.AuthenticationManager.Authenticate(String challenge, WebRequest request, ICredentials credentials) +304
System.Net.AuthenticationState.AttemptAuthenticate(HttpWebRequest httpWebRequest, ICredentials authInfo) +7949046
System.Net.HttpWebRequest.CheckResubmitForAuth() +269
System.Net.HttpWebRequest.CheckResubmit(Exception& e) +126
System.Net.HttpWebRequest.DoSubmitRequestProcessing(Exception& exception) +185
System.Net.HttpWebRequest.ProcessResponse() +75
System.Net.HttpWebRequest.SetResponse(CoreResponseData coreResponseData) +562

[WebException: The request was aborted: The request was canceled.]
System.Net.HttpWebRequest.GetResponse() +7865220
System.ServiceModel.Channels.HttpChannelRequest.WaitForReply(TimeSpan timeout) +99

[CommunicationException: An error (The request was aborted: The request was canceled.) occurred while transmitting data over the HTTP channel.]
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +4729827
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +1725
...Application code from here on...

It is a web application that is working correctly in DEV but throws this error in QA. The code is the same and the user is valid in both environments.
The binding configuration is:
<binding name="CommonBinding" maxReceivedMessageSize="10000000" useDefaultWebProxy="true" openTimeout="00:10:00" sendTimeout="00:10:00">
      <security mode="Transport">
        <transport clientCredentialType="Basic" proxyCredentialType="Basic"
          realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
</binding>

A: check this out:
http://msdn.microsoft.com/en-us/magazine/cc948343.aspx
I believe you could do this in an IAuthorizationPolicy


text:
Q: is there a way to update an entity using nodejs library of dialogflow es? I have been trying to update a entity in Dialogflow es using the nodejs SDK, but I haven't been able to do it, the API reference does not give enough information so I need help with.
the name of the entity I want add a new value its @Productos
So far this has been de the code I have been trying to implement.
 updateEntity:async (req, res) => {
    try{
      const projectAgentPath = entityClient.projectAgentPath(clientId)   /// (clientId);
      console.log('whats projectAgentPaht',projectAgentPath);
      const request = {
        parent: projectAgentPath,

      }

      const response  = await entityClient.updateEntityType({

        entityType: {
          name: '@Productos',
          displayName: "Productos",
          entities: [
            {value: 'Nuevo producto'}
          ]

        },

      });
     // const response = entityClient.getEntityType(request)
      /*const [response] = await intentsClient.listIntents(request);*/
      console.log('whats response ', response);
      return res.json(response).status(200)

    }catch(e){
      console.log('e ', e)
     return res.json({message: 'ocurrio un problema al procesar la solictud'}).status(500);
    }

the code above gives the following error
 projectAgentPaht projects/prod-proinvestec/agent
e  Error: 3 INVALID_ARGUMENT: Resource name '@Productos' does not match 'projects/*/locations/*/agent/entityTypes/*'.
    at Object.callErrorFromStatus (D:\Projects\iqbit\chatbot-server\node_modules\@grpc\grpc-js\build\src\call.js:31:26)
    at Object.onReceiveStatus (D:\Projects\iqbit\chatbot-server\node_modules\@grpc\grpc-js\build\src\client.js:189:52)
    at Object.onReceiveStatus (D:\Projects\iqbit\chatbot-server\node_modules\@grpc\grpc-js\build\src\client-interceptors.js:365:141)
    at Object.onReceiveStatus (D:\Projects\iqbit\chatbot-server\node_modules\@grpc\grpc-js\build\src\client-interceptors.js:328:181)
    at D:\Projects\iqbit\chatbot-server\node_modules\@grpc\grpc-js\build\src\call-stream.js:187:78
    at processTicksAndRejections (node:internal/process/task_queues:78:11) {
  code: 3,
  details: "Resource name '@Productos' does not match 'projects/*/locations/*/agent/entityTypes/*'.",
  metadata: Metadata {
    internalRepr: Map(1) { 'grpc-server-stats-bin' => [Array] },
    options: {}
  },
  note: 'Exception occurred in retry method that was not classified as transient'

I want to add new values to the products entity.
I hope someone could help me.
Thanks!

A: You first need to get the resource name of your specific entityType that you want to update. You may use below cURL command for getting the resource name.
curl -X GET \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
"https://dialogflow.googleapis.com/v2/projects/<your-project-id>/agent/entityTypes"

Below is a sample screenshot where to find the resource name on the result of the cURL command.

You may now use the updated code below (derived from your posted code) in which we use the resource name on the "name" parameter and we added the "kind" parameter since this is required when using the updateEntityType() function.
const dialogflow = require('@google-cloud/dialogflow');

const entityClient = new dialogflow.EntityTypesClient();

async function main() {

    const projectAgentPath = entityClient.projectAgentPath('your-project-id')
      console.log('whats projectAgentPath',projectAgentPath);
      const request = {
        parent: projectAgentPath,

        }

      const response  = await entityClient.updateEntityType({

        entityType: {
          name: "projects/<your-project-id>/agent/entityTypes/<entity-type-id>",
          displayName: "Productos",
          kind: 'KIND_MAP',
          entities: [
            {value: 'Nuevo producto'}
          ]

        },

      });
     // const response = entityClient.getEntityType(request)
      /*const [response] = await intentsClient.listIntents(request);*/
      console.log('whats response ', response);
  }

  process.on('unhandledRejection', err => {
    console.error(err.message);
    process.exitCode = 1;
  });
  main(...process.argv.slice(2));

A: I just used regex to detect the name of the products instead of adding values to the products entity.
lol


text:
Q: Arduino "Port" option grayed out My Arduino Kerfuffel
I just got an Arduino Nano, and I decided to first start off with a blinking LED. I did the wiring, I wrote the code, and I was ready to upload it. Verifying it was fine, but when I hit upload, it blurt out an error that read:
Serial port not selected.

So I looked it up, and turns out I have to go to Tools and select the port connected in Port. So I saw, but Port was grayed out. I looked everywhere in forums, but none of it helped.
One of the problems listed was that my Arduino was burnt out, but it still detected it as a device on Windows.
So what's happening?
More info:

*

*Am I using a clone? Yes, I'm using a Keyestudio Nano.

*What operating system are you using? I am using Windows 10

A: I used to run into this problem myself.
Your board is not being detected because it is a clone. However, I looked up your clone and it uses the ch340 USB-to-serial port chip.
To solve this, you simply need to install a driver so that your computer can communicate with your board. Just follow the instructions from the following link, and your board should appear! https://learn.sparkfun.com/tutorials/how-to-install-ch340-drivers/all#windows-710
Best of luck and let me know if you encounter any more problems!
PS: The link also has a video tutorial if you want to avoid reading.


text:
Q: Grouping models by field in Django Consider a simple Django model:
class MyModel(models.Model):
    a = models.CharField()
    b = models.CharField()

And a query that fetches them in a view:
objs = MyModel.objects.all()

Now here's the tricky part, the template should render objects that have the same a field together. So if I have three objects:
{a:'1', b:'5'}, {a:'1', b:'8'}, {a:'2', b:'4'}
they should render like this in the output:

*

*a=1

*

*b=5

*b=8

*a=2, b=4

Basically, I need to group objects by their a field and render those groups differently than objects that have unique a fields.
How should I go about grouping these objects and displaying them differently?

A: Order them by the a field, then do the grouping in the template with the regroup tag.
Code example:
{% regroup objs by a as objs_list %}

  {% for a in objs_list %}
    {% if a.list|length == 1 %}

{{ a.grouper }}, {{ a.list.0.b }}

    {% else %}

{{ a.grouper }}

      {% for obj in a.list %}

{{ obj.b }}

      {% endfor %}

     {% endif %}

   {% endfor %}


text:
Q: Chart and plotting API for GWT I am trying to find a chart and plotting api that can be used in GWT using java, not javascript.  The only problem I am having is the ones I have found require an internet connection which where this code will go cannot have an internet connection.  Does any one know of such an API?  Here are that ones that I found, but again can't use.
 https://code.google.com/p/charts4j I know this one requires a connection.
http://code.google.com/p/gwt-google-apis/wiki/VisualizationGettingStarted
Not 100% sure on this one.  If anyone has used it and can let me know if it requires a connection let me know. Also if anyone know how to get java swing to work in GWT that would be awesome.
Thank you

A: I just finished a little presentation on that topic. In there, I'm taking a short and somewhat subjective look at:

*

*clientsidegchart

*gflot

*dojox.charting

*Ico (and other Raphael based libs)

*GXT charts

*Smart GWT HTML5 Charts

*FusionCharts

*amCharts JavaScript Charts

*Google Chart Tools API

*JFreeChart (and other server side libs)

Only the last two of them require an active internet connection.
Here's the link to a PDF snapshot of the presentation: https://docs.google.com/open?id=0B0oR9hvG2VjoRDZZR20zYjVLalU

A: Client-side GChart. All in your app - no loading visualizations from external servers.

A: This is another open source api for charts in GWT hosted on http://code.google.com/p/gwt-rcharts/ you may find it useful. The API works on SVG/VML specification. You may find it quite easy to implement and use. You may find the demo at http://gwt-rcharts.appspot.com/


text:
Q: How to request admin rights in Qt? I tried to create a key in windows registry, but I got this error:

5 Access is denied.

The code snippet is like this:
HKEY hKey;
LPCTSTR sk = TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\notepad.exe"); //notepad.exe is the key I want to create
    //note: if I change the first parameter to KEY_CURRENT_USER, the key will be created
LONG createResKey = RegCreateKeyEx(HKEY_LOCAL_MACHINE, sk, 0, NULL, REG_OPTION_BACKUP_RESTORE, KEY_ALL_ACCESS, NULL, &hKey, NULL);

if (createResKey == ERROR_SUCCESS) {
    qDebug() << "Success creating key.";
}
else {
    qDebug() << "Error creating key.";

    showErrorText(createResKey);
}

Maybe it is because my program doesn't have the admin privilege, I tried my best to do research online and tried to get the admin privilege, but failed. I am quite confused about how to solve this problem right now.
Edit: What do I want to achieve?
I am trying to block some specific apps from starting by modifying the registry. For example, if I want to block notepad, first I have to create a "notepad.exe" key, and then set a string value "debugger" to it and set its value to "debugfile.exe". So the notepad will be block from starting.

A: GUI toolkits are so complex that it is usually advised to avoid taking administrative privileges to run them, and many GUI toolkits have (for good reasons) code to detect and disable (or warn against) that. On Linux, that means that you should not run GTK or Qt code as root (and if you do, some warning is emitted, or maybe the toolkit aborts; for Qt, see this; for GTK, see that).
In practice, you should try to have some small program (probably on the command line, or as a daemon) with administrative privilege and have your Qt program start it (e.g. with QProcess) and/or communicate with it (using some kind of inter-process communication), taking advantage of the process isolation and multi-user ability provided by your operating system.
I guess that some general understanding of OSes should help. Then I recommend reading Operating Systems: Three Easy Pieces to get more insight about OSes in general.
Details -i.e. how to start some program with more privileges than your Qt program- are operating system specific (on Linux, read about setuid). Inter-process communication facilities are also OS specific (on Linux, see pipe(7), fifo(7), shm_overview(7), unix(7), sem_overview(7) etc... and read some Linux programming book, perhaps the old ALP or something newer). How to get more privileges or do inter-process communication on Windows is a very different question (unrelated to Qt).
So you need to dive into the WinAPI documentation (perhaps here) to find out how to start a daemon or a small program with administrative privilege and how to perform inter-process communication with it. I guess that Windows has such facilities, but they are not wrapped in Qt (and neither is the access to the registery) and you need to write Windows specific code and learn more about WinAPI. I cannot help you, since I don't know and never used Windows.

A: KEY_ALL_ACCESS is a rather heavyweight permission. And even an escalated process may not have that kind of access to a system registry key in HKLM. In any case don't use the REG_OPTION_BACKUP_RESTORE and KEY_ALL_ACCESS flags.  Instead just ask for KEY_WRITE.
LONG createResKey = RegCreateKeyEx(HKEY_LOCAL_MACHINE,
                                    sk,
                                    0,
                                    NULL,
                                    0,
                                    KEY_WRITE,
                                    NULL,
                                    &hKey,
                                    NULL);

Then right-click on your EXE and select "Run as administrator".

A: To gets the admin privileges at the run time you need to add to you .pro file:
win32 {
    RC_FILE = rcfile.rc
}

Then create rcfile.rc with following:
#include <windows.h>
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "YourProgrammName.exe.manifest"

Then create YourProgrammName.exe.manifest file with following text:
name="YourProgrammName.myapp" type="win32" />
<description> Really Cool App</description>
<dependency />
<!-- Identify the application security requirements. -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
  <security>
   <requestedPrivileges>
    <requestedExecutionLevel
      level="requireAdministrator"
      uiAccess="false"/>
    </requestedPrivileges>
   </security>
</trustInfo>
<!-- padding to four-byte multiple file size including the byte order mark --
<!-- padding 123 -->
 </assembly>


text:
Q: jquery getJson and array I have a problem with jQuery getJSON and displaing the result.
jQuery Code
jQuery(document).ready(function(){
jQuery.getJSON("gsm.php",{getproducts:'495074, 495061, 495060'},function(response){
    jQuery.each(response, function() {
        jQuery('#item1').html(response.item1);
        jQuery('#item2').html(response.item2);
    });

});
});

gsm.php JSON response
[
{
    "item1": "test data 1",
    "item2": "test data 1a"
},
{
    "item1": "test data 2",
    "item2": "test data a"
}
]

I'm sorry but I couldn't solve my problem with other posts.
I would appreciate any help.
Thanks!

A: $(document).ready(function() {

        $.getJSON("gsm.php", { getproducts: '495074, 495061, 495060' }, function(response) {
            $.each(response, function(key, value) {
                $('#item1').html(value.item1);
                $('#item2').html(value.item2);
            });
        });

    });

You have missed this function(key, value) and use value to get data from json.

A: Try this -
jQuery.each(response, function(index,value) {
        jQuery('#item1').html(value.item1);
        jQuery('#item2').html(value.item2);
});

A: Try this
jQuery.each(response, function() {
    jQuery('#item1').html(this.item1);
    jQuery('#item2').html(this.item2);
});


text:
Q: Getting Firebase exception from nowhere My Xamarin.Android app worked fine with Firebase all the time. Now I have the following exception from nowhere, when I try to "order" the device-specific firebase token.
The exception message is:

Default FirebaseApp is not initialized in this process
  de.myapplication.android.  Make sure to call
  FirebaseApp.initializeApp(Context) first.

I never needed this call before, but I did what the exception told me:
protected override void OnCreate(Bundle bundle)
{
    FirebaseApp.InitializeApp(this);

    TabLayoutResource = Resource.Layout.Tabbar;
    ToolbarResource = Resource.Layout.Toolbar;

    var msgListenerIntent = new Intent(this, typeof(MyFirebaseMessagingService));
    StartService(msgListenerIntent);

    base.OnCreate(bundle);

    global::Xamarin.Forms.Forms.Init(this, bundle);
    LoadApplication(new App());
}

Calling the initalizing method does not change the problem. The last few weeks, ordering the token worked totally fine.
Note: Sometimes, Visual Studio wants to change the ResourceDesigner.cs file. It wants to remove the following lines:
// aapt resource value: 0x7f080051
public const int default_web_client_id = 2131230801;

// aapt resource value: 0x7f080052
public const int firebase_database_url = 2131230802;

// aapt resource value: 0x7f08004f
public const int gcm_defaultSenderId = 2131230799;

// aapt resource value: 0x7f080053
public const int google_api_key = 2131230803;

// aapt resource value: 0x7f080050
public const int google_app_id = 2131230800;

// aapt resource value: 0x7f080054
public const int google_crash_reporting_api_key = 2131230804;

// aapt resource value: 0x7f080055
public const int google_storage_bucket = 2131230805;

Could it be a hint for me that visual studio wants to delete those lines?

A: It seems to be a bug from Xamarin.
References:

*

*http://xamarin21.rssing.com/browser.php?indx=23562832&item=46695

*https://bugzilla.xamarin.com/show_bug.cgi?id=56108


text:
Q: Redux state doesn't update for the first time I have learning redux for a few days and I have a issue. My state with people list doesn't udpate when I type first letter in filter input. State change only after typing second letter and the rest. But then filter doesn't work like it should. What do I do wrong?

A: You're filtering the people's list based on the previous state, not the new value.
That is, in your reducer, you need to update .includes(state.filterQuery) to .includes(action.letter).


text:
Q: How to calculate graph edit distance between two multi-graphs using networkx? Say I have two graphs G and H:
    G = nx.MultiDiGraph()
    G.add_node(0, id = 'a', f = 'none')
    G.add_node(1, id = 'b', f = 'k')
    G.add_edge(0, 1, r = 'bicycle')
    G.add_edge(1, 0, r = 'bicycle_r')
    G.add_edge(1, 0, r = 'bicycle_rr')

    H = nx.MultiDiGraph()
    H.add_node(0, id = 'a', f = 'none')
    H.add_node(1, id = 'b', f = 'k')
    H.add_edge(0, 1, r = 'bicycle')
    H.add_edge(1, 0, r = 'bicycle_r')

networkx provides us a very simple api to calculate the edit distance between two graphs of the same type, i.e., nx.graph_edit_distance(G, H, node_match=node_match, edge_match=edge_match). Here for node_match and edge_match, I simply define them as exact match for all labels (i.e., id and f for nodes, and r for edges). This is trivial and not important here since there is no substitution operation between 2 graphs in my example.
The edit distance between G and H is expected to be 1, because G has one more edge between node 1 and 0. However, the answer returned by nx.graph_edit_distance is 0. It seems like it just ignores the multi-edges between two graph nodes. I have tried it with simple directed graph (i.e. nx.DiGraph()), it works well. But I really don't know how to tell the distance calculator to take the deletion of multi-edge into consideration.
I think something is wrong with nx.graph_edit_distance when applying it to multi-graphs. I have tried nx.is_isomorphic on multi-graphs. This function returns whether two graphs are isomorphic (i.e., whether the distance is 0), and takes exactly the same input as nx.graph_edit_distance. They both have node_match and edge_match. As suggested by the documentation, the input for edge_match should be G1[u1][v1], G2[u2][v2], however, when I check the input to edge_match for nx.graph_edit_distance and nx.is_isomorphic, I found that the input edges for edge_match in nx.graph_edit_distance doesn't have the shape of edges in multi-graph, while it does have that shape for edge_match in nx.is_isomorphic. I think this could be a serious bug of networkx.
Edit:
I checked the source code of networkx. Now I am pretty sure it's a bug. The usage of edge_match is not consistent with what is claimed in the documentation.
    elif edge_match:
        C[0:m, 0:n] = np.array([1 - int(edge_match(G1.edges[g], G2.edges[h]))
                                for g in pending_g for h in pending_h]
                               ).reshape(m, n)

Here is my implementation for node_match and edge_match:
def node_match(n1, n2):
    if n1['id'] == n2['id'] and n1['f'] == n2['f']:
        return True
    else:
        return False

def edge_match(e1, e2):
    if e1['r'] == e2['r']:
        return True
    else:
        return False

def multi_edge_match(e1, e2):
    if e1.keys() != e2.keys():
        return False
    for k in e1.keys():
        if e1[k]['r'] != e2[k]['r']:
            return False
    return True

Note that, based on the documentation, for multi-graphs, edge_match should not work, because in multi-graph G[u1][u2] is first indexed by an edge id, so I defined multi_edge_match. However,nx.graph_edit_distance(G, H, node_match, multi_edge_match) will lead to running error. We can only call nx.graph_edit_distance(G, H, node_match, edge_match) and then get unexpected results. While for nx.is_isomorphic, we can only call nx.is_isomorphic(G, H, node_match, multi_edge_match) instead of nx.is_isomorphic(G, H, node_match, edge_match), and this is what I have expected. So I think it's likely that the implementation for nx.graph_edit_distance is not correct for multi-graphs. At least, it is not consistent with the documentation, if not incorrect.


text:
Q: How to move the particular UIImageview to top of the view? I am creating UIImageview on button click .
This is my code :
     _imgfull.userInteractionEnabled=YES;
        _imgfull.clipsToBounds = YES;
        //this all for image positioned
        imgpositioned=[[UIImageView alloc]initWithFrame:CGRectMake(0,0,500,500)];
        imgpositioned.userInteractionEnabled=YES;
        imgpositioned.tag=tag;
        tag++;
        if(tag==1)
        {
            imgpositioned.backgroundColor =[UIColor redColor];
        }
        else
        {
            imgpositioned.backgroundColor =[UIColor greenColor];
        }
//pinch gesture
        UIPinchGestureRecognizer *pinch=[[UIPinchGestureRecognizer alloc]initWithTarget:self action:@selector(Pinchforimage:)];
        pinch.delegate=self;
        [imgpositioned addGestureRecognizer:pinch];

        // create and configure the rotation gesture
        UIRotationGestureRecognizer *rotationGestureRecognizer = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(rotationGestureDetected:)];
        [rotationGestureRecognizer setDelegate:self];
        [imgpositioned addGestureRecognizer:rotationGestureRecognizer];
        // pan gesture
        UIPanGestureRecognizer *panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panGestureDetected:)];
        [panGestureRecognizer setDelegate:self];
        [imgpositioned addGestureRecognizer:panGestureRecognizer];
        //long press gesture
        UILongPressGestureRecognizer *longpress=[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longpress:)];
        [longpress setDelegate:self];
        [imgpositioned addGestureRecognizer:longpress];
         [_imgfull addSubview:imgpositioned];

This is my long press gesture method
[![-(void)longpress:(UILongPressGestureRecognizer *)longg
{

    NSLog(@"gesture recogniser long press obtained ==%d",\[longg.view tag\]);
    UIGestureRecognizerState state =\[longg state\];
    if(state ==UIGestureRecognizerStateBegan ||state ==UIGestureRecognizerStateChanged)
    {
        \[imgpositioned superview\];

    }
}

When user long press the UIImageview i want to move the UIImageview to above ,for eg if user long press the red UIImageview it have to come above the green imageview :)
possible help me friends :

A: Use this code [_imgfull bringSubviewToFront:longg.view]; in your -(void)longpress:(UILongPressGestureRecognizer *)longg method

A: -(void)longpress:(UILongPressGestureRecognizer *)longg
{

    UIGestureRecognizerState state =[longg state];
    if(state ==UIGestureRecognizerStateBegan ||state ==UIGestureRecognizerStateChanged)
    {
        int temptag=[longg.view tag];
        UIImageView *views=(UIImageView *)arrimgstore[temptag];
        NSLog(@"got it to super view %@",views);
        [_imgfull bringSubviewToFront:views];
    }
}

finally i done my job ,
Notes :
I am stored my UIImageview inside NSMutable array ,then using gesture view tag ,get those particular UIImageview to front position :).


text:
Q: C++ execute function without if check each time Lets say I have a bool variable(global or local) & a function which is present. The function should execute only when the bool variable is true. Since this function is repeated many times & I need a way to execute this function without performing if the bool variable is true everytime.
function();
bool executeFun = true;

if(executeFun){
function();
}
..
if(executeFun){
function();
}

.. Need to execute function() without checking bool each time.
Thanks :)

A: Wrap it in another function.
auto perhaps = executeFun ? function : +[](){};
perhaps();
perhaps();
perhaps();

A: You could use a function pointer that you set after having checked the condition:
#include <iostream>

using func_t = void(*)();

int main() {
    func_t p = []{};

    p(); // does nothing

    if(true) p = []{ std::cout << "doing something\n"; };

    p(); // does something
}

A: Can you move the bool check inside the function?
void function();
bool executeFun = true;

void function() {
    if (!executeFun) return;
    ...
}

...

function();
...
function();


text:
Q: Edit map legend properties from pause drawing screen ArcMap Is there a way to edit a legend's properties from the Paused Drawing screen in ArcMap? The reason I ask is so I can update a legend's properties without having it redraw each time.

A: This is easily done by toggling draft mode in the Layout window:

When in draft mode, using Toggle Draft Mode, the contents of the page
  elements are not drawn. Instead, only the bounding box of the frame
  and a label showing its name are drawn. This makes it faster to work
  with the page layout because you don't have to wait for the contents
  of frames, especially data frames, to draw. You can control draft mode
  for individual elements through the Frame tab of the element's
  Properties dialog box.


text:
Q: Ansible facts discovery returns some values as empty I have a very simple script in /etc/ansible/facts.d which is used to discover the local SSL certs on a host. This is the code:
#!/bin/sh

echo "{
  \"testkey\": \"testvalue\",
  \"crt\": \"$(/usr/bin/base64 -w 0 /etc/kubernetes/pki/apiserver.crt)\",
  \"key\": \"$(/usr/bin/base64 -w 0 /etc/kubernetes/pki/apiserver.key)\"
}"

When I run it myself with $> /etc/ansible/facts.d/apiserver_ssl_facts.fact it outputs all the values as expected. But when Ansible runs it only the testkey has a value, while the others are an empty string "":
ansible@bastion-1:~/ansible$ ansible -m setup <host> -a "filter=ansible_local"
<host> | SUCCESS => {
    "ansible_facts": {
        "ansible_local": {
            "apiserver_ssl_facts": {
                "crt": "",
                "key": "",
                "testkey": "testvalue"
            }
        }
    },
    "changed": false
}

Running Ansible in very verbose with -vvvv does not show any errors.

A: Answer from the comments: there is a permission issue, so the ansible user can't access cert files.


text:
Q: Android How to Improve my app dependencies I'm trying to improve my app dependencies and came across a problem. My code base is shared with another app, so I have modules that are shared between these two apps. The below image is a simplified version of what I currently have.

Currently, my app build gradle sets the AppNetwork dependency as implementation and the AppNetwork declares the SharedNetwork dependency as api. It's api because app module needs to know stuff about the SharedNetwork module (more on this next). App module also implements the SharedFuncionalities module.
SharedNetwork contains an INetwork interface. This interface is extended by IAppNetwork interface that it's implemented by AppNetworkImpl (the latter two files are placed in the AppNetwork module).
Here is an example of why this is being set like this.
My app module creates AppNetworkImpl and also creates an ItemRepository (location is inside the SharedFuncionalities module) that takes INetwork (implemented by AppNetworkImpl) as a param in its constructor. This allows the ItemRepository to "talk" with the SharedNetwork module.
If I set AppNetwork to declare the SharedNetwork dependency as implementation thus making my app module unaware of the SharedNetwork (that makes sense to me. I would then use AppNetworkImp as the bridge between the app module and the SharedNetwork module) I then lose the ability to create objects in the SharedFuncionalities that use AppNetworkImpl as the bridge for using the SharedNetwork.
What I would like to know if I have the possibility of the app module only knowing about AppNetwork but still create objects in SharedFuncionalities that can "talk" with the SharedNetwork.


text:
Q: Unity 2D New Input System character not moving I am working on migrating to the new input system and I can't get my character to move. In my update function I have the Move function called and I am passing in the move speed to it. This is a dynamic value that changes based on a few things and I have confirmed that this number is correct. It always logs out the correct number. I am not getting any errors at run time, just the character wont move. Everything seems to be called correctly, just wont move.
Am I missing something obvious that I didn't set up right with the new input system?
private Rigidbody2D rb;
private PlayerInput playerInput;
private PlayerInputActions playerInputActions;

private void Awake()
{
    rb = GetComponent<Rigidbody2D>();
    playerInput = GetComponent<PlayerInput>();

    playerInputActions = new PlayerInputActions();
    playerInputActions.Player.Enable();
}

private void Update()
{
    ...
    Move(moveSpeed);
}

private void Move(float amount)
{
    Vector2 inputVector = playerInputActions.Player.Move.ReadValue<Vector2>();
    Debug.Log("amount: " + amount);
    Debug.Log("inputVector: " + inputVector);
    rb.AddForce(new Vector3(inputVector.x, inputVector.y, 0) * amount, ForceMode2D.Force);
}


text:
Q: Why are sqlite3 shortcut functions called "nonstandard"? I've used sqlite3 in Python in which execute() creates ambiguity. When I use:
import sqlite3
A = sqlite3.connect('a')
A.execute('command to be executed')
help(A.execute)

I got the output of help() as:
.....
.....
Executes a SQL statement. Non-standard.

But when I execute like this:
import sqlite3
A = sqlite.connect('a').cursor()
A.execute('command to be executed')
help(A.execute)

I got the output of help() as:
.....
.....
Executes a SQL statement.

My doubt is what does Non-standard refer to? Even the Python documentation provides these words execute for execute(), executemany(), and executescript() in connection objects.
I've even searched in web about nonstandard shortcuts in Python. But I didn't get any relevant information. Can anyone help me with this?

A: The "nonstandard" function is the execute method of the sqlite3.Connection class:

This is a nonstandard shortcut that creates a cursor object by calling the cursor() method, calls the cursor's execute() method with the parameters given, and returns the cursor.

"Standard" refers to PEP 249 -- Python Database API Specification v2.0 which the sqlite3 module follows. It does not specify an execute method for the Connection class, but the sqlite3 module provides it anyway, that's why it is called "nonstandard".
PEP 249 only specifies the execute method of the Cursor class, which the sqlite3 module implements, of course.


text:
Q: How to write sub queries in laravel 8? SELECT
    posts.id,
    (select count(*) from post_likes where post_id = 13 and user_id = 12) as post_like
FROM
    posts
LIMIT 5

How to write this query in Laravel query builder?

A: If your ORM models are defined (and you have both Post and PostLike models), create a relationship in your Post.php model (if not already), like:
public function likes(){
  return $this->hasMany(PostLike::class);
}

Then if you only need the count, try something like:
$userId = 12;

$postList = Post::query()
    ->whereId(13)
    ->withCount(['likes', 'likes AS post_like' => function ($query) use($userId) {
        $query->where('user_id', '=', $userId);
    }])
    ->limit(5)
    ->get();
// Then do something with result.
foreach ($postList as $post) {
    $count = $post['post_like'];
}

Note that above we use post_like alias, and limit to user_id, just to much OP requirements; Else we could simply set likes_count to the number of relations, like:
->withCount('likes')

But you could use relationship for subquery with the whereHas(...) eloquent method, like:
Post::query()->whereHas('likes', function($query){
  $query->where(...your statements for sub query go there);
}, '>', 4)->limit(5)->get(); //Select where more than 4 relation found with given parameters

For more see: https://laravel.com/docs/8.x/eloquent-relationships#querying-relationship-existence


text:
Q: Low level operations with SD card on Android is it possible to have low level access in Android with Java/NDK to create for example card scanner like scandisk or card defragmenter? I move a lots of stuff around my card and it gets fragmented quickly. I have experience with FAT32 defragmenting on Windows, but I'dliek to do this on Android.

A: Fragmentation does not affect SD card as much as it affect a harddrive since SD card does not have spinning parts or moving heads, the difference between random access vs sequential access of an SD card is negligible.
In other words, SD card does not need defragmenting; in fact defragmenting an SD card will only lower the life span of your SD card since the memory cells of an SD card have a limit on the number of read/write that you can do on them.
And if you need to "scandisk" (or "fsck" in Unix/Linux-speak, stands for "File System ChecK"), I don't think the Android's default shell comes with fsck, but you should be able to fsck the SD card from your computer.

A: Maybe this is related to one of my questions.


text:
Q: Does anyone know how I can make my code run faster? I am trying to calculate Sigma(n=0 to infinity) (−1)^n/(n + 1) as accurately as possible. But my code takes forever and I am not able to see whether my answer is right. Does anyone know how I can make my code faster? The sum is supposed to converge to log(2). My idea is that f(n) will eventually become a very small number (less than 2^-52) and a time would come when R would consider sum = sum + f(n) and that's when I'd want the code to stop running. But clearly, that doesn't seem to work and my code takes forever to run and at least to me, it doesn't seem to ever stop.
f <- function(n)
  return(((-1)^(n))/(n+1))

s <- function(f){
  sum <- 0
  n <- 0
  while(sum != sum + f(n)) {
    sum <- sum + f(n)
    n <- n + 1
  }
  return(c(sum, n))
}

s(f)

A: library(Rcpp)
cppFunction("
List s(int max_iter) {
  double sum = 0;
  double sum_prec=NA_REAL;
  double n = 0;
  for (;sum != sum_prec && n < max_iter;n++) {
    sum_prec = sum;
    sum+=pow(-1,n)/(n+1);
  }
  return  List::create(
   _[\"sum\"]  = sum,
   _[\"iterations\"]  = n,
   _[\"precision\"] = sum-sum_prec
 ) ;
}")
test <- s(100000000)
test

When you use a huge number of subsequent iterations you know that R is not appropriated. However C++ functions are very easy to use within R. You can do something like that by example. The function needs a max of iterations and returns a list with your sum, the number of iterations and the precision.
EDIT : By precision I only do sum-sum_prec so this is not the real interval.
EDIT 2 : I let the sum != sum_prec for the example but if you don't have a supercomputer you're not supposed to see the end lol
EDIT 3 :
Typically, a fast R base solution would be something like :
base_sol <- function(n_iter) {
  v <- seq_len(n_iter)
  v <- (-1L)^(v-1L)/v
  list(
    sum = sum(v),
    iterations = n_iter,
    precision = v[length(v)]
  )
}

Which is only 1.5 times slower than c++, which is pretty fast for an interpreted language, but has the con of loading every member of the sum in ram (but then, R is made for stats not for calculating things at 2^-52)


text:
Q: Mean absorption time of a finite birth-death chain with two absorbing end-points I am attempting to understand the mean absorption time of a birth-death process (with non-constant birth and death probabilities) and with two absorbing end-points (i.e. probability of birth and death at x = 0 and x = n is equally 0).
I am referring in particular to this online reference, however something is not bounds-checking. In particular, in the expression for $m_n(1)$, we see that $A_n$ (expressed here) has a division by zero (in particular, p(0) = 0, and placed in the denominator, this is undefined). Am I missing something here? Or is this a typo? Is there another reference (maybe a book) that analyzes exactly such a chain?

A: The expressions for $A_n$ and $m_n$ in this reference do not ever contain a $p(0)$ term; what you're seeing here is an implied empty product. Using product notation, we get
$$
   A_n = \sum_{i=0}^{n-1} \frac{q(1) \dotsm q(i)}{p(1) \dotsm p(i)} = \sum_{i=0}^{n-1} \prod_{j=1}^i \frac{q(j)}{p(j)}.
$$
The $0^{\text{th}}$ term is a sum as $j$ goes from $1$ to $0$; there are no such $j$, so the product is $1$. Written without any indices whatsoever, we get
$$
   A_n = 1 + \frac{q(1)}{p(1)} + \frac{q(1)q(2)}{p(1)p(2)} + \dotsb + \frac{q(1)q(2)\dotsm q(n)}{p(1)p(2)\dotsm p(n)}.
$$
The expressions for $m_n(x)$ and for $m_n(1)$ in particular obey similar conventions. Here, when $y=0$, the product $\frac{q(1) \dotsm q(y)}{p(1) \dotsm p(y)}$ simplifies to $1$, and the sum $\sum\limits_{z=1}^y$ simplifies to $0$ (since there are no values of $z$ that satisfy $1 \le z \le 0$).

We can check that this all makes sense by considering the symmetric random walk where $p(i) = q(i) = \frac12$ and $r(i)=0$ for $0 < i < n$. In that case, $A_n$ simplifies to $n$ (since it's a sum of $n$ terms, all of which are $1$),
$$
   m_n(1) = \frac1{A_n}\sum_{y=1}^{n-1}\sum_{z=1}^y 2 = \frac1n (2 + 4 + \dots + 2(n-1)) = n-1,
$$
and
$$
   m_n(x) = m_n(1) \sum_{y=0}^{x-1} 1 - \sum_{y=0}^{x-1} \sum_{z=1}^y 2 = (n-1)x - (0+2+\dots + 2(x-1))
$$
which simplifies to the well-known formula $m_n(x) = x(n-x)$.


text:
Q: View JSON as a list in an angular app How can I show single JSON data in my browser?
app.components.ts
import { Component } from '@angular/core';
import { Http } from '@angular/http'
import { HttpClient } from '@angular/common/http';

import { EmployeeService } from './employee.service';
import { Employee } from './employee';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {

  employees: Employee[];

  constructor(private _httpService: Http, private employeeService: EmployeeService) { }

  ngOnInit() {
    this.getEmployees();
  }

  getEmployees(): void {

    this.employeeService.getEmployees().subscribe(data => {
      console.log(data);
    });

    this.employeeService.getEmployees()
      .subscribe(employees => this.employees = employees);
  }
}

employee.service.ts
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Http } from '@angular/http';

import { Observable } from 'rxjs/Rx';
import 'rxjs/add/operator/map';

import { Employee } from './employee';

@Injectable()
export class EmployeeService {

  constructor(public http: HttpClient, private _httpService: Http) { }

  employees: Employee[];

  getEmployees(): Observable<any> {

    console.log(this.http.get('/api/values'));

    return this.http.get('/api/values')
      .map(response => response);//.json());
    //.catch((error: any) => Observable.throw(
    //    { message: error.json().message, details: error.json().details }));
  }
}

app.component.html

Application says what?

  {{employees}}

employee.ts
export class Employee {
  id: number;
  name: string;
}

Now I just get an result like this:

[ { "id": "1", "name": "Karl" }, { "id": 2, "name": "Fritz" } ]

But I would like to show (and later handle) my employees with single output und input field. I am a bloody beginner. Sorry for this basic question. May someone wants to help me. Thanks in forward!!
I tried this, but it wasn't working:

{{emp.id}}

{{emp.name}}

A: We can show json object format in proper way by using json pipe. for example-
component.ts->
obj = {
    a : 12,
    b : 123
  };

component.html
{{obj | json }}

More Details


text:
Q: Codename One days left in current week or month I am building a calendar application that needs to calculate the remaining days of (1) the current week and (2) the current month.
What I have tried was using the java.util.Calendar API, but it seems not to be fully supported.
int days = cal.getActualMaximum(Calendar.DAY_OF_MONTH);

How would I do this in CN1?
Many thanks in advance.

A: I don't know CN1, but you can calculate the values using a subtraction between the max and the current value:
(1) cal.getActualMaximum(Calendar.DAY_OF_WEEK) - cal.get(Calendar.DAY_OF_WEEK)

(2) cal.getActualMaximum(Calendar.DAY_OF_MONTH) - cal.get(Calendar.DAY_OF_MONTH)

For your notification: The first day of the week is sunday in the api of calendar. When your week should start with monday you have to reduce the offset by 1.

A: We would love to add support for JSR310 in the future which would probably solve this in a more elegant way. This is something that can be done as a cn1lib without modifying Codename One but would require some work...
A bit of a hack to do this is:
int month = cal.get(Calendar.MONTH);
cal.set(Calendar.DAY_OF_MONTH, 1);
if(month == cal.DECEMBER) {
   cal.set(Calendar.YEAR, cal.get(Calendar.YEAR) + 1);
   cal.set(Calendar.MONTH, Calendar.JANUARY);
} else {
   cal.set(Calendar.MONTH, month + 1);
}
int day = 24 * 60 * 60000;
cal.setTime(new Date(cal.getTime().getTime() - day));