text:
Q: Topological Conditions that imply Non-measurability I gave a short presentation on Baire spaces, and one of the cute results of the theory I showed is that a Vitali set cannot be nowhere dense. This led me to think that a subset of the reals $A$ which satisfied:

*

*$A$ is uncountable

*$A$ has empty interior

*$\overline{A}$ contains an interval

is not Lebesgue measurable. However, a couple more minutes of thought and the rationals with the Cantor set occurred as a counter example.
Thus my question is: are there any topological conditions on a subset of the reals which implies it is not measurable? I am aware that every measurable subset of the reals is a measure zero set away from being a $G_\delta$ or an $F_\sigma$ subset, but this condition is not purely topological.

A: Bernstein sets cannot be Lebesgue measurable. They also cannot have the Baire property, or the perfect set property (they are constructed as a counterexample for the last one).
Recall that a Bernstein set is a set which does not contain a perfect set, but its intersection with any perfect set is non-empty. This means that it meets every open interval, so its closure is the unit interval, and that it has an empty interior and it is of size continuum.
Moreover, every open set $U$ which contain a Bernstein set $B$ must have the property $|[0,1]\setminus U|=\aleph_0$, otherwise $|[0,1]\setminus U|=2^{\aleph_0}$, and since its closed it contains a perfect set. In particular it means that $B\cap[0,1]\setminus U$ is non-empty, but $B\subseteq U$ so that is impossible.
Therefore the outer measure of a Bernstein set is $1$. On the other hand, the inner measure of a Bernstein set is clearly $0$ because every closed subset of a Bernstein set has to be countable, otherwise it would contain a perfect set.
Therefore a Bernstein set cannot be Lebesgue measurable.


text:
Q: Copy cell to another sheet if condition is met I have a sheet with a large data array, which I would like to split into several sheets based on values in a column.
In the main sheet, column "A", I have various labels. On the new sheet, e.g. "LabelX" i need to extract all rows from main sheet, corresponding to "LabelX" value in column "A". There are multiple rows with same label.
Hope it makes sense,
Basic example

A: It looks as if you want to have your data sorted.
If your columns in your data and in your result are in the same order and you use Office365 this can be done using:
=SORT(FILTER(MainSheet!A:D,A:A<>""))
(Replace MainSheet! with the actual sheet name of your main sheet).
or if you want the results for one particular Label only (for example: Label1) you can loose SORT:
=FILTER(MainSheet!A:D,A:A="Label1").

redpajama_set_name: RedPajamaStackExchange


text:
Q: $\mathbb{Z}_2$-cohomology of oriented infinite Grassmannian I know $H^*(G_n(\mathbb{R}^{\infty});\mathbb{Z}_2)=\mathbb{Z}_2[w_1,...,w_n]$ where $G_n(\mathbb{R}^{\infty})$ is the Grassmannian manifold of all $n$-planes in $\mathbb{R}^{\infty}$, $w_i$ is the i-th Stiefel-Whitney class for the universal bundle $\gamma^n$.
I would appreciate it if anyone can tell me what is $H^*(\tilde{G_n}(\mathbb{R}^{\infty});\mathbb{Z}_2)$, where $\tilde{G_n}(\mathbb{R}^{\infty})$ is the oriented Grassmannian, and most preferably provide me a reference or a way to infer this from the knowledge of $H^*(G_n(\mathbb{R}^{\infty});\mathbb{Z}_2)$.

A: You can take a look at the book Characteristic Classes by
John Milnor & James D. Stasheff (which you can find under the following link).
In Theorem 12.4 (on page 146) they use the Gysin sequence (introduced some pages earlier) to conclude that
$$H^*(\tilde{G_n}(\mathbb{R}^\infty); \mathbb{Z}_2) \cong \mathbb{Z}_2[w_2(\tilde{\gamma^n}), \ldots, w_n(\tilde{\gamma^n})]$$
where $\tilde{\gamma^n}$ is the oriented universal bundle on the oriented Grassmannian $\tilde{G_n}(\mathbb{R}^\infty)$.


text:
Q: Combining columns in table doesn't divide my columns equally I made a table, but when I tried to combine two columns, it didn't divide my table exactly in two, rather one part is larger than the other (as is shown in the image I added). What am I doing wrong? Thanks!

\begin{table}[h!]
  \begin{center}
    \begin{tabular}{|l|c|c|}
    \hhline{|===|}
     \textbf{Trigger} & \multicolumn{2}{c|}{\textbf{99.9\% Efficiency Point [GeV]}}\\
       & |y*| < 0.3 & |y*| < 0.6\\
      \hline
      L1\_J20 & 132 & 141 \\
      L1\_J40 & 205 & 215 \\
      L1\_J50 & 235 & 247 \\
      L1\_J75 & 318 & - \\
      L1\_J100 & - & 414  \\
      \hhline{|===|}
      \end{tabular}
      \caption{Caption}
      \label{tab:mjj}
  \end{center}
\end{table}

A: I suggest using the \thead command from makecell to have themulticolumn`argument on two lines.
\documentclass{article}
\usepackage[T1]{fontenc}

\usepackage{makecell, hhline, multirow}
\renewcommand{\theadfont}{\normalsize\bfseries}

\begin{document}

\begin{table}[h!]
  \centering
    \begin{tabular}{|l|c|c|}
    \hhline{|===|}
     \multirowthead{2}{Trigger} & \multicolumn{2}{c|}{\thead{99.9\% Efficiency \\ Point [GeV] }}\\
       & |y*| < 0.3 & |y*| < 0.6\\
      \hline
      L1\_J20 & 132 & 141 \\
      L1\_J40 & 205 & 215 \\
      L1\_J50 & 235 & 247 \\
      L1\_J75 & 318 & -- \\
      L1\_J100 & -- & 414 \\
      \hhline{|===|}
      \end{tabular}
      \caption{Caption}
      \label{tab:mjj}
\end{table}

\end{document}


text:
Q: Upgrading from Symfony 2.6 to 2.7: In a ChoiceType, what does the "choices_as_values" do? I am currently upgrading a Symfony project from version 2.6 to 2.7. I am doing that using the Symfony 2.6-2.7 upgrade guide. It says:

You should flip the keys and values of the "choices" option in ChoiceType and set the "choices_as_values" option to true. The default value of that option will be switched to true in Symfony 3.0.

I have done that. But my forms do not work as expected anymore: there are no default values set for any expanded choice fields anymore (ie with expanded = true and multiple = false). Before, with a field defined as:
$builder->add('handwork', 'choice', array(
    'multiple' => false,
    'expanded' => true,
    'choices' => array(
        1 => 'Yes',
        0 => 'No',
    ),
)

The No choice was selected by default (or was that because of a PHP cast from '' or null to 0?).
So I went to the Symfony docs on the choice form field to understand what choices_as_values does. But it is not documented there.
What am I doing wrong ? And how come this choices_as_values option is not documented?
Edit 1: After reading some more Github issues, it seems like the doc update is not yet ready, which would explain why I was not finding what I needed in the docs. It would seem that previously, in 2.6, my forms automatically casted empty values like null or "" to 0, which made them work as needed. I've yet to figure out how null or "" ends up in my field.
Edit 2: It seems like adding the option 'choice_value' => function($v) { return $v; }, helps get back my default values. This is because in SF 2.7, the value attributes of radio inputs are generated from scratch. They are an integer instead the value provided in the choices array.

A: I would recommend to keep 'choices_as_values' => false.
$builder->add('handwork', 'choice', array(
    'multiple' => false,
    'expanded' => true,
    'choices' => array(
        1 => 'Yes',
        0 => 'No',
    ),
    'choices_as_values' => false
)

Changing it to 'true' introduces BC-break and is scheduled to v3.
It's been added to handle more complex objects, and does not play well with arrays yet: https://github.com/symfony/symfony/issues/14377
Set default values in the form builder, e.g for default 'No':
$builder = $this->createFormBuilder(['handwork' => 0]);

Documentation update is due: https://github.com/symfony/symfony-docs/issues/5179


text:
Q: Function php Clean up pasted text in WordPress Function php Clean up pasted text in WordPress, dos not clean data
This script works amazing,
add_filter('tiny_mce_before_init','configure_tinymce');

/**
 * Customize TinyMCE's configuration
 *
 * @param   array
 * @return  array
 */
function configure_tinymce($in) {
  $in['paste_preprocess'] = "function(plugin, args){
    // Strip all HTML tags except those we have whitelisted
    var whitelist = 'p,span,b,strong,i,em,h3,h4,h5,h6,ul,li,ol';
    var stripped = jQuery('
' + args.content + '
');
    var els = stripped.find('*').not(whitelist);
    for (var i = els.length - 1; i >= 0; i--) {
      var e = els[i];
      jQuery(e).replaceWith(e.innerHTML);
    }
    // Strip all class and id attributes
    stripped.find('*').removeAttr('id').removeAttr('class');
    // Return the clean HTML
    args.content = stripped.html();
  }";
  return $in;
}

Code is from this website
but how to clean data in HTML tags =  exemple

» title

any ideas on how also to clean data information the same way?

A: so i came up with the solution myself
very simple one just need to add what type of data needs to be removed data-uw-styling-context
stripped.find('*').removeAttr('id').removeAttr('class').removeAttr('data-uw-styling-context');


text:
Q: How to change styling on bootstrap button when save button is disabled? I am using btn-btn-primary class of bootstrap for button styling but i have issue when form is invalid button is disabled with light blue color and grayish background that is not making enough difference with when it is enabled. How can i change background color and font in both cases ?
main.html
<form name="createProcessFormName" id="createProcessForm" role="form" class="form-horizontal">

                Business
                Name:

                <input type="text" class="form-control" id="name"
                ng-model="DTO.LongName" ng-model-options="{updateOn: 'blur'}"
                placeholder="Name" maxlength="1024" name="Name"
                required>

Business Process Name is required

</form>

    <button ng-hide="edit" ng-disabled="createFormName.$invalid" class="btn btn-primary pull-right" type="button" ng-click="submit()">Save</button>

A: Your best alternative would be to use the :invalid pseudo-class.
Once the form has all the required fields filled out, the form will no longer be invalid and therefore the button should go back to its normal state.

form + button.btn.btn-primary {
  background: blue;
}
form:invalid + button.btn.btn-primary {
  background: red;
}
<form>
  <input type="text" required />
</form>

<button ng-hide="edit" ng-disabled="createFormName.$invalid" class="btn btn-primary pull-right" type="button" ng-click="submit()">Save</button>

A: I suggest use ng-class https://docs.angularjs.org/api/ng/directive/ngClass
which will add css class based on condtion.
When createFormName.$invalid is true, it will apply invalidCssClassName
from your css.
When createFormName.$invalid is false, it will remove invalidCssClassName
from your css.
<button ng-hide="edit" ng-disabled="createFormName.$invalid" class="btn btn-primary pull-right" type="button" ng-class="{invalidCssClassName:createFormName.$invalid}" ng-click="submit()">Save</button>


text:
Q: Neo4j server plugin: disable String escaping I have written a Neo4j server plugin and want to return a JSON string. Using String as return type will cause Neo4j to escape the string.
The plugin documentation refers to org.neo4j.server.rest.repr.Representation as valid return type next to primitives, Neo4j types and String.
Unfortunately I am not able to extends this abstract class in order to build an own representation class, since its abstract methods are package private and can not be overridden.
One can easily create an instance of the class using Representation.emptyRepresentation but there is no setter for the value afterwards.
Did anyone manage to return a JSON value from a server plugin without escaping yet?

A: Using unmanaged extensions you have the the full control over result format, content types, headers etc.
Unmanaged extension do not enrich the standard REST API, instead the provide new REST endpoints. JAX-RS annotations give you full control here.

A: The Representation classes always seemed a bit strange to me, too. I had similar trouble with getting my data out of my Server Plugin. I ended up writing a my own version of a MappingRepresentation to be able to represent the values I required. Perhaps this was not necessary and there are appropriate facilities within Neo4j I just did not notice. The code I wrote is not complete in regards of mapping values that can occur in JSON, but those should be easily added. Additionally, it's probably not the most performant code out there. I just needed this Representation class and it works well for me.
You find the code at https://gist.github.com/khituras/81f909271b8b81ddc375
I hope it works for you.


text:
Q: A suitable constructor for type 'System.Collections.Generic.IEnumerable`1[TeamCloud.Areas.Identity.Data.TeamCloudUser]' could not be located I'm working on my ASP NET Core project with IdentityFramework and now I need to display list of users in parameters in table on my RazorPage. Also, I can't imagine how can I move object from razor OnGet method to view (I need to move members object and display it on view). Anyway, I need to display only users that has a similar Team that logged user has (see code below) but I stuck with this error. Hope u can help me. Thanks.
Error

MembersList.cshtml
@page
@using TeamCloud.Areas.Identity.Pages.Team.Manage
@model IEnumerable<TeamCloudUser>
@{
   ViewData["Title"] = "Список участников";
   ViewData["ActivePage"] = ManageNavPages.MembersList;
 }

Настройки команды

 <partial name="_ManageNav" />

<form method="post" asp-page="MembersList">

@ViewData["Title"]

        <input type="submit" asp-page-handler="AddMember" class="btn alert-primary" value="Добавить участника" style="cursor: pointer; font-weight: 700;" />

                    Имя

                    Почта

                    Кол-во файлов

                    Объем памяти

                    Действия

            @foreach (var member in Model.TeamCloudUsers)
            {

                        @Html.DisplayFor(modelItem => member.ProfileName)

                        @Html.DisplayFor(modelItem => member.Email)

                        @Html.DisplayFor(modelItem => member.TotalFiles)

                        @Html.DisplayFor(modelItem => member.TotalSize)

                        @if (@member.IsBlockedToUpload == true)
                        {

                        }
                        else
                        {

                        }

Блокировка пользователя

                                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                            ×
                                        </button>

                                        Запретить участнику "@member.Email" загружать новые файлы в командное хранилище?.

                                        <button type="submit" asp-page-handler="BlockToUpload" class="btn alert-primary" value="@member.Id" name="userId">Запретить</button>
                                        <button type="button" class="btn alert-primary" data-dismiss="modal">Отмена</button>

Разблокировка пользователя

                                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                            ×
                                        </button>

                                        Предоставить пользователю "@member.Email" доступ к загрузке файлов в хранилище команды?

                                        <button type="submit" asp-page-handler="AllowToUpload" class="btn alert-primary" value="@member.Id" name="userId">Разрешить</button>
                                        <button type="button" class="btn alert-primary" data-dismiss="modal">Отмена</button>

Исключение пользователя

                                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                            ×
                                        </button>

                                        Исключить пользователя "@member.Email" из команды? (тут подумать над удалением его файлов)

                                        <button type="submit" asp-page-handler="DeleteFromTeam" class="btn alert-primary" value="@member.Id" name="userId">Исключить</button>
                                        <button type="button" class="btn alert-primary" data-dismiss="modal">Отмена</button>

            }

</form>

MembersList.cshtml.cs
namespace TeamCloud.Areas.Identity.Pages.Team.Manage
{
 public class MembersListModel : PageModel
 {

    private readonly IWebHostEnvironment webHostEnvironment;
    private readonly UserManager<TeamCloudUser> _userManager;
    private readonly ILogger<TeamCloudUser> _logger;
    private readonly TeamCloudContext _context;

    SqlConnection sqlConnection = new SqlConnection("Data Source=DESKTOP-LRLFA5K\\SQLEXPRESS;Initial Catalog=TeamCloud;Integrated Security=True");

    private string currentUserId { get; set; }

    public MembersListModel(IWebHostEnvironment webHostEnvironment, UserManager<TeamCloudUser> userManager, ILogger<TeamCloudUser> logger, TeamCloudContext context)
    {
        this.webHostEnvironment = webHostEnvironment;
        _userManager = userManager;
        _logger = logger;
        _context = context;
    }

    public IActionResult OnGetAsync()
    {
        var teamFounder = _userManager.GetUserId(User);
        currentUserId = teamFounder;
        int currentTeamId = FindTeamIdByName();
        var teamMembers = _context.AspNetUserTeams.Where(x => x.TeamId == currentTeamId).Select(x => x.UserId);
        string partialValue = null;
        var members = partialValue;
        foreach (var member in teamMembers)
        {
            members += _context.Users.Where(x => x.Id == member).FirstOrDefault();
        }
        return ??? //How to move object modal members to view in RazorPages?
    }

    public IActionResult OnPostAddMember()
    {
        return RedirectToPage("AddMember");
    }

    private int FindTeamIdByName()
    {
        sqlConnection.Open();
        SqlCommand sqlCommand = new SqlCommand("select TeamId from AspNetUserTeams where UserId = @userId", sqlConnection);
        sqlCommand.Parameters.Add("@userId", SqlDbType.NVarChar);
        sqlCommand.Parameters["@userId"].Value = currentUserId;
        DataSet dataSet = new DataSet();
        var dataAdapter = new SqlDataAdapter { SelectCommand = sqlCommand };
        dataAdapter.Fill(dataSet);
        sqlConnection.Close();
        return Convert.ToInt32(dataSet.Tables[0].Rows[0]["TeamId"]);
    }
}

}
TeamCloudUser
namespace TeamCloud.Areas.Identity.Data
{
    // Add profile data for application users by adding properties to the TeamCloudUser class
    public class TeamCloudUser : IdentityUser
{
    //public virtual new string Email { get; set; }
    public string ProfileName { get; set; }

    public bool IsBlockedToUpload { get; set; }

    public int TotalFiles { get; set; }
    public string TotalSize { get; set; }
}

}

A: You need firstly learn how to get started in razor pages:
https://learn.microsoft.com/en-us/aspnet/core/razor-pages/?view=aspnetcore-5.0&tabs=visual-studio#razor-pages
Razor Pages do not use @model ModelName,it uses @model <PageName>Model,which is different from mvc.
For your requirement,you do not know how to return model in razor pages.Change like below:
MembersList.cshtml:
@page
@model MembersListModel    //change here

    <form method="post" asp-page="MembersList">

@ViewData["Title"]

            <input type="submit" asp-page-handler="AddMember" class="btn alert-primary" value="Добавить участника" style="cursor: pointer; font-weight: 700;" />

                        Имя

                    //....

                @foreach (var member in Model.TeamCloudUsers)
            {

                        @Html.DisplayFor(modelItem => member.ProfileName)

                        @Html.DisplayFor(modelItem => member.Email)

                        @Html.DisplayFor(modelItem => member.TotalFiles)

                        @Html.DisplayFor(modelItem => member.TotalSize)

                        @if (@member.IsBlockedToUpload == true)
                        {

                        }
                        else
                        {

                        }

Блокировка пользователя

                                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                            ×
                                        </button>

                                        Запретить участнику "@member.Email" загружать новые файлы в командное хранилище?.

                                        <button type="submit" asp-page-handler="BlockToUpload" class="btn alert-primary" value="@member.Id" name="userId">Запретить</button>
                                        <button type="button" class="btn alert-primary" data-dismiss="modal">Отмена</button>

Разблокировка пользователя

                                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                            ×
                                        </button>

                                        Предоставить пользователю "@member.Email" доступ к загрузке файлов в хранилище команды?

                                        <button type="submit" asp-page-handler="AllowToUpload" class="btn alert-primary" value="@member.Id" name="userId">Разрешить</button>
                                        <button type="button" class="btn alert-primary" data-dismiss="modal">Отмена</button>

Исключение пользователя

                                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                            ×
                                        </button>

                                        Исключить пользователя "@member.Email" из команды? (тут подумать над удалением его файлов)

                                        <button type="submit" asp-page-handler="DeleteFromTeam" class="btn alert-primary" value="@member.Id" name="userId">Исключить</button>
                                        <button type="button" class="btn alert-primary" data-dismiss="modal">Отмена</button>

            }

    </form>

MembersList.cshtml.cs:
public class MembersListModel : PageModel
{
    //1. add the following property
    public IEnumerable<TeamCloudUser> TeamCloudUsers { get; set; }

    public void OnGet()
    {
        //2. set data for the property
        //for easy testing,I hard-coded the data
        //you could get the data from database
        //e.g. TeamCloudUsers = _context.AspNetUserTeams
        //                              .Where(x => x.TeamId == currentTeamId).ToList();
        TeamCloudUsers = new List<TeamCloudUser>()
        {
            new TeamCloudUser(){ ProfileName ="a",IsBlockedToUpload=false,Email="a@qq.com",TotalFiles=2,TotalSize="34"}
        };
    }
}

Result:

Update:
Modify your code to:
                                         // change here...

                                 //change here...


text:
Q: Websocket Client Could not find an implementation class I will preface this with I am not using any maven dependencies, yet I know that I am missing a jar file wls-api.jar (at least that is what I have read).
To remedy this I downloaded the oracle-weblogic-7.9.jar but the problem persists.
The exception is thrown at this line
 WebSocketContainer container = ContainerProvider.getWebSocketContainer();

Can anyone tell me why this line continuously fails?
UPDATE: upon further reading the examples I see use this dependency
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
<version>1.0</version>

I have javax.websocket-api.jar in the build path of the server and the client as it is required. What am I missing here?
Other update: I forgot to include the error thrown!
Exception in thread "main" java.lang.RuntimeException: Could not find an implementation class.
at javax.websocket.ContainerProvider.getWebSocketContainer(ContainerProvider.java:73)
at connect.<init>(connect.java:21)
at test.main(test.java:11)

A: I think the RuntimeException you are experiencing is fortunately not generated by any direct coding fault of your own.
The method getWebSocketContainer(), as described here, simply tries to load other classes and get the static instance of the ContainerProvider in the server.

The method looks for the ContainerProvider implementation class in the order listed in the META-INF/services/javax.websocket.ContainerProvider file, returning the WebSocketContainer implementation from the ContainerProvider implementation that is not null.

This, unfortunately, means that your project is not configured correctly. Double check to make sure this file is included in your project's build path.
If other projects you are looking at are using the Maven dependency you described, I would try to set up your project to do the same.
Hope this helped!

A: javax.websocket api is only the specification don't have full implementation you may need to take the jar file tyrus-standalone-client-1.9.jar and try the same example that should solve your problem. i tested with my example and it is working fine.
hope this will help you.

A: Adding

// https://mvnrepository.com/artifact/org.glassfish.tyrus.bundles/tyrus-standalone-client
compile group: 'org.glassfish.tyrus.bundles', name: 'tyrus-standalone-client', version: '1.9'

to my build.gradle file worked for me.


text:
Q: Android - perform drag and drop programmatically I would like to programmatically drag one view and release it on top of another for initialization purposes, is this possible?
EDIT: I'm looking for a way to simulate a drag&drop

A: You can remove Views from Layouts and add them to other Layouts (if that's what you are looking for)
ViewGroup oldGroup = (ViewGroup) findViewById(R.id.some_layout);
ViewGroup newGroup = (ViewGroup) findViewById(R.id.some_other_layout);

Button button = (Button) oldGroup.findViewById(R.id.a_button);

oldGroup.removeView(button);
newGroup.addView(button);

There is no drag&drop animation and it might give strange results but it's possible.
A ViewGroup would be a LinearLayout, RelativeLayout and those.

For simulating Drag&Drop events you could call the onDragListener manually but there is one problem:
public boolean onDrag(View v, DragEvent event);

expects a DragEvent which has no public constructor so you can only call it with null
There might be a way to create one via a faked Parcel but that going to be ugly.
private void initializationTest() {
    DragEvent event = null;
    /* maybe sth like that
    Parcel source = Parcel.obtain();
    source.writeInt(1234);
    event  = DragEvent.CREATOR.createFromParcel(source);
    */
    onDrag(theTargetView, event);
}

Another possibility is maybe to create touchevents but Idk if that would work. At least the monkey could probably do that.


text:
Q: Certain CSS Loading Differently Per Screen Resolution I already have <meta name="viewport" content="width=device-width, initial-scale=1.0"> in my HTML files and 99% does load smoothly and correctly on different devices. However, a certain DIV (which contains shape rendering) loads wrongly on smaller/large resolutions.
iPhone X
As you can see from this image, there is a gap between the waves and the following div. However, this only shows the gap on smaller devices.
From this image below, is how I want it to look regardless of resolution size.
Desktop
I have a CSS file for the waves.
.inner-header {
  height:100vh;
  width:100%;
  margin: 0;
  padding: 0;
  position: absolute;
}

.flex { /*Flexbox for containers*/
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: absolute;
}

.waves {
  width: 100%;
  height:15vh;
  margin-bottom:-7px; /*Fix for safari gap*/
  min-height:100px;
  max-height:150px;
  position: absolute;
}

.content {
  height:20vh;
  text-align:center;
  background-color: white;
  position: absolute;
}

/* Animation */

.parallax > use {
  animation: move-forever 25s cubic-bezier(.55,.5,.45,.5)     infinite;
}
.parallax > use:nth-child(1) {
  animation-delay: -2s;
  animation-duration: 7s;
}
.parallax > use:nth-child(2) {
  animation-delay: -3s;
  animation-duration: 10s;
}
.parallax > use:nth-child(3) {
  animation-delay: -4s;
  animation-duration: 13s;
}
.parallax > use:nth-child(4) {
  animation-delay: -5s;
  animation-duration: 20s;
}
@keyframes move-forever {
  0% {
   transform: translate3d(-90px,0,0);
  }
  100% {
    transform: translate3d(85px,0,0);
  }
}
/*Shrinking for mobile*/
@media (max-width: 768px) {
  .waves {
    height:auto;
    min-height:auto;
  }
  .content {
    height:30vh;
  }
  h1 {
    font-size:24px;
  }
}

Here is my DIV which generates waves:
<div>
  <svg class="waves" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 12 70 42" preserveAspectRatio="none" shape-rendering="auto">
    <defs>
      <path id="gentle-wave" d="M-160 44c30 0 58-18 88-18s 58 18 88 18 58-18 88-18 58 18 88 18 v44h-352z"></path>
    </defs>
    <g class="parallax">
      <use xlink:href="#gentle-wave" x="48" y="0" fill="rgba(255,255,255,0.7"></use>
      <use xlink:href="#gentle-wave" x="48" y="3" fill="rgba(255,255,255,0.5)"></use>
      <use xlink:href="#gentle-wave" x="48" y="5" fill="rgba(255,255,255,0.3)"></use>
      <use xlink:href="#gentle-wave" x="48" y="7" fill="#fff"></use>
    </g>
  </svg>
</div>

My Bootstrap CSS Is also included.
Bootstrap Code

A: You have set .waves to position: absolute; but not told it where to be positioned at. Include bottom: 0; to your style declarations so that it looks like the following:
.waves {
  width: 100%;
  height:15vh;
  margin-bottom:-7px; /*Fix for safari gap*/
  min-height:100px;
  max-height:150px;
  position: absolute;
  bottom: 0;
}

That will set the position of .waves to the bottom of the containing block, you haven't included the page HTML in your question but I'm assuming it will be the parent or close ancestor.

The size and position of an element are often impacted by its containing block. Most often, the containing block is the content area of an element's nearest block-level ancestor, but this is not always the case.

You can read more MDN about Layout and the containing block and CSS position.


text:
Q: Font-Awesome ExtJS ActionColumn I'm Using FontAwesome with ExtJS in my app.
All other buttons are working fine with font awesome when I do this:
 iconCls: 'fa fa-edit'

But when using the same configuration in the actioncolumn (Component that allow you to put buttons on a Grid) the icon simply doesn't appear.
Does anyone have an idea why?
EDIT
After trying @qdev answer: I'm just seeing a ?#f040; text rendered (in blue).
The generated HTML for the action column button:
�xf040;

CSS (Taken from firebug inspector):
element.style {
    font-family: FontAwesome;
}
*, *:before, *:after {
    box-sizing: border-box;
}
*, *:before, *:after {
    box-sizing: border-box;
}
.x-action-col-icon {
    cursor: pointer;
    height: 16px;
    width: 16px;
}
.x-border-box, .x-border-box * {
    box-sizing: border-box;
}
.x-action-col-glyph {
    color: #9bc8e9;
    font-size: 16px;
    line-height: 16px;
    width: 20px;
}
*, *:before, *:after {
    box-sizing: border-box;
}
element.style {
    text-align: center;
}
.x-grid-cell-inner-action-col {
    font-size: 0;
    line-height: 0;
}
.x-grid-cell-inner {
    white-space: nowrap;
}
.x-grid-cell {
    font: 11px/13px tahoma,arial,verdana,sans-serif;
}
.x-unselectable {
    cursor: default;
}
.x-grid-table {
    border-collapse: separate;
}
.x-unselectable {
    cursor: default;
}
.x-panel-body-default {
    color: black;
    font-size: 12px;
}
.x-panel-body-default {
    color: black;
    font-size: 12px;
}
.x-panel-body-default {
    color: black;
    font-size: 12px;
}
.x-panel-body-default {
    color: black;
    font-size: 12px;
}
.x-panel-body-default {
    color: black;
    font-size: 12px;
}
.x-panel-body-default {
    color: black;
    font-size: 12px;
}
.x-body {
    color: black;
    font-family: tahoma,arial,verdana,sans-serif;
    font-size: 12px;
}
body {
    color: #222222;
    cursor: default;
    font-family: "Helvetica Neue","Helvetica",Helvetica,Arial,sans-serif;
    font-style: normal;
    font-weight: normal;
    line-height: 150%;
}
html, body {
    font-size: 100%;
}
html, body {
    font-size: 100%;
}

A: You can simply return 'fa fa-edit' class from the actioncolumn item's getClass as following:
{
    xtype: 'actioncolumn',
    items: [{
        getClass: function () {
            return 'x-fa fa-users';
        }
    }]
}

A: This is because grid action column icons are rendered as IMG tags which accepts icon (path) as option.
In order to be able to use this, you have to override Ext.grid.column.Action *defaultRenderer* method, to support glyph config option beside icon (and on your code you can decide rather you go with icon img or glyph for each action on any view).
The working (tested on ExtJS 5.0.1 but I think it works on ExtJS 4 as well) code for this override:
Ext.define('MyApp.overrides.grid.column.Action', {
    override: 'Ext.grid.column.Action',

    // overridden to implement
    defaultRenderer: function(v, meta, record, rowIdx, colIdx, store, view){
        var me = this,
            prefix = Ext.baseCSSPrefix,
            scope = me.origScope || me,
            items = me.items,
            len = items.length,
            i = 0,
            item, ret, disabled, tooltip, glyph, glyphParts, glyphFontFamily;

        // Allow a configured renderer to create initial value (And set the other values in the "metadata" argument!)
        // Assign a new variable here, since if we modify "v" it will also modify the arguments collection, meaning
        // we will pass an incorrect value to getClass/getTip
        ret = Ext.isFunction(me.origRenderer) ? me.origRenderer.apply(scope, arguments) || '' : '';

        meta.tdCls += ' ' + Ext.baseCSSPrefix + 'action-col-cell';
        for (; i < len; i++) {
            item = items[i];

            disabled = item.disabled || (item.isDisabled ? item.isDisabled.call(item.scope || scope, view, rowIdx, colIdx, item, record) : false);
            tooltip = disabled ? null : (item.tooltip || (item.getTip ? item.getTip.apply(item.scope || scope, arguments) : null));
            glyph = item.glyph;

            // Only process the item action setup once.
            if (!item.hasActionConfiguration) {

                // Apply our documented default to all items
                item.stopSelection = me.stopSelection;
                item.disable = Ext.Function.bind(me.disableAction, me, [i], 0);
                item.enable = Ext.Function.bind(me.enableAction, me, [i], 0);
                item.hasActionConfiguration = true;
            }

            if (glyph) {
                if (typeof glyph === 'string') {
                    glyphParts = glyph.split('@');
                    glyph = glyphParts[0];
                    glyphFontFamily = glyphParts[1];
                } else {
                    glyphFontFamily = Ext._glyphFontFamily;
                }

                ret += '<span role="button" title="' + (item.altText || me.altText) + '" class="' + prefix + 'action-col-icon ' + prefix + 'action-col-glyph ' + prefix + 'action-col-' + String(i) + ' ' + (disabled ? prefix + 'item-disabled' : ' ') +
                    ' ' + (Ext.isFunction(item.getClass) ? item.getClass.apply(item.scope || scope, arguments) : (item.iconCls || me.iconCls || '')) + '"' +
                    ' style="font-family:' + glyphFontFamily + '"' +
                    (tooltip ? ' data-qtip="' + tooltip + '"' : '') + '>&#' + glyph + ';';
            } else {
                ret += '';
            }
        }
        return ret;
    }
});

If you don't know where to put or load it, you can find on the internet, but on a sencha cmd generated app you simply put it in appFolder/overrides/grid/column/Action.js and will automatically be loaded by the framework.
Then you have to tweak a little bit some CSS as well (I added in my custom CSS for the main viewport).
Without this you will NOT see the glyps, I suppose you'll understand why looking at the code bellow:
.x-action-col-glyph {font-size:16px; line-height:16px; color:#9BC8E9; width:20px}
.x-action-col-glyph:hover{color:#3892D3}

I have also succeeded to do another nice trick: hide action icons by default for all rows and show them only on the hovered row / record.
You can choose where to use this, only on the views that you wwant by using the getClass config function of the icon/glyph by adding x-hidden-display (on older ExtJS version might be x-hide-display) class like this:
{
  glyph: 0xf055,
  tooltip: 'Add',
  getClass: function(){return 'x-hidden-display'}
}

... and then show all the icons for the hovered / selected row using CSS only:
.x-grid-item-over .x-hidden-display, .x-grid-item-selected .x-hidden-display{display:inline-block !important}

I hope this helps you ;)

A: I've recently created this new app that will help you to prepare custom icons that you can assign to iconCls. It generates the _icons.scss file for your Sencha apps. I've tested it with Sencha Touch only but I think it should also work with ExtJS. The README explains the steps for creating icons at the Ico Moon web site and using the tool to convert Ico Moon project files into SCSS for use in Sencha.  It has also been tested with Sencha Architect Touch projects.

*

*https://github.com/tohagan/sencha-ico-moon
If you use it for ExtJS please tell me if it works.  Thanks.

A: I add getGlyph (similar to getClass for icons) to qdev solution.
It is very simple solution but works perfect.
Is is just 3 lines add do qdev solution:
    if(Ext.isFunction(item.getGlyph)){
        glyph = item.getGlyph.apply(item.scope || scope, arguments);
    }else{
        glyph = item.glyph;
    }

Complete overrides code:
Ext.define('corporateCms.overrides.grid.column.Action', {
    override: 'Ext.grid.column.Action',

    // overridden to implement
    defaultRenderer: function(v, cellValues, record, rowIdx, colIdx, store, view) {
        var me = this,
            prefix = Ext.baseCSSPrefix,
            scope = me.origScope || me,
            items = me.items,
            len = items.length,
            i = 0,
            item, ret, disabled, tooltip,glyph, glyphParts, glyphFontFamily;

        // Allow a configured renderer to create initial value (And set the other values in the "metadata" argument!)
        // Assign a new variable here, since if we modify "v" it will also modify the arguments collection, meaning
        // we will pass an incorrect value to getClass/getTip
        ret = Ext.isFunction(me.origRenderer) ? me.origRenderer.apply(scope, arguments) || '' : '';

        cellValues.tdCls += ' ' + Ext.baseCSSPrefix + 'action-col-cell';
        for (; i < len; i++) {
            item = items[i];

            disabled = item.disabled || (item.isDisabled ? item.isDisabled.call(item.scope || scope, view, rowIdx, colIdx, item, record) : false);
            tooltip = disabled ? null : (item.tooltip || (item.getTip ? item.getTip.apply(item.scope || scope, arguments) : null));
            if(Ext.isFunction(item.getGlyph)){
                glyph = item.getGlyph.apply(item.scope || scope, arguments);
            }else{
                glyph = item.glyph;
            }

            // Only process the item action setup once.
            if (!item.hasActionConfiguration) {
                // Apply our documented default to all items
                item.stopSelection = me.stopSelection;
                item.disable = Ext.Function.bind(me.disableAction, me, [i], 0);
                item.enable = Ext.Function.bind(me.enableAction, me, [i], 0);
                item.hasActionConfiguration = true;
            }
            if (glyph ) {

                if (typeof glyph === 'string') {
                    glyphParts = glyph.split('@');
                    glyph = glyphParts[0];
                    glyphFontFamily = glyphParts[1];
                } else {
                    glyphFontFamily = Ext._glyphFontFamily;
                }

                ret += '<span role="button" title="' + (item.altText || me.altText) + '" class="' + prefix + 'action-col-icon ' + prefix + 'action-col-glyph ' + prefix + 'action-col-' + String(i) + ' ' + (disabled ? prefix + 'item-disabled' : ' ') +
                    ' ' + (Ext.isFunction(item.getClass) ? item.getClass.apply(item.scope || scope, arguments) : (item.iconCls || me.iconCls || '')) + '"' +
                    ' style="font-family:' + glyphFontFamily + '"' +
                    (tooltip ? ' data-qtip="' + tooltip + '"' : '') + '>&#' +  glyph + ';';
            } else {
                ret += '';
            }
        }
        return ret;
    }
});

You can use it as simple as:
    getGlyph: function(v, meta, rec) {
        if (rec.get('access')) {
            return 'xf067@FontAwesome';
        } else {
            return 'xf068@FontAwesome';
        }
    },

I hope this helps you ;)

A: Looks like the overrides don't work if you are in 4.0 - 4.1.  I went the path of least resistance and just made the icons into png format via http://fa2png.io/ then defined the assigned class to a background-image url in the css.


text:
Q: Django ModelForm widget and non-widget field ordering I have a django (1.11.9) ModelForm for events with times (start and end). When I display it to the user in a template I want last_field to be the last field in the form at the bottom:
class EventForm(forms.ModelForm):
    dt = '%Y-%m-%d %H:%M'

    start = forms.DateTimeField(
        label="Start time (in event's local time)",
        required=False,
        input_formats=[dt]
    )

    end = forms.DateTimeField(
        label="End time (in event's local time)",
        required=False,
        input_formats=[dt]
    )

    class Meta:
        model = Event
        fields = [
         'name', 'flexibility', 'timezone',
         'date_start', 'date_end', 'last_field',
        ]

    def __init__(self, *args, **kwargs):
        super(EventForm, self).__init__(*args, **kwargs)

        self.fields['date_start'].widget = forms.HiddenInput()
        self.fields['date_end'].widget = forms.HiddenInput()

        i = kwargs.get('instance')
        tz = pytz.timezone(i.timezone) if i and i.timezone else None
        if i and i.flexibility == Event.FLEXIBILITY_ONTIME and tz:
            self.fields['start'].initial = i.date_start.astimezone(tz).strftime(self.dt) if i.date_start else None
            self.fields['end'].initial = i.date_end.astimezone(tz).strftime(self.dt) if i.date_end else None

        else:
            self.fields['start'].initial = None
            self.fields['end'].initial = None

however, even explicitly setting 'last_field' at the end of the fields = [] array (per docs https://docs.djangoproject.com/en/1.11/topics/forms/modelforms/#changing-the-order-of-fields), the start and end widget fields in the form render below it out of the set field order.
is there a way to override the widgets to force the ordering of the fields? thanks


text:
Q: Import a Table from Soccer or Hockey to Google Spreadsheet I have some problems to import a table to my Google Spreadsheet -> For a Sample I use this URL:
https://www.sofascore.com/de/turnier/93/13507/tabelle/tabellen/embed
"importurl" is not right for sofascore and I use
=IMPORTXML("https://www.sofascore.com/de/turnier/93/13507/tabelle/tabellen/embed"; "//div[@class='tab-content js-standings-tables-part-panels']")

My problem is that all the data in a cell is, I need every value in an extra cell, here a photo about my Problem:

Can anybody  fix this issue?


text:
Q: keyboard shortcut to set terminal tab title I like to work in linux without using mouse, because of that I would like to know is there any method to set keyboard shortcut to set terminal tab title.
thank you for attention.
Regards,
Hayk

A: *

*This is not a programming question.

*Yes, it's possible in most terminals with appropriate escape sequences. It depends on which terminal emulator you use, though.


text:
Q: How to handle updating entity without knowing which fields were updated? I have a view in my MVC app which has some (but not all) properties of my entity exposed for editing. There are other entity properties which are not exposed to the user. Right now, the form is posted to my controller in the form of a parameter of my entity type. The entity has valid values for the fields exposed in the view, but the rest of the unexposed fields are null. If I go to my repository and try to update the existing entity with this one, many fields will be overwritten with null values.
How would I update my entity with just the fields the user changed in the view?
I can think of two approaches. Are there more?

*

*You include ALL fields of the model as hidden fields within the form. That way when a post happens, the entire model is updated.

*You only post the fields the user can change and you have specific routes, controller methods, and repository methods to handle this approach. You can have methods like updateEntityAddress, where the new address values are received and they then overwrite the existing values. You know that this method is only for updating that specific type of field, so you know which ones have changed, and can write code to just update those fields.

A: As Stephen Muecke has already alluded to in a comment, you need to borrow from the concept of a "ViewModel".  I am not saying that you need to have an actual full-blown ViewModel, because you have stated that you are doing MVC, you are not doing MVVM, but these concepts are related, since MVVM derives from MVC.
So, you need to have a clear concept of what subset of your entity is exposed to (and editable by) the view, so that you know what part of your original entity needs updating and what part must be left "as-is".
A quick and dirty solution could be to:

*

*Have a table somewhere (perhaps a dictionary mapping each entity-type to a list-of-field names) which lists which fields of an entity are to be sent to the view and therefore which fields are expected to be received back and applied to the entity.

But a better approach would be to:

*

*Introduce a whole bunch of new classes, one for each entity, where each class:

*

*is filled with a subset of the fields that make up the entity

*is sent to the view and presented to the user

*is received back in the POST request.

*is then applied to the original entity.

On the long run, having a separate set of ViewModel classes pays, because what you will inevitably discover is that your model entities are sometimes not presentable to the user, nor editable by the user, in their original form, but they need to undergo transformations before the user sees them, and these transformations may need to be reversed before changes can be persisted. In other words, the forms that the user sees do not need to (should not be limited to) have a one-to-one correspondence with model entities.

A: I didn't put a lot of thought into this, but there are 2 ways I thought of.

*

*When you post the entity, look up the same entity.  Then use reflection to set the values of the null fields on the posted entity to the values of the entity you looked up on those same fields.  Then your entity won't have any null fields that were not already null and you won't have to put them all in the form as hidden fields.

(update)If you know what entity is being posted and what fields are on it, then you don't need to use reflection.

*Write a stored procedure to update the entity, called something like "sp_AddOrUpdate_EntityName".  Make the first parameter "@ignoreNullParameters BIT = 0", then add parameters for all the fields on your entity.  Then write Transac SQL to Update the Entity if it exists and insert it if it does not.  On an Update if IgnoreNullParameters = 1 then it should not overwrite values with nulls.  That would look something like
Update [sometable]
Set [someField] = CASE WHEN @ignoreNullParameters = 1 THEN ISNULL(@someField, [someField]) ELSE @someField END
WHERE [id] @id
Then modify EF to call the stored procedure to add/update the entity (pretty sure there is a way to do that) as opposed to letting EF make it's own queries to update/insert that entity.

A: You should have a look at OData with Web API:
Create an OData-v4 Endpoint.
I've found this code in the article, this allows you to update a Delta of your entity that means you post only the properties you want to update :
public async Task<IHttpActionResult> Patch([FromODataUri] int key, Delta<Product> product)
{
    if (!ModelState.IsValid)
    {
        return BadRequest(ModelState);
    }
    var entity = await db.Products.FindAsync(key);
    if (entity == null)
    {
        return NotFound();
    }
    product.Patch(entity);
    try
    {
        await db.SaveChangesAsync();
    }
    catch (DbUpdateConcurrencyException)
    {
        if (!ProductExists(key))
        {
            return NotFound();
        }
        else
        {
            throw;
        }
    }
    return Updated(entity);
}

A: I realize that this has an answer, and a good one for an MVC web page, but I want to post a different approach for some future web surfer.
In the event you have an integration end-point that is providing you partial updates to your API, and you only want to restrict changes to values that are provided:
In your DB context class, override the SaveChanges method and apply the necessary business logic to the entity attributes before you conduct the actual save operation.
In my case, I know that certain properties will be null but I don't want to have them overwritten in the data store by the end-point accessing the API invokes a save operation.
A web application does a direct data change to maintain the properties I don't want the end-point to change.
This approach also has the benefit of not having to refactor your entire application to solve what may be an edge-case.
The snippet below will work as well.
    public override int SaveChanges()
    {

        var selectedEntityList = ChangeTracker.Entries()
                                .Where(x => x.Entity is ctTerminalTimeZone &&
                                (x.State == EntityState.Added || x.State == EntityState.Modified));
        foreach (var entity in selectedEntityList)
        {
            this.ctTerminalTimeZoneChangeLogEntities.Add(new ctTerminalTimeZoneChangeLog()
            {
                DateModified = DateTime.Now.ToShortDateString(),
                TerminalLocationCode = ((ctTerminalTimeZone)entity.Entity).TerminalLocationCode,
                TimeModified = DateTime.Now.ToLongTimeString()

            });
            if (((ctTerminalTimeZone)entity.Entity).HiddenValue == null)
            {
                this.Entry(((ctTerminalTimeZone)entity.Entity)).Property(x => x.HiddenValue).IsModified = false;
            }
            //and so on and so on
        }
        return base.SaveChanges();
    }


text:
Q: weird VB.Net behavior I have this program in vb.net that prints the text on the first form with a textbox and a label to the second form.. It works fine..but when I transferred the text and the labels of the second form that came from the first form to the third form it gives me an error here is my codes thanks in advance for the help :)
    Public Class Form3
    Private frm2 As New Form2
    Private xfrm3 As New Form4
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim label21 As Label = New Label
        frm2.Label21.Text = label21.Text
        Dim label22 As Label = New Label
        frm2.Label22.Text = label22.Text
        Dim textbox1 As New TextBox
        Dim textbox2 As New TextBox
        If textbox1.Text = frm2.Label22.Text And textbox2.Text = frm2.Label24.Text Then

            xfrm3.Label1.Text = xfrm3.Label1.Text + 1
            Form4.Show()
            Me.Hide()
        End If

    End Sub
End Class

Thanks again :)
EDIT: Right now there is no error message but when I click the button nothing happens

A: Nothing happens beacause this :
If textbox1.Text = frm2.Label22.Text And textbox2.Text = frm2.Label24.Text Then

Is not a satisified. I think the second condition is not "correct"
textbox2.Text = frm2.Label24.Text Then

textbox2.Text maybe is empty because is just created, but frm2.Label24.Text have a different value.
I can't understand totally your code... try to set an explicit name on your textbox object and give a chance to the debug... maybe can help you.


text:
Q: Amazon S3 Access Denied only in CopyObject I'm upload files from nodejs script and when I try to copy object I'm getting Access Denied error, if I try to delete the object or to get it  - there is no problem and it success.
Is there anything spacial in the CopyObject?
params = {
     "Bucket": "buacket-name",
     "CopySource": "source-path/object.txt",
     "Key": "source-path/object2.txt"
};

s3.copyObject(params, function(err, data)); // With a function for success or error.

A: Per the AWS S3 copyObject docs, the CopySource parameter should include the bucket and key names. For example:
var params = {
  CopySource: 'source_bucket/source_key',
  Bucket: 'destination_bucket_name',
  Key: 'destination_key'
};

s3.copyObject(params, function(error, data) {

  // error check
  if (error) {
    console.log(error, error.stack);
  }

  console.log('S3 object copied');
});

A: I had a similar issue to yours in that copyObject produced a 403 "Access Denied" response, but a getObject followed by a putObject worked fine. In my case, I did have the correct syntax for the CopySource parameter.
The solution to my problem was to add the s3:GetObjectTagging and s3:PutObjectTagging permissions to the IAM role performing the copy, since the copyObject operation will attempt to copy the tags over. I know this isn't the solution to your problem, but I'm putting this down answer in case someone else has something very similar.
Unfortunately, the documentation for the Node.JS API and the S3 service do not mention this permission requirement. I learned the solution in an SO answer.

A: Solved it! The problem was in my CopySource path, it needs to have the bucket name first, like so: backet-name/objectkey


text:
Q: How to format a DateTime object so it shows 24:00 instead of 00:00 in PHP? I have a PHP program that shows two DateTime (or DateTimeImmutable) objects: start and end. To be human readable, midnight should be displayed as 00:00 for start but 24:00 for end.
Example:
$start = new DateTime('2017-01-01T22:00:00');
$end   = new DateTime('2017-01-02T00:00:00');
$format = 'Y-m-d H:i';
$startString = $start->format($format);
$endString   = $end->format($format); // What to do here instead?
printf("From %s to %s.\n",  $startString, $endString);

Actual output:
From 2017-01-01 22:00 to 2017-01-02 00:00.

Wanted output:
From 2017-01-01 22:00 to 2017-01-01 24:00.

I'm looking for a solution that works for any $format string, that is, I don't want a separate solution for each date format that occurs in the application.

A: This is the best I could come up with. The idea is to replace 'H' in the format string with '24', but keeping everything else as-is.
<?php
function endFormat($dateTime, $format)
{
    $d = DateTimeImmutable::createFromMutable($dateTime);
    if ($d == $d->setTime(0, 0)) {
        $yesterday = $d->sub(new DateInterval('P1D'));
        $format24 = str_replace('H', '24', $format);
        return $yesterday->format($format24);
    } else {
        return $d->format($format);
    }
}

$start = new DateTime('2017-01-01T22:00:00');
$end   = new DateTime('2017-01-02T00:00:00');
$format = 'Y-m-d H:i';
$startString = $start->format($format);
$endString   = endFormat($end, $format);
printf("From %s to %s.\n",  $startString, $endString);

Output:
From 2017-01-01 22:00 to 2017-01-01 24:00.


text:
Q: Cant get output from python subprocess scp I trying to get output from scp command, for example it may be a warning message, such as:
The authenticity of host '<host_name>' can't be established.
ECDSA key fingerprint is SHA256:<>.
Are you sure you want to continue connecting (yes/no)?
Please type 'yes' or 'no':

or password request:
<username>@<host_name>'s password:

but when i use script it become to waiting(?) mode. I tried to change command to "dir" and it work succefully.
Script example:
import subprocess

cmd1 = "C:\\dir.cmd"
cmd2 = 'scp <user>@<host>:/tmp/test.xml C:\\'

def execute(command):
    proc = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=1)
    lines_iterator = iter(proc.stdout.readline, b"")
    for line in lines_iterator:
        n_line = line.rstrip()
        print('result: {}'.format(n_line.decode('ibm866')))

execute(cmd2)

Also i tried to use PyCharm debug mode, but when script reach line "n_line = line.rstrip()" all variables droppet out, and interface buttons become inactive.
pycharm_debug_1
and after 2 clicks on "step over" button
pycharm_debug_2
Can anyone please explain how can i get output from scp?


text:
Q: Ionic 4 Android 9.0 Login failed Android 9.0 not login but below 9.0 works fine
generally my code works fine on marshmallow
when I build my app android pie it is not working.
My code here below I can not understand this problem.
AndroidManifest.xml code
**<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="io.ionic.starter" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:networkSecurityConfig="@xml/network_security_config" android:supportsRtl="true" android:usesCleartextTraffic="true">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <provider android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true" android:name="org.apache.cordova.camera.FileProvider">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/camera_provider_paths" />
        </provider>
    </application>
    <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="28" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
</manifest>**

     **Ionic Info : Ionic:**

            Ionic CLI                     : 5.2.8 (C:\Users\Dev\AppData\Roaming\npm\node_modules\ionic)
            Ionic Framework               : @ionic/angular 4.11.1
            @angular-devkit/build-angular : 0.801.3
            @angular-devkit/schematics    : 8.1.3
            @angular/cli                  : 8.1.3
           @ionic/angular-toolkit        : 2.0.0

         Cordova:

            Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
            Cordova Platforms : android 8.1.0
            Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.2, (and 12 other plugins)

         Utility:

            cordova-res : 0.6.0
            native-run  : 0.2.8

         System:

            Android SDK Tools : 26.1.1 (C:\Users\Dev\AppData\Local\Android\Sdk)
            NodeJS            : v10.13.0 (C:\Program Files\nodejs\node.exe)
            npm               : 6.11.3
            OS                : Windows 10

when login Android 9 show this problem only
  HttpErrorResponse {headers: HttpHeaders, status: 0, statusText:
        "Unknown Error", url: "http://example.com//access-token", ok: false, …}
                error: ProgressEvent {isTrusted: true, lengthComputable: false, loaded: 0, total: 0, type: "error", …}
                headers: HttpHeaders {normalizedNames: Map(0), lazyUpdate: null, headers: Map(0)}
                message: "Http failure response for http://example.com//access-token: 0 Unknown Error"
                name: "HttpErrorResponse"
                ok: false
                status: 0
                statusText: "Unknown Error"
                url: "http://example.com//access-token"

A: Since you didn't post your code part, here are some possible solution.

*

*In most of the cases in ionic, Status code 0 usually indicates a CORS failure. Please check if CORS is enabled or not.

*Second most possible cause is SSL certification.

*Android platform level 28 disables cleartext network communications by default.
https://developer.android.com/training/articles/security-config.html#CleartextTrafficPermitted
https://stackoverflow.com/a/56178196/7803492

A: Step 1.
Open AndroidManifest.xml  from [yourProject]/platform/android/app/src/main/AndroidManifest.xml
Setp 2.
Add this line to that file
android:usesCleartextTraffic="true"

step3. Save the file and rebuild the apk again


text:
Q: Delete mobile view on magento theme I have a site: trend-store.nl
It is Magento based (1.8) and i have the Mr Handsome theme from galathemes.com
But i if you go on your mobile to the site. It has a different look; the mobile look.
I don't want the responsive / mobile layout, how can i remove this. I have also look at the css but i cant find anything in the css.
Here is the css link: http://trend-store.nl/skin/frontend/default/galamrhandsome/css
I have tried allot. But i cant find anything.
Can you help me?
Thanks,

A: From inspection the responsiveness is due to the CSS (rather than browser detection or serving a different theme based on the UA of the request).
If you inspect the page source you should spot the code that is controlling the responsiveness:
<script type="text/javascript">
var ADAPT_CONFIG = {
  path: "http://www.trend-store.nl/skin/frontend/default/galamrhandsome_black/css/",
  dynamic: true,
  range: [
    '0px    to 760px  = mobile.css',
    '760px  to 980px  = 720.css',
    '980px  to 1200px = 960.css',
    '1200px           = 1200.css'
  ]
};
</script>

This variable ADAPT_CONFIG is passed into a function in this javascript file
So I think to remove the responsiveness you will need to hack this theme a little bit - and there may be unpredictable consequences. Maybe the theme author would make a small change for you.
I think there are two ways to hack your theme by replacing the code snippet above, or just adding one of these scripts immediately after the snippet above:
<script type="text/javascript">
  var ADAPT_CONFIG = false;
</script>

or
<script type="text/javascript">
var ADAPT_CONFIG = {
  path: "http://www.trend-store.nl/skin/frontend/default/galamrhandsome_black/css/",
  dynamic: true,
  range: [
    '0px    to 760px  = 960.css',
    '760px  to 980px  = 960.css',
    '980px  to 1200px = 960.css',
    '1200px           = 960.css'
  ]
};
</script>

You will need to search in the theme files to find out which file to edit. Probably [path to template]/page/template/html/head.phtml
I recommend a lot of testing. There may be more edits required and apparently you can find more about this responsiveness method here http://adapt.960.gs
**EDIT following comment below
It looks like you also need to change the veiwport meta tag from
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>

to
<meta name="viewport" content="width=960, initial-scale=1.0"/>

assuming 960px is the full page width, but we may be opening a can of worms here.


text:
Q: What is a good extensible way to check if a string is a value of more than one Enum Type Lets say I have a bunch of logically distinct java enums that cannot be merged together since certain prior operations depend on each independent enum.
enum Enum1 {
   ENUM1VAL1,
   ENUM1VAL2
}

enum Enum2 {
   ENUM2VAL1,
   ENUM2VAL2
}

void existingOperationOnEnum1(Enum1 enum1);
void existingOperationOnEnum2(Enum2 enum2);

Now lets say I wish to define a new operation that checks whether a string can be converted to any of these enums
void isValidStringConversionForEnums(final String input) {
   ENUM1.valueOf(input); // Throws IllegalArgumentException if conversion not possible
   ENUM2.valueOf(input); // Throws IllegalArgumentException if conversion not possible
}

So this is great, but its not extensible. The business logic is such that we can have new enums be created in the future (with its own set of enum specific operations), however isValidStringConversionForEnums needs to be updated every time a new one is added, which a programmer might easily forget.
So my question is how would I modify isValidStringConversionForEnums so that it works with future extensions.
One way I thought was to create an interface EnumBase, get the Enums to extend that and then use reflection to get all Enum impls, but I do not wish to use Reflection in Runtime unless I have to.
Is there an alternate way in which this can be written such that I add a new enum and somehow isValidStringConversionForEnums handles that new enum.

A: You have 2 independent problems here:

*

*Given a list of enum types, how do you write code that tests that your string is convertible to at least one of them?

*How do you obtain that list.

These 2 problems are completely unrelated. So, you solve them separately.
Given a list...
Class<? extends Enum> is probably your best bet.
enum Test1 {
  FOO, BAR;
}
enum Test2 {
  FOO, BAZ;
}

public static void isValidStringConversionForEnums(String in, Class<? extends Enum>... enumTypes) {

  for (var enumType : enumTypes) {
     for (var c : enumType.getEnumConstants()) {
       if (c.name().equals(in)) return true;
     }
  }

  return false;
}

This isn't particularly efficient - but you get the gist. You can pre-make a HashSet containing every valid value and then it's just a .containsKey() call, using the above code to instead serve as a one-off "init" that makes that HashSet for example. If you actually need the enum constants, make a Map<String, List<? extends Enum<?>> instead. computeIfAbsent is a nice way to create those lists on the fly in a one-liner.
Discovery
The java classloader abstraction system simply doesn't have 'give me a list of all files in the jar' or 'give me a list of all classes'. Some libraries appear to provide those features but they are hacks that do not always work, so you probably don't want to use those.
The standard solution for this problem, used by the JVM itself too, is 'SPI' - with module-info.java it's baked in, if you don't use that (and you probably shouldn't, it's kinda tricky, that), there's ServiceLoader. To make the service files, you can use annotation processors, I think there are a few around that automate it.
Then the process flow is simply, to make a new enum, stick a @ProviderFor(Something.class) on it, where Something.class is some marker interface of your design.
Note that wanting to scan all enums on the entire classpath is just plain bad. There are all sorts of enums that java uses internally, what if one of those so happens to have a value in there equal to one of your strings? That does NOT all of a sudden make that a valid string. No, only enums you explicitly mark as applying to whatever this question is, qualify, this, you need to do something to mark them. Either with an annotation, or explicitly by writing out the full list.


text:
Q: SwiftUI: Spacing between List Items I have some code that displays a list with a title and a rectangle and if the user taps on it, it navigates to a detail page.
But my code seems to have multiple problems:

*

*The spacer is not working. I want the name on the left and the rectangle on the right like a spacer in a Stack would push it.

*The background color of the rectangle is not applied. It is just black

*If I add a navigationTitle, I see constraint errors (see below)

(
"<NSLayoutConstraint:0x600002438f50 'BIB_Trailing_CB_Leading' H:[_UIModernBarButton:0x7fd15fe088b0]-(6)-[_UIModernBarButton:0x7fd15fe064d0'World Clock']   (active)>",
"<NSLayoutConstraint:0x600002438fa0 'CB_Trailing_Trailing' _UIModernBarButton:0x7fd15fe064d0'World Clock'.trailing <= _UIButtonBarButton:0x7fd15fe05310.trailing   (active)>",
"<NSLayoutConstraint:0x600002439d10 'UINav_static_button_horiz_position' _UIModernBarButton:0x7fd15fe088b0.leading == UILayoutGuide:0x600003e04a80'UIViewLayoutMarginsGuide'.leading   (active)>",
"<NSLayoutConstraint:0x600002439d60 'UINavItemContentGuide-leading' H:[_UIButtonBarButton:0x7fd15fe05310]-(0)-[UILayoutGuide:0x600003e049a0'UINavigationBarItemContentLayoutGuide']   (active)>",
"<NSLayoutConstraint:0x6000024350e0 'UINavItemContentGuide-trailing' UILayoutGuide:0x600003e049a0'UINavigationBarItemContentLayoutGuide'.trailing == _UINavigationBarContentView:0x7fd15fd0a640.trailing   (active)>",
"<NSLayoutConstraint:0x60000243a4e0 'UIView-Encapsulated-Layout-Width' _UINavigationBarContentView:0x7fd15fd0a640.width == 0   (active)>",
"<NSLayoutConstraint:0x6000024354a0 'UIView-leftMargin-guide-constraint' H:|-(0)-UILayoutGuide:0x600003e04a80'UIViewLayoutMarginsGuide'   (active, names: '|':_UINavigationBarContentView:0x7fd15fd0a640 )>"
)

Here is my code:
    var body: some View {
    NavigationView {

        List {
            ForEach(viewModel.cityList, id: \.name) { city in
                NavigationLink(
                    destination: CityDetailView(city: city)){
                    HStack{
                        Text(city.name)
                        Spacer()
                        CustomView()
                    }
                }.frame(height: 100)
            }
        }
        .navigationTitle("World Clock")
    }
}

    CustomView:
        var body: some View {
            GeometryReader { geo in
                Circle().frame(width: geo.size.height, height: geo.size.height)
                .background(Color.green)
            }
        }

Any idea what is wrong?

A: Your spacer doesn't work because there's NavigationLink in the HStack which took all the space: it has bigger priority than Spacer.
If you wanna use NavigationLink with EmptyView, it should be placed in a ZStack with nearby view, but in this case you can simply place content of your cell inside NavigationLink label.
Rectangle is not a view but a Shape, and as with any other Shape its color should be set with foregroundColor, not with background.
GeometryReader always takes all available space, unless you're adding size modifiers to it. It cannot wrap around content by itself. So you can use following trick: add onAppear for an item inside GeometryReader and pass width to state variable, which will then add width modifier to GeometryReader.
struct ContentView: View {
    @ObservedObject var viewModel = CityListViewModel()

    var body: some View {
        NavigationView {
            List {
                ForEach(viewModel.cityList, id: \.name) { city in
                    NavigationLink(
                        destination: Text(city.name)){
                        HStack{
                            Text(city.name)
                            Spacer()
                            CustomView()
                        }
                    }.frame(height: 100)
                }
            }
            .navigationTitle("World Clock")
        }
    }
}

struct CustomView: View {
    @State
    var width: CGFloat?

    var body: some View {
        GeometryReader { geo in
            Circle().frame(width: geo.size.height, height: geo.size.height)
                .background(Color.green)
                .onAppear {
                    width = geo.size.height
                }
        }.frame(width: width)
    }
}

If you see some NSLayoutConstraint broken which you didn't create, like when using SwiftUI, you can ignore it: it's not your bug.


text:
Q: (MySQL) Finding the first, second, ...., nth movie directed by a group of directors There's a table titled "movies". The table can be found here. (Please scroll down to the bottom of the page to see the table).
I want to find the list of first movies directed by each director in the list.
I've written the following query
SELECT director, title AS first_movie, MIN(year) AS year FROM movies GROUP BY director;

I did get the desired results but I'm wondering if there's any better way to do this.
Same way I want to find the list of second movies directed by all the directors in the list. How do i do it?
And finally, is there a general way to arrive at the list of nth movie directed by all the directors in the list?


text:
Q: Inductor selection for obtaining a noiseless analog power rail I interface an image sensor, and the design schematic for power supply is:

How do I choose one from the available 3uH inductors based on the specs? I figured the maximum current and dc resistance specs, but how important to consider are the following specs for this particular application?

*

*self resonant frequency

*Q minimum

The sensor clocking can range from 5-30MHz.

A: The inductor and capacitors form a 2nd order low pass filter and one thing you have to be careful about is the Q of that filter. For instance, if you have a repetitive noise on the 3V3 that matches the resonance of the filter you could end up amplifying that frequency (or a harmonic) and making the analogue supply even noisier. Worst case scenario for circuits that don't have "damping" (R damps that resonance), is that applying power rapidly can damage some devices on the analogue rail.
So, in short you don't want Q to be that great.
I have, in the past on some designs, put small series resistors with the inductor to avoid this when I'm unsure about how things will pan-out in a design and it's no great deal if the analogue current is about 10mA milliamps or less - maybe 10 ohms will "lose" 100mV and if you can live with this I'd recommend going down this route. The graph below shows an LCR 2nd order LPF - the less peaky frequency response is when Q is lower and this is when series R is greater.

Clearly as the analogue load current increases this also applies dampening to the possible resonance of the tuned circuit so, for greater loads the requirement for a series resistor also diminishes BUT, watch out for loads that are intermittant because this might also cause ringing on the analogue rail despite the 3V3 rail looking steady.
Other things to avoid are saturating the core of the inductor because it's inductance rapidly reduces and it becomes a less-effective filter as load current increases.
Ironically, having lowish properties of self resonant frequency can be a benefit to blocking a repetitive 3V3 noise so this sometimes is worth factoring in.
I would also consider using a third capacitor to reduce really high frequency noise - the two you have already might not be that great above several tens of MHz - check the capacitors SRF too. Above SRF they turn into an inductive reactance and may cause problems.

A: Inductors are commercially designed and supplied in three main types:

*

*RF inductors, intended to be used in tuned circuits, as part of a filter, oscillator or modulator/demodulator block.

*

*The key specifications for these are self-resonant frequency and Q (or stray capacitance / equivalent parallel capacitance).

*"Energy storage" inductors, commercially known as "power inductors". Commonly found and used in Switched-Mode Power Supplies (SMPS). You may find this inductors in non-shielded (cheaper) and shielded versions.

*

*The key specifications for power inductors are the saturation current, self resonant frequency and construction details (fully shielded, partially shielded, not shielded). This last parameter sets a hard, upper limit on the maximum usable switching frequency at which you store energy in the inductor.

*"Chokes", ferrite beads or blocking inductors, intended to block as much as possible all noise, clocks, switching noise and non-DC frequencies.

*

*The key specifications for chokes is maximum saturation current (DC rated), equivalent series resistance and frequency response (or stray capacitance). Self resonant frequency and Q are not usually specified. Instead, a table or curve will indicate "how well" and "up to what" frequency the choke is doing its job: blocking RF currents. The cheapest chockes will not even specify the frequency response curve, which is not as bad as it may sound (depending on your application).

Answering more specifically your question:

*

*You are mainly interested in inductors marketed as "chokes", "beads" or "blocking". Though you may also find that some manufacturers market these as filtering or noise supressor inductors. However, beware of the marketing lingo, any inductor fulfilling the requirements below will do.

*In your circuit you are showing a typical use for a chocke: a low pass "L" filter. For a proper design, one would try to estimate the kind of noise to expect at V33 and the maximum affordable noise at AVDD. I assume you selected the 3.3uH value with this information at hand.

*With the same input information you used to arrive the 3.3uH value, you now can choose a suitable inductor, usually applying the following criteria:

*

*Equivalent Series Resistance (ESR) so that the voltage drop at the maximum current consumption is less than 5% of your DC voltage at the input. The 5% is fairly typical, however, it may be off for your actual application. For instance, let's say your circuit is powered at 3.3V and demands 100mA from AVCC under a worst case scenario. Then, you could do with any inductor with an ESR lower than about 33ohms.

*The maximum (saturation) current for your inductor should be higher than the maximum (peak) expected current demand from AVCC. Following the example before, at least 100mA.

*The frequency response curves for your selected inductor and ceramic capacitor (ey, the capacitor is also part of your "L" shaped filter, you should check also its frequency response) should effectively work up to your maximum expected noise source at V33.

*Low priced, which can be sourced from multiple vendors, avaiable in a common/standard mounting package.


text:
Q: basic auth for all pages except one I have a wordpress page and want to add basic auth to the page, except for the wordpress rest api (url: localhost/wp-json/xyz)!
The main problem seems to be the redirect that happens in the standard .htaccess of wordpress. Because of that I dont have access to the original request uri.
Here is the .htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) /index.php [L]
</IfModule>

# END WordPress

Here an example:
I added these lines to my virtualhost conf:
SetEnvIf Request_URI "(^.*$)" RURI=$1
CustomLog "logs/custom.log" "%U - %{RURI}e"

And the output when I visit localhost/wp-json will be:
/wp-json - /index.php

So the request_uri is always index.php, I would need the value that is in "%U", but how can I get that?
I also tried to add a location directive:
<Location ~ "^/(?!wp-json)">
    AuthType Basic
    AuthName "Restricted Files"
    # (Following line optional)
    AuthBasicProvider file
    AuthUserFile "C:\Users\moe\passwd"
    Require user user
</Location>

But this is also not working...
edit:
I also tried to add an environment variable in the .htaccess like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) /index.php [L,E=REQUEST_URI_ORIG:%1]
</IfModule>

# END WordPress

But also no success
I am using  Apache/2.4.38
Anyone got an idea?


text:
Q: sql left join criteria in join vs where clause I have an existing query to select some payments
I want to filter out any payments that are for clients that have an active alert in another table called ClientAlert
So I figured I would do a left join and check if the ClientAlertId is null.
select      *
from        payments p
left join   client c on c.clientid = p.clientid
left join   ClientAlert ca on ca.CRMId = c.CRMId and ca.ClientAlertSubjectId = 1 and ca.IsActive = 1 and (ca.ExpiryDate is null or ca.ExpiryDate > GetDate())
where
            ca.clientalertid is null and
            p.PaymentStatusId = 2 and
            p.PaymentDate <= GetDate() and
            p.PaymentCategoryId = 1

This seems to work I think
But I have two questions:

*

*Could there ever be a scenario that would cause multiple payments to be returned instead of one by adding this join?

*when I specified the following in the where clause instead of the join, it did not give the same results and I dont understand why
and ca.ClientAlertSubjectId = 1 and ca.IsActive = 1 and (ca.ExpiryDate is null or ExpiryDate > GetDate())
I thought having that criteria in the where clause woiuld be equivelent to having it in the join

A: *

*You could get multiples per payment record if it links to more than one Client record. Based on the WHERE clause though, I don't see how multiple ClientAlert records could cause duplication.

*LEFT JOIN records return NULLs across all their columns when there is no match. Adding ca.ClientAlertSubjectId = 1 and ca.IsActive = 1 to the WHERE clause basically forces that join to behave like an INNER JOIN because it would HAVE to find a matching record, but I'm guessing it would never return data because ClientAlertId is a non-nullable column. So basically you created a query where you need a NULL row (indicating there are no alerts), but the row must contain data.

A: *

*If they can have multiple alerts, theoretically. However since you are excluding payments with alerts, this should not be a problem. If you were including them it could be. If this was a problem, you should use a "not in" subquery instead of left outer join since that can cause duplicate records if it's not 1:1.

*Having criteria in the where clause excludes the entire row if it doesn't match the criteria. Having it in the join clause means the joined record is not shown but the "parent" is.

A: select      *
from        payments p
left join   client c on c.clientid = p.clientid
left join   ClientAlert ca on ca.CRMId = c.CRMId
and ca.ClientAlertSubjectId = 1 and ca.IsActive = 1
and (ca.ExpiryDate is null or ca.ExpiryDate > GetDate())
where
            ca.CRMId is null and
            p.PaymentStatusId = 2 and
            p.PaymentDate <= GetDate() and
            p.PaymentCategoryId = 1

*

*This tiny change will assure you will never get any duplicates IF clientid is unique in table client

*Moving conditions from left join to where means you are moving the left join condition into a condition for the row. So if the condition is not met, the row is not returned.
Left join condition will always include the row from left side of the join

A: First, unless there are payments that aren't associated with a client, then the first join should be an inner join.
Second, once a client has the proper alert, you filter out all payments made by that client, even those made months or years before the alert took effect. Is that what you want?
Third and last (though this is a long one): an outer join has this format:
select   ...
from     InnerTable i
left [outer] join OuterTable o
    on  <join criteria>
where   <filter criteria>;

For outer joins only, it is important that all checks involving the outer table should be consider as join criteria. At a bear minimum, there will be
    on  o.JoinField = i.OtherJoinField

or in your case
    on ca.CRMId = c.CRMId

To keep the output that is expected of an outer join, checks of other outer table fields should also go in the ON clause as additional join criteria:
    on  ca.CRMId = c.CRMId
    and ca.ClientAlertSubjectId = 1
    and ca.IsActive = 1
    and (ca.ExpiryDate is null or ca.ExpiryDate > GetDate())

Adding those addition checks to the WHERE clause will, as you discovered, completely filter out all the benefits of the outer join to deliver the same result set as an inner join.
However, you could get the output to return to the outer join result set by making one little change:
where   (ca.clientalertid is null
         or (ca.ClientAlertSubjectId = 1
             and ca.IsActive = 1
             and (ca.ExpiryDate is null or ca.ExpiryDate > GetDate()))
    and p.PaymentStatusId = 2
    and ...

But this doesn't quite get back to a normal outer join result set. In your case, the regular outer join will show payment and client data with NULLs for alert data for:

*

*Payments by clients with no alerts at all.

*Payments by clients with alerts but not fully qualified by the additional criteria. For example, if IsActive contains 0.

Then there would be alert data for those payments by clients who have a fully qualified alert.
Moving the additional criteria to the WHERE clause but in the format shown above will show payment and client data with NULLs for alert data only for payments with no alerts at all, along with alert data for fully qualified alerts. The payments and clients with alerts not fully qualified would not show up at all.
Remember that. There may be times when that is exactly what you want.
But that does not appear to be what you want at this time. If you want to see no alerts and partial alerts but filter out the fully qualified alerts, you can't place the other criteria in the WHERE clause. Your original query is the only way to do that.
There really is no reason to be placing the additional criteria in the WHERE clause. It gets you nothing. There is no performance benefit to be gained from it even for the inner join where it doesn't effect the output. Compare the execution plan for the inner joins with the additional criteria in the ON clause and in the WHERE clause. They are identical. The same comparison for outer joins are different. In fact, with the addition criteria in the WHERE clause, the execution plan is identical to those of the inner joins.
So just use the query you have and be satisfied that you are getting the output you want.


text:
Q: GridView data is filled up by using LINQ To DataSet I'm new in LINQ & filling GridView through LINQ. Please see my code :
 SqlConnection connection = new SqlConnection(ConfigurationManager.AppSettings["mas"]);
    DataSet ds = new DataSet();
    string Query = string.Empty;

 private void Bind_LINQ_To_DataSet()
    {
        Query = "select * from dbo.Movie";
        SqlDataAdapter da = new SqlDataAdapter(Query, connection);
        da.Fill(ds, "dbo.Movie");
        var tbl = from p in ds.Tables["dbo.Movie"].AsEnumerable()
                  where p.Field<int>("ID") == Convert.ToInt32(TextBox1.Text)
                  select p;
            GridView1.Visible = true;
            GridView1.DataSource = tbl;
            GridView1.DataBind();
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        Bind_LINQ_To_DataSet();
    }

My GridVIew comes empty. Any suggestion really appreciate.

A: You must use new in select to specify columns.
Try this:
var datasource = from r in ds.Tables["dbo.Movie"].AsEnumerable()
        where r.Field<int>("ID") == Convert.ToInt32(TextBox1.Text)
        select
        new { FirstName = r.Field<String>("firstname"), LastName = r.Field<string>("lastname") };

or use this:
GridView1.DataSource =  tbl.CopyToDataTable();

A: you should use the AsDataView() method:
GridView1.Visible = true;
GridView1.DataSource = tbl.AsDataView();
GridView1.DataBind();

No need to take into account the  number of columns.
OR you can also use CopyToDataTable() method
GridView1.Visible = true;
GridView1.DataSource = tbl.CopyToDataTable();
GridView1.DataBind();

A: Do like this :
       IEnumerable<DataRow> query =
                          from c in ds.Tables["dbo.Movie"].AsEnumerable()
                          where c.Field<int>("ID") == Convert.ToInt32(TextBox1.Text)
                          select c;
        DataTable boundTable = query.CopyToDataTable<DataRow>();
        GridView1.Visible = true;
        GridView1.DataSource = boundTable ;
        GridView1.DataBind();


text:
Q: How to proof that [reversing the lexicographic order] corresponds to [set-complement] on k-combinations (without repetition) The combinations $\sigma$ of $K$ elements of a set of size $N$ can be ordered lexicographically $\,(<_{\text{lex}})\,$ such that we have
$$\forall\left(i,j\in\left[1,i_{\text{max}}\right]\right)\,.\,\left((i<_{\mathbb{N}}j)\;\Leftrightarrow\;(\sigma_i<_{\text{lex}}\sigma_j)\right)$$
Instead of taking the $K$ elements that are removed,
we could also take the $N-K$ elements that stay and then swap both sets:
$$\left\{\left(\sigma_{N\text{ choose }K}\right)_i\,|\,i\in[1,i_{\text{max}}]\right\} = \left\{\complement\left(\left(\sigma_{N\text{ choose }N-K}\right)_i\right)\,|\,i\in[1,i_{\text{max}}]\right\}$$
where swapping means taking the set-complement $\complement$ w.r.t. $\{1...N\}$.
E.g., for $N=5$ and $K=2$ we have $i_{\text{max}}={N\choose K}={5\choose 2}=10$ combinations
$$\begin{array}{|c|c|c|c|c|c|}
\hline
i & (σ_{N\text{ choose }K})_i & \text{bits} & j & (σ_{N\text{ choose }N-K})_j & \text{bits}\\
\hline
1  & (1, 2) & 00011 & 10 & (3, 4, 5) & 11100 \\
2  & (1, 3) & 00101 & 9  & (2, 4, 5) & 11010 \\
3  & (1, 4) & 01001 & 8  & (2, 3, 5) & 10110 \\
4  & (1, 5) & 10001 & 7  & (2, 3, 4) & 01110 \\
5  & (2, 3) & 00110 & 6  & (1, 4, 5) & 11001 \\
6  & (2, 4) & 01010 & 5  & (1, 3, 5) & 10101 \\
7  & (2, 5) & 10010 & 4  & (1, 3, 4) & 01101 \\
8  & (3, 4) & 01100 & 3  & (1, 2, 5) & 10011 \\
9  & (3, 5) & 10100 & 2  & (1, 2, 4) & 01011 \\
10 & (4, 5) & 11000 & 1  & (1, 2, 3) & 00111 \\
\hline
\end{array}$$
Now, one can observe that this seems to establish a direct one-to-one correspondence in the following way:
$$(\text{Thesis})\quad\forall(i\in[1,i_{\text{max}}])\,.\,\left(\sigma_{{N\text{ choose }K},\,(<_{\text{lex}})}\right)_i=\complement\left(\left(\sigma_{{N\text{ choose }N-K},\,(>_{\text{lex}})}\right)_i\right)$$
where $(>_{\text{lex}})$ is the reverse-lexicographic order. I.e.,

*

*the lexicographically-$i$-th combination of choosing $K$ elements out of $N$
is the same as

*

*the set-complement $\complement$ of the reverse-lexicographically-$i$-th combination of choosing $N-K$ elements out of $N$
My question: Is that thesis true and how would one proof this for all $N$ and $K$?
The combinations $\sigma_i$ can be generated by decomposing $i$ according to a combinatorial number system (Buckles' so-called "Algorithm 515"), and I've tested this for all $1\leq N \leq 20$ and $0 \leq K \leq N$. I would start dissecting the algorithm to proof that both computations lead to the same result; but there might be a more direct proof for this property. (therefore the question)
Update
My proof attempt so far:
For two combinations $\sigma$ and $\tau$ of $K$ elements of a set of size $N$, one might demonstrate for the lexicographic order $(<_{\text{lex}})$ that
$$(\sigma <_{\text{lex}} \tau)\;\Leftrightarrow\; \exists i\,.\,\left(\sigma[j]=\tau[j]\text{ for }j<i\right)\text{ and }\left(\sigma[i]<_{\mathbb{N}}\tau[i]\right)$$
I.e., $\sigma$ is lexicographically smaller than $\tau$, iff $\sigma$ and $\tau$ share a same prefix after that they differ.
Then, one might argue that for this particular $\sigma[i] =: s$
$$(\sigma <_{\text{lex}} \tau)\;\Leftrightarrow
\;\exists(s\in\sigma)\,\forall(t\in\tau)\,.\,\text{either }(t\in\sigma)\text{ or }(s<_{\mathbb{N}}t)$$
I.e., $(\sigma <_{\text{lex}} \tau)$, iff each element of $\tau$ is either in $\sigma$ or it is greater than $\sigma[i]$.
Or, formulated differently: $(\sigma <_{\text{lex}} \tau$), iff $\sigma$ contains the smallest element $\sigma[i]$ that is not shared by both of them:
$$(\sigma <_{\text{lex}} \tau)\;\Leftrightarrow\;\min(\sigma \text{ "xor" } \tau)\in\sigma$$
In particular $\sigma[i]\notin\tau$ in that case. We also have
$$(\sigma[i]\notin\tau)\;\Leftrightarrow\;(\sigma[i]\in\complement(\tau))$$
because the complement $\complement(\tau)$ of $\tau$ contains all elements that are not contained in $\tau$ w.r.t. $\{1..N\}$.
That means, that the situation is "reversed" for $\complement(\sigma)$ and $\complement(\tau)$. With the help of
$$(\sigma\text{ "xor" }\tau)=(\complement(\sigma)\text{ "xor" }\complement(\tau))$$
we shoud arrive at
$$(\sigma <_{\text{lex}} \tau)\;\Leftrightarrow\;\min(\sigma \text{ "xor" } \tau)\in\sigma\;\Leftrightarrow\;\min(\complement(\sigma) \text{ "xor" } \complement(\tau))\in\complement(\tau)\;\Leftrightarrow\;(\complement(\sigma) >_{\text{lex}} \complement(\tau))$$
And this should conclude, that the $i$-th element in a set of $\sigma$s, ordered by $(<_{\text{lex}})$ corresponds to the $i$-th element in a set of $\complement(\sigma)$s, ordered by $(>_{\text{lex}})$.
Are there any flaws or too-great holes in this proof attempt?


text:
Q: Is it possible to define functions under stdClass Here i tried to define a function under stdClass object.
<?php
$x= function($name){return "Hello ".$name;};

echo $x("Sun");

$hey = (object)[ "x" => function($name){return "Hello ".$name;}, "y" =>"Hello Venus"];

echo $hey->x("Mercury");
echo $hey->y;

But it says: Fatal error: Call to undefined method stdClass::x()

A: This is the closest you can get:
$x = function ($name) { return 'hello ' . $name; };
$obj = new stdClass();
$obj->x = $x;

echo call_user_func($obj->x, 'john'); // this will work
echo $obj->x('john');                 // this will not work

You won't need to use call_user_func with php7 though.


text:
Q: Ansible: append a regular expression on an existing line in a file I have to use Ansible modules in order to edit the ssl.conf file - every time I import a new certificate.
At this moment I'm using the shell module to execute a sed command but would like to use lineinfile, if possible
sed -i '/^SSLRequire/ s/.$/|^.*.us-gov-vodafone-1.*\//' ssl.conf -i_backup_$(date "+%m%d%y")

The given sed will remove the / present at end of line and append '|^..us-gov-vodafone-1./'
I tried different ways to achieve it but could not.
Any suggestions would be sincerely appreciated.
I tried below code but it does not give me proper result
---
- hosts: ub2
#  user: ansible
  vars:
   test:
   - '|^.*.us-gov-vodafone-1.*/'
  tasks:
  - name: append reguler expression
    lineinfile:
     dest: /tmp/ssl.conf
     backrefs: yes
     state: present
     regexp: '^(SSLRequire(?!.*\b{{ test }}\b).*)$'
     line: '\1 {{ test }}'

PLAY [ub2] ***************************************************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************************************
ok: [192.168.56.102]

TASK [append reguler expression] *****************************************************************************************************************************
fatal: [192.168.56.102]: FAILED! => {"changed": false, "module_stderr": "Shared connection to 192.168.56.102 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n  File \"/home/ansible/.ansible/tmp/ansible-tmp-1546198717.33-9064765281500/AnsiballZ_lineinfile.py\", line 113, in <module>\r\n    _ansiballz_main()\r\n  File \"/home/ansible/.ansible/tmp/ansible-tmp-1546198717.33-9064765281500/AnsiballZ_lineinfile.py\", line 105, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File \"/home/ansible/.ansible/tmp/ansible-tmp-1546198717.33-9064765281500/AnsiballZ_lineinfile.py\", line 48, in invoke_module\r\n    imp.load_module('__main__', mod, module, MOD_DESC)\r\n  File \"/tmp/ansible_lineinfile_payload_LyoFsx/__main__.py\", line 524, in <module>\r\n  File \"/tmp/ansible_lineinfile_payload_LyoFsx/__main__.py\", line 515, in main\r\n  File \"/tmp/ansible_lineinfile_payload_LyoFsx/__main__.py\", line 264, in present\r\n  File \"/usr/lib/python2.7/re.py\", line 194, in compile\r\n    return _compile(pattern, flags)\r\n  File \"/usr/lib/python2.7/re.py\", line 251, in _compile\r\n    raise error, v # invalid expression\r\nsre_constants.error: bad character range\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
        to retry, use: --limit @/home/ansible/find_and_append_2.retry

PLAY RECAP ***************************************************************************************************************************************************
192.168.56.102             : ok=1    changed=0    unreachable=0    failed=1


text:
Q: Web SQL get last record from second table I have 2 tables like that
ChatList Table
COLUMNS : ID INTEGER PRIMARY KEY, PHONE, DISPLAYNAME, SESSIONID
Messages Table
COLUMNS : ID INTEGER PRIMARY KEY, [DATETIME], [FROM], [TO], [TYPE], [MESSAGE], [ISGROUP], [GROUPID], [READED], [SESSIONID], [MESSAGEID], [DISPLAYNAME]
I want get last record from messages table to chatlist join
SELECT m.ID as MID, m.DATETIME, c.ID, c.DISPLAYNAME, c.PHONE, c.SESSIONID, m.TYPE, m.MESSAGE
FROM [CHATLIST] as c
   , [MESSAGES] as m
WHERE m.SESSIONID = c.SESSIONID
GROUP BY c.SESSIONID
ORDER BY MID DESC

It's not working

A: You forgot to add the LIMIT
SELECT m.ID as MID, m.DATETIME, c.ID, c.DISPLAYNAME, c.PHONE, c.SESSIONID,
m.TYPE, m.MESSAGE
    FROM [CHATLIST] as c, [MESSAGES] as m
    WHERE m.SESSIONID = c.SESSIONID
    GROUP BY c.SESSIONID
    ORDER BY MID DESC
    LIMIT 1