text:
Q: How to run a .NET launcher on Chrome without NPAPI I am not too knowledgeable regarding .NET; however I am very much aware of the NPAPI plugin deprecation occurring with Chrome.
There is a service that my company's support site uses that utilizes a .NET launcher to initialize a remote desktop connection. What I do not quite understand is if it is possible to utilize such a launcher on Chrome without the use of NPAPI.
Anybody care to enlighten me?

A: There is no single solution that will work on all browsers; however, NPAPI still works on most and on Chrome you can use Native Messaging.
PPAPI is frequently quoted as being a solution by people not fully familiar with it; unfortunately you can only use PPAPI within NaCL or if you are specifically whitelisted by the browser team or with command-line arguments, and NaCL can't be used to launch an external process. The only solution on Chrome that I'm aware of to do what you want is Native Messaging.
FireBreath2 (currently in the refactor branch of the github repo) has support for doing things like this via native messaging as well as NPAPI or ActiveX, but it does not have any support for .NET. It's also in alpha stage, in use in production but not well documented.


text:
Q: while fetch_array() not printing all rows I'm trying to print img paths from db in a while to print them all, but it's only printing the first one.
if ($stmt = $mysqli->prepare("  SELECT *
                                FROM user_uploads
                                WHERE userID = ?
                                LIMIT 1")) {
    $stmt->bind_param('i', $_SESSION['user_id']);
    $stmt->execute();

    $result = $stmt->get_result();

    while ($row = $result->fetch_array()) {

        if (!empty($row['description'])) {
            $desc = $row['description'];
        } else {
            $desc = 'Descripción de la imagen';
        }

        echo '

                    <form class="form" action="" method="post" name="image">

                            <input name="name" type="text" class="validate[required,custom[onlyLetter],length[0,100]] feedback-input image" id="image" placeholder="' . $row['image_name'] . '"/>

                            <input type="submit" value="Cambiar nombre" id="button-blue"/>

                    </form>
                    <form class="form" action="" method="post" name="image">

                            <textarea name="text" type="text" class="validate[required,length[6,300]] feedback-input comment" id="comment" placeholder="' . $desc . '"></textarea>

                            <input type="submit" value="Cambiar descripción" id="button-blue"/>

                    </form>

';
    }
}

In my testing, I have 4 image paths saved in the table. I don't see what's wrong.
Thanks in advance!

A: You have a LIMIT clause in your query that basically limits your result set to just 1 record. Remove it to retrieve all records.

A: remove the limit from your query, You are limiting your result there.
and than your if statement should look like this.
if ($stmt = $mysqli->prepare("  SELECT *
                                FROM user_uploads
                                WHERE userID = ?
                                ")) {

redpajama_set_name: RedPajamaStackExchange


text:
Q: How many permutations for each sum of digits of a number of length l? (solved but asking for insight) Given a number of length $l$, the sum of the digits range from $0$ to $9l$
For each sum, there are $x$ permutations of digits. find the sequence of length $9l+1$ that solves $x$.
I found a function that solves this problem without expanding the polynomial equation $l$ times:
$f(n \in S,l,b) = \sum\limits_{i=0}^{\lfloor\frac{n}{b}\rfloor}(-1)^{i}{l \choose i}{n+l-1-bi \choose l-1}$
($l=l$, $b=10$,$S={0,1,...,9l}$)
Where $f(n,l,b)$ is the $n^{th}$ coefficient of a polynomial of length $l$ and base $b$ where $S={0,1,...,(b-1)l}$
(thanks to Tom De Medts for giving me the proper terms.)
Are there other functions that give the $n^{th}$ polynomial coefficient? I can't seem to find one.

A: Your sequences are simply the coefficients of the polynomials
$$(1 + x + x^2 + \dots + x^9)^L .$$
(This is a straightforward application of the theory of generating functions.)


text:
Q: Sql Server page structure. What is Fdata length? I am trying to understand the structure of the Sql Server data pages. This is the screenshot from the Pro SQL Server Internals by Dmitri Korotkevitch

I've created 3 tables:

*

*1 INT Column

*2 INT Columns

*4 INT Columns

All columns are NOT NULL
Then I run
dbcc traceon(3604);
dbcc page
(
'DbName'
,1 /*File ID*/
,368 /*Page ID*/
,3 /*Output mode: 3 - display page header and row details */
);

and getting following values for Fdata length:

*

*With 1 Column - 0800 = 0008 = 8 = 4 + 1x4

*With 2 Columns - 0c00 = 00c0 = 12 = 4 + 2x4

*With 4 Columns - 1400 = 0014 = 20 = 4 + 4x4

Here I've listed "value in the output" = "swapped value" = "decimal value"
EDITED:
So far as I understand it is Const_4 + Nbr_of_Columns * Size_Of_Columns. What is this Const_4?

A: "Fdata length" in the picture is the offset where the fixed-length data part of the row ends.
In your example the data occupie 4, 8 and 16 bytes, and the row starts with another 4 bytes (1+1+2: status bits A, status bits B, Flength), so the "end" (offset) of storing fixed length data is 8, 12 and 20 respectively.


text:
Q: Rotating rope with a ring
I have this ideal system. There is a bar with negligible mass and a ring(a point) with mass $m$. Bar is rotating with angular speed $\omega$.
If I see that system from Non-inertial reference system I get a Centrifugal force and then all is clear the ring go away from rotation axis.

Now I'm going to see this system from an inertial reference system.

I don't understand how can I deduct thanks this view that mass go away long the bar.
In a linear case I understand concept of Fictitious force very well so I can switch non-inertial system with inertial system easly. In the rotational case I'm not able to do this; my brain see only non-inertianal cases with fictitious force.
In my view, as the real forces are positioned (inertial system), what happens instead and what my experience tells me should not happen. Obviously I know I'm wrong!
A simple intuitive explanation would also be fine, I thank everyone in advance.

A: Your mistake in the inertial frame is viewing the length along the rod as a coordinate, $q$, to which we can simply apply $F_q = m \ddot q$. This is not valid, since the direction $\hat q$ is not constant!

A: My intuition on the problem is the following:
Consider a rotating horizontal bar. If there is no friction along the bar, and since the ring has no vertical movement, the only horizontal force applied by the bar to the ring has to be perpendicular to the bar in the direction of rotation. This force has to exist, since the ring is not moving with a constant velocity vector.
Since in this case, there is no inward force along the axis of the bar, the distance to the centre of rotation is increasing.
If the bar is inclined, we have to consider the balance between effect of the force the bar is applying to the ring (that increases the distance to the origin) and the gravity projected along the axis of the bar (that pulls the ring to the origin). If the angular velocity and the distance to the centre of rotation are large enough to overcome the effect of the gravity, then the ring will slide outwards, otherwise, it will slide inwards.

In more detail, lets assume that the bar starts at the origin $(0,0,0)$.
In Cartesian coordinates, the position $\vec{r}$ of the ring at time $t$ when it is at a distance $d(t)$ from the origin, is given by $(x, y, z)$, with:
$$
\begin{align}
x(t) & = d(t) \sin \alpha \ \cos(\omega t + \phi)\\
y(t) & = d(t) \sin \alpha \ \sin(\omega t + \phi)\\
z(t) & = d(t) \cos \alpha
\end{align}
$$
The velocity $\dot{\vec{r}} = \vec{v}$ is:
$$
\begin{align}
\dot{x}(t) & = \dot{d}(t) \sin \alpha \ \cos(\omega t + \phi)
 - \omega \ d(t) \sin \alpha \ \sin(\omega t + \phi)\\
\dot{y}(t) & = \dot{d}(t) \sin \alpha \ \sin(\omega t + \phi)
 + \omega \ d(t) \sin \alpha \ \cos(\omega t + \phi)\\
\dot{z}(t) & = \dot{d}(t) \cos \alpha
\end{align}
$$
And the acceleration $\ddot{\vec{r}} = \dot{\vec{v}} = \vec{a}$ is:
$$
\begin{align}
\ddot{x}(t) & = \ddot{d}(t) \sin \alpha \ \cos(\omega t + \phi)
 - 2 \ \omega \ \dot{d}(t) \sin \alpha \ \sin(\omega t + \phi)
 - \omega^2 \ d(t) \sin \alpha \ \cos(\omega t + \phi)\\
\ddot{y}(t) & = \ddot{d}(t) \sin \alpha \ \sin(\omega t + \phi)
 + 2 \ \omega \ \dot{d}(t) \sin \alpha \ \cos(\omega t + \phi)
 - \omega^2 \ d(t) \sin \alpha \ \sin(\omega t + \phi)\\
\ddot{z}(t) & = \ddot{d}(t) \cos \alpha
\end{align}
$$
In order to simplify the analysis, let's assume that $t$ is such that $\cos(\omega t + \phi) = 1$ and, thus, $\sin(\omega t + \phi) = 0$.
Then the acceleration would be:
$$
\begin{align}
\ddot{x}(t) & = \ddot{d}(t) \sin \alpha
 - \omega^2 \ d(t) \sin \alpha\\
\ddot{y}(t) & = 2 \ \omega \ \dot{d}(t) \sin \alpha\\
\ddot{z}(t) & = \ddot{d}(t) \cos \alpha
\end{align}
$$
Simplifying once more, let's start with the case where the bar is horizontal. In this case, $\sin \alpha = 1$ and $\cos \alpha = 0$ and the acceleration becomes:
$$
\begin{align}
\ddot{x}(t) & = \ddot{d}(t) - \omega^2 \ d(t) \\
\ddot{y}(t) & = 2 \ \omega \ \dot{d}(t) \\
\ddot{z}(t) & = 0
\end{align}
$$
If we think about the system in this case, the gravity will be ignored, because it will be cancelled out by the vertical reaction of the bar.
Regarding the horizontal force the bar is applying to the ring, we can imagine that is along the $y$ axis and is zero along the $x$ axis. It is zero along the $x$ axis because I'm assuming there is no friction in this direction.
So we can obtain $d(t)$ by solving the acceleration equation along the $x$ axis:
$$
0 = \ddot{d}(t) - \omega^2 \ d(t)
$$
Therefore we get:
$$
d(t) = k_1 e^{\omega t} + k_2 e^{-\omega t}
$$
for some constants $k_1$ and $k_2$.
If we go back to the inclined bar, we may consider an inclined coordinate system that, at time $t$ has the $x$ axis aligned with the bar.
In this case, we have to consider the component of the gravity along this $x$ axis and the acceleration along this axis is:
$$
- g \cos \alpha = \ddot{d}(t) - \omega^2 \ d(t)
$$
Which results in:
$$
d(t) = k_3 e^{\omega t} + k_4 e^{-\omega t} + \frac{g \cos \alpha}{\omega ^ 2}
$$
for some constants $k_3$ and $k_4$.


text:
Q: How to display only Minimize and Close button on caption bar I only want to display the Minimize and Close buttons on the caption bar, without the Maximize button using C#.net in WinForm Application. If I put this.MaximizeBox = false, the Maximize button is still displayed although it will be disabled.
      Any help will be appreciated. Please Provide me your excellent ideas
Thanks in Advance.

A: What you need to do is paint your own window chrome.  See this SO question for how to do so:
Custom titlebars/chrome in a WinForms app

A: If you don't mind losing the minimize button, you could use the forms FormBorderStyle to FixedToolWindow or SizableToolWindow.
There are some side effects to this approach though (from MSDN):

FixedToolWindow:  A tool window border that is not resizable. A tool window does not appear in the taskbar or in the window that appears when the user presses ALT+TAB. Although forms that specify FixedToolWindow typically are not shown in the taskbar, you must also ensure that the ShowInTaskbar property is set to false, since its default value is true.
SizableToolWindow:  A resizable tool window border. A tool window does not appear in the taskbar or in the window that appears when the user presses ALT+TAB.

You could set the control box property on the form to false (but then you lose the close button as well as the minimize button).
It looks like you should also be able to use the windows API (in this link the guy is hiding the close button for a wpf app, but I would think you could repurpose it) http://winsharp93.wordpress.com/2009/07/21/wpf-hide-the-window-buttons-minimize-restore-and-close-and-the-icon-of-a-window/


text:
Q: Single file Angular application not displaying Material styles I need my Angular app to be completely self contained so it's browsable when opened from file explorer rather than served from a website. I've made a simple example which uses Material:
ng add @angular/material
ng add ngx-build-plus

app.component.html

    Welcome to {{ title }}!

    <mat-slider min="1" max="100" step="1" value="50"></mat-slider>

app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

import { MatSliderModule } from '@angular/material/slider';
import { SliderComponent } from './slider/slider.component';

@NgModule({
  declarations: [
    AppComponent,
    SliderComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    BrowserAnimationsModule,
    MatSliderModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

index.html
<!doctype html>

  <meta charset="utf-8">
  <title>AngularTourOfHeroes</title>
  <base href="#">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
  <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

  <app-root></app-root>

When served with ng serve, the page correctly renders like so:

If I build the project using ng build --prod --single-bundle and open the resulting html file in the browser, I see no errors in the Network or Console, but the slider doesn't render:


text:
Q: Automtation of MariaDB backup and restore I want to automate the database backup and restore process.
Manually it's the following steps:
mysqldump -u root -p database1 > database1_backup.sql

copy database1_backup.sql to another server and
sudo mysql -u root -p database1 < database1_backup.sql

Both servers, source and destination are linux servers. My idea is to create a systemd service doing this work scheduled.
There is a password needed for the mysql commands. How can I provide that within a systemd service?
Is there a better way to automate this backup & restore process?


text:
Q: MySQL Workbench Connection to Raspbian Stretch mariadb not working I just setup a Raspberry Pi with the latest Raspbian Stretch distribution and have been trying to connect to it remotely using a TCP/SSH connection in MySQL Workbench. I keep getting the following error:

I have been researching solutions and I haven't been able to resolve the issue. Here are some of the things I've tried:
Make Sure MySQL is running and root user has permission

Change bind-address in mysql config file
Because Raspbian Stretch uses mariadb, I found this option in a different file than most solutions showed. I found it in /etc/mysql/mariadb.conf.d/50-server.cnf

Grant privileges to root user
I tried to run this query, but I kept getting syntax errors:

But I did check in the users table of phpmyadmin and found this:

So it seems that the user is set up correctly
Make sure the service is listening on the right port

Allow tcp forwarding
I also set AllowTcpForwarding to 'yes' in my /etc/ssh/sshd_config

As far as I can tell, everything looks correct. But I still get an error.
I even tried uninstalling and reinstalling mariadb and mysql, but I get the same thing.
I had no problems doing this before when I was on the wheezy version of Raspbian. Is it just a mariadb incompatibility issue?
Any suggestions?


text:
Q: How to configure Application Gateway in Azure for different ports on the same IP address I've been working on a project in Azure in which I'd like some help. I have two different VMs running the same project on containers. The first VM has the server of the application and it has a frontend. Also, this VM has a keycloak container. When the user enters the private IP of the server, it redirects to the keycloak login and afterwards it authenticates and redirects to the server frontend. The other VM is the client of the application, and goes through the same process of authenticating with the keycloak that's on the Server VM. I cannot find the proper configuration that allows this process to happen on a public IP, through an Application Gateway. The issue is that when I enter the public IP, the page does not redirect to the keycloak login. I've tried using multi-site configuration on the HTTP settings. I also searched online for answers but I only found situations where people use two VMs, not the same VM for both the frontend and keycloak. I've got two of each: backend pools, http settings, route rules and listeners. Also important, I cannot use a DNS for this matter.
The backend health returns a 200 status code
So, to sum it up: I need an user to access the public IP frontend of an application that goes through authentication via keycloak. Both are on the same VM, on different ports. This process should happen through an Application Gateway. I'm not a native English speaker, so I apologize if I wrote something wrong or difficult to understand. Any help on this matter would be really appreciated. Thank you all.

A: You should publish also keycloak on the gateway so your users can acces the login page.
More info here : https://www.keycloak.org/server/reverseproxy


text:
Q: Client can't interact with WCF-service when it is hosted by accoreconsole.exe Windows 7 x64
Visual Studio 2015 Update 1
AutoCAD 2016 SP1 x64
.Net Framework 4.6.1
I have a problem when my WCF service is hosted by accoreconsole.exe instead of acad.exe: the client application (the console application) can't interact with it. Both cases servise was opened successfully and telnet works fine with the necessary port. I use HTTP protocol. I haven't this problem when the host is acad.exe (for the same client application).
For this problem demonstration I created the simple solution with two projects: client and service. Detailed info about each of them is discribed in their readme.md files. The problem with screens is described in the readme.md of the solution.
NOTE
It is necessary to read readme.md files, because they contain important info. For building this solution you are to launch Visual Studio with admin rights.
I will be very grateful for the explanation of the reasons of this problem.
Best regards, Andrey.
UPD 1
I got the logs from the client and service for both cases of hosting: through the acad.exe (working case) and accoreconsole.exe (the problem case). I am learning it now through the Microsoft Service Trace Viewer (GUI application).

A: Hm... This problem is exists for AutoCAD 2016 only. With AutoCAD 2013-2015 I have not this problem. So... accoreconsole.exe of AutoCAD 2016 is written through the ass...
It is possible the same problem will be in newer AutoCAD versions too (AutoCAD 2017 for example)... But I haven't AutoCAD 2017 and therefore I can't check it.


text:
Q: The popup control doesn't open-up when using .exe from WPF but runs in VS 2010 I have a popup in my application which is activated by a change in selected value of a combobox.
It works fine when I debug in VS 2010 but it doesn't fire when I use the .exe on the same computer.
Is there an additional property of the popup I should use to make it stay on when using .exe?
 private void trigger_mode_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        MODE = trigger_mode.SelectedValue.ToString();
        switch (Convert.ToString(trigger_mode.SelectedValue))
        {
            case "triggerModeData":
                Popup_data.Placement = System.Windows.Controls.Primitives.PlacementMode.Mouse;
                Popup_data.StaysOpen = false;
                Popup_data.Height = 200;
                Popup_data.Width = 250;
                Popup_data.IsOpen = true;
                break;

            case "triggerModeRepeat":
                Popup_repeat.Placement = System.Windows.Controls.Primitives.PlacementMode.Mouse;
                Popup_repeat.StaysOpen = false;
                Popup_repeat.Height = 200;
                Popup_repeat.Width = 250;
                Popup_repeat.IsOpen = true;
                break;
        }
    }

XAML code
 <Popup x:Name="Popup_repeat" AllowsTransparency="True">
        <StackPanel Background="BurlyWood">
            <TextBlock TextWrapping="Wrap" Name ="T1" Text="Please enter the time interval between triggers in milliseconds"/>
            <TextBox Name="T2" Text="Enter value here" KeyDown="T2_KeyDown"/>
            <TextBlock TextWrapping="Wrap">
                <TextBlock.Text>
                    Detail - In the trigger repeat the camera is triggered periodically with a specific time interval.
                    Please enter the time between each triggers in the textbox above by first deletign the line 'Enter value here'
                    and put the time interval value in milliseconds.
                </TextBlock.Text>
            </TextBlock>
        </StackPanel>
    </Popup>
    <Popup x:Name="Popup_data" AllowsTransparency="True">
        <StackPanel Background="BurlyWood">
            <TextBlock Name ="T3" TextWrapping="Wrap" Text="Please enter the time to wait after trigger in milliseconds."/>
            <TextBox Name="T4" Text="Enter value here" KeyDown="T4_KeyDown"/>
            <TextBlock TextWrapping="Wrap">
                <TextBlock.Text>
                    Detail - In the data trigger mode the camera waits a certain time after a mechanical pre-trigger and
                    then sends a trigger to the camera to take a picture after that interval. If you are using this mode.
                    Enter the time the camera has to wait after the trigger in teh textbox by first deleting the text
                    'Enter value here' and thentype in the interval time in milliseconds"
                </TextBlock.Text>
            </TextBlock>
        </StackPanel>
    </Popup>

A: If you need the popup to remain open to receive input, you'll need to set the StaysOpen property to True.  Otherwise, the popup will close as soon as focus or activation leaves the popup.


text:
Q: No Objects Library button in Xcode 10, just Snippets Library Objects Library button is unavailable:

A: Objects Library button is visible only when edited file is xib or stroyboard.

A: In case of SwiftUI and xcode 11:
UI elements are shown in Library only when Canvas is shown (option + cmd + enter).


text:
Q: Using `SP.ClientContext` vs REST APIs in JavaScript We are currently building an application and we have to create/update/fetch items in SharePoint lists. We are currently using REST APIs for just about every functionality. But now we need to update multiple items.
I know we can use $.when to batch multiple request and perform (sort of) batch operations with multiple requests to server. But with SP.ClientContext I will have only one request to server. My estimate for number of items to update will be ~50.
As SharePoint does not support batch updates via REST APIs I need to know what will be a good approach to perform multiple update operations -
 SP.ClientContext OR REST APIs.

A: JSOM/CSOM supports batching which is the main highlight of its implementation. You can create/update/delete 50 items in one ExecuteQueryAsync  call.
function updateListItems() {
var itemArray = [];
var clientContext = SP.ClientContext.get_current();
var oList = clientContext.get_web().get_lists().getByTitle('TestList');

for(var i = 1; i<= 5; i++){
  var oListItem = oList.getItemById(i);
  oListItem.set_item('Title', 'My Updated Item!' + i);
   oListItem.update();
   itemArray[i] = oListItem;
   clientContext.load(itemArray[i]);
}
clientContext.executeQueryAsync(onQuerySucceeded, onQueryFailed);

}
function onQuerySucceeded() {
 alert('Items Updated');
}
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}

updateListItems();

References
Batch Operations JSOM
JSOM Batching Reference
REST OData v4.0 now Supports batching
You can use $batch query option in REST, to implement batch operations.
REST Batching Reference 1
REST Batching Reference 2
SP 2013 Batch REST


text:
Q: How to remove border from a AutoSuggestBox in UWP? I have a AutoSuggestBox whose border I want to remove.
<AutoSuggestBox x:Name="txtSearch" Width="200" QueryIcon="Find"
PlaceholderText="Search" Background="Transparent" BorderThickness="0" BorderBrush="Transparent" />

A: Created a Style template
<Style x:Key="AutoSuggestWithoutBorder" TargetType="AutoSuggestBox">
    <Setter Property="VerticalAlignment" Value="Top" />
    <Setter Property="IsTabStop" Value="False" />
    <Setter Property="TextBoxStyle" Value="{StaticResource AutoSuggestBoxTextBoxStyle}" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="AutoSuggestBox">
                <Grid>
                    <VisualStateManager.VisualStateGroups>
                        <VisualStateGroup x:Name="Orientation">
                            <VisualState x:Name="Landscape"/>
                            <VisualState x:Name="Portrait"/>
                        </VisualStateGroup>
                    </VisualStateManager.VisualStateGroups>
                    <TextBox x:Name="TextBox"
                Style="{TemplateBinding TextBoxStyle}"
                PlaceholderText="{TemplateBinding PlaceholderText}"
                Header="{TemplateBinding Header}"
                Width="{TemplateBinding Width}"
                BorderThickness="0"
                ScrollViewer.BringIntoViewOnFocusChange="False"
                Canvas.ZIndex="0"
                Margin="0"
                DesiredCandidateWindowAlignment="BottomEdge"/>
                    <Popup x:Name="SuggestionsPopup">
                        <Border x:Name="SuggestionsContainer" BorderThickness="0">
                            <Border.RenderTransform>
                                <TranslateTransform x:Name="UpwardTransform"/>
                            </Border.RenderTransform>
                            <ListView
            x:Name="SuggestionsList"
            Background="{ThemeResource SystemControlBackgroundChromeMediumLowBrush}"
            BorderThickness="0"
            BorderBrush="{ThemeResource SystemControlForegroundChromeHighBrush}"
            DisplayMemberPath="{TemplateBinding DisplayMemberPath}"
            IsItemClickEnabled="True"
            ItemTemplate="{TemplateBinding ItemTemplate}"
            ItemTemplateSelector="{TemplateBinding ItemTemplateSelector}"
            ItemContainerStyle="{TemplateBinding ItemContainerStyle}"
            MaxHeight="{ThemeResource AutoSuggestListMaxHeight}"
            Margin="{ThemeResource AutoSuggestListMargin}"
            Padding="{ThemeResource AutoSuggestListPadding}">
                                <ListView.ItemContainerTransitions>
                                    <TransitionCollection />
                                </ListView.ItemContainerTransitions>
                            </ListView>
                        </Border>
                    </Popup>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

Making the BorderThickness 0 where required.


text:
Q: How to Assert a list in unit test? I have this test method where I am testing a list. It is working fine but I want to simplify the Assert.
<TestMethod()> Public Sub Method_Scenario_ReturnsList()
  'Arrange
    Dim sut As New ClassName()
  'Act
    Dim result = sut.ListMethod(parameter)
  'Assert
    Assert.AreEqual("1", result(0).ID)
    Assert.AreEqual("One", result(0).Name)
    Assert.AreEqual("2", result(1).ID)
    Assert.AreEqual("Two", result(1).Name)
End Sub

Is there a way to simplify this in just two lines of Assert where I check all the IDs and all the Names? Something like
CollectionAssert.AreEqual({"1","2"}, result.Select(Of ))

Is there a syntax to do that? I am noob in VB.net

A: You can use
CollectionAssert.AreEqual({"1","2"}, result.Select(Function(item) item.Id).ToArray())

CollectionAssert.AreEqual({"One","Two"}, result.Select(Function(item) item.Name).ToArray())


text:
Q: Android Studio doesnt recognize my device - Nexus 6P I am struggling to figure out the problem with my device not being recognized in Android Studio. However I do see it from file explorer and can browse the device files.

*

*OS: Windows 10

*Device: Nexus 6P

Yes, I did some research before posting this question, so I'll enumerate what I tried:

*

*Enabled USB Debugging

*Installed Google USB drivers from the SDK manager

*Intalled HiSuite(apparently including some device drivers)

*Switching between MTP/PTP

*Restarting Android Studio several times

*Restarting my computer several times

*Every USB 2/3 ports of my computer

*Tried updating drivers from device manager(however it did not suggest anything)

*adb kill-server / start-server

Any suggestions would be greatly welcome!
Thanks in advance!

A: Apparently, installing 'Google USB Drivers' from the SDK Manager doesn't actually install them!
You have to go to:
'C:\Users\your_user\AppData\Local\Android\sdk\extras\google\usb_driver\'

*

*right-click on 'android_winusb.inf' and install.

A: First of all I make sure that I've installed google's usb_driver. Either through the SDK or what SlashJ said:

Apparently, installing 'Google USB Drivers' from the SDK Manager doesn't actually install them!
You have to go to:
'C:\Users\your_user\AppData\Local\Android\sdk\extras\google\usb_driver\'
right-click on 'android_winusb.inf' and install.

- SlashJ
After that's done:

*

*Insert your device into your PC

*Open device management

*

*Click start > run devmgmt.msc

*Right click my PC > manage > devices in left panel

*Check if there's a tab android device and look for your device or an ADB Interface, Otherwise just search for your device

*Right click your device and Update Driver Software

*Browse my computer for driver software

*Let me pick from a list

*Search for google or android in the left pane.

*And select ADB Interface in the right.

*Continue installation and it should work now.

You can try to unplug and re-plug your android device.

A: Try to use ADB over Network but it depends what Android version you have.
In Developer options you should see ADB over network section if not then sorry for this unhelpful advice.

A: If you have already tried all those steps , i would like you to install pdaNet software . This will automatically detect and repair the driver and you can find device in Android Studio.
This has worked for me
SO references :
Android studio doesn't list my phone under "Choose Device"
eclipse or android studio not recognize my phone on usb debugging mode
References for installing the drivers and enabling USB debugging is available here for reference , you could cross check with as well.
Reference 2 : Installing pdaNet

A: check for SDK platforms in Android Studio whether you have installed the Android 6.x(N), Because Nexus got Android N updates, so it may be one of the issue you faced...

A: When I had this problem what I did was install the drivers manually. What you do is download the drivers from the google website NOT with Android Studio then you go into device manager and right click on your nexus. Then go to drivers tab and hit the update then manually find drivers on computer. Navigate to the downloaded drivers and click on them. Device manager will install your drivers and should fix the problem. Also for drivers you may want to try this or this driver Also please post these kinds of questions on the Android Stack Exchange Thanks!

A: I have a similar problem with my Wiko phone, I had installed the wrong usb driver and I could not do it manualy.

*

*In developer mode, enable the usb debuging

*Try to update your driver with apk installer for Windows 10 even if it is already installed:

APK DRIVER
This tool permits to install automaticaly the right driver.
Have a look to my previous question fo further details:
How can I run my ionic app on a physical device (Wiko phone) on Windows?

A: Maybe you also have to enable developer mode on the device.
Here's a walkthrough

A: i just have that problem and anything works for me
what help me is to click a lot of time on the build number (setting-about phone-build number) and magic happens :)

A: Did you check in Android Studio Run tab->Edit Configurations->Target set to USB device.
if that doesn't work, try updating Android Studio, and/or device's firmware, also here is a similar question, involves a nexus and windows 10: https://stackoverflow.com/a/31938193/3817308
I hope this help.

A: I'm not sure how you installed adb driver. If your device is displayed in device manager but not as a ADB device, try these steps

*

*Go to Control Panel and open Device Manager.

*Find the device

*Right click the device and select properties.

*Select Driver tab, then click the Update Driver button.

*Choose Browse my computer for driver software.

*Let me pick from a list of device drivers on my computer

*Browse for the .inf driver file. Open and Next.

*Select ADB interface from device list (i can't remember the exact name)

*Install

A: There's another another Stack post (Cannot see Nexus 6P for debugging) you might want to try.

*

*You need to manually download the driver here (http://developer.android.com/sdk/win-usb.html)

*Go to "Devices and Printers", right-click on "MTP", and choose properties.

*Click "ADB interface", then click "Properties"

*Go to "Driver" tab and update driver with the file you just downloaded. (Make sure you unzip them first)


text:
Q: Docker architecture for many PHP containers I'm wondering what you guys think about how to architect Docker to handle many containers, each running different PHP code. Basically, each user on the system will have their own PHP code and code is not the same. Think of it like each user has their own wordpress site. (I think) This means I need to mount different directories for each php container.
What I initally thought of doing was to create a separate SERVICE for each user. This way, when an http request comes in, I can use host headers to find the right service to handle the request.
But then if the system has 1000 users, then that means having 1000 services - seems like a lot for Docker. I see some people running 1000 containers, but I wasn't sure about that many services.
Another thing is that I wanted to make a separate network for each user - this means 1000 networks - this is doable?
Am I going down a totally wrong path here?


text:
Q: How to measure CSS parsing and rendering time in a browser? I have a large SPA with a single large CSS file which contains many rules. Some of them are outdated and should be refactored or removed. It is compiled from a set of SCSS source files.
I am now refactoring styles and wonder if there is a way to measure how long it takes to render the page using some specific CSS file.
Say, I am in the start point, where there are a lot of crap in CSS, and I can see that with current bloated stylesheet it takes 2.234 seconds to render the app.
Then, I refactor it step by step, apply some "optimizations" and on each step I can see that with some changes render time decreases, becoming, say, 2.21 seconds, and with some other changes this time increases, say, 2.5 seconds.
Is there a way to get that metric?

A: Use the Developers Tools panel which is built in to Google Chrome. It's also similar to that of Firefox and Safari with obvious minor changes here and there. That will tell you when the file is being loaded and also how long it's taking to load up as well.
Take a look at the documentation for Chrome.
You can open the Chrome DevTools by using the Alt + Cmd + I on macOS or Ctrl + Shift + I on Windows. It's a very comprehensive document with all the info there.
In case someone asks for the Firefox version, it's called The Waterfall. See here for more information. Again, it's very thorough.


text:
Q: Java - Else If loop will NOT work with instance variable I'm attempting to calculate how much tax a user should pay, based on wage. For example, calculating 20% in the first if loop, this will be saved in generaltax:
    int generalTax = 0;
    int userGrossPay = 50000;
    if (userGrossPay <= 10600) {generalTax += 0;}
    else if (((userGrossPay >= 10600) && (userGrossPay <= 31785))) { generalTax =  ((20/100) * userGrossPay); }
    else if (((userGrossPay >= 31786) && (userGrossPay <= 150000))) { generalTax =  ((40/100) * userGrossPay); System.out.println(generalTax);}
    else if (userGrossPay > 150001) {generalTax = ((45/100) * userGrossPay); }
    else{System.out.println("error");};

    userGrossPay -= generalTax;
    System.out.println(userGrossPay);

However generalTax pay is for some reason always stuck as 0 and is not properly updating on each iteration.

A: Your problem is that you are always adding 0 or assigning 0 to generalTax.
For example, (20/100) * userGrossPay is 0, since 20/100 is 0 due to int division. Change it too 0.2 * userGrossPay or 20.0/100 * userGrossPay. Similarly change all other places where you divide two integers.

A: This is caused by integer division.
If you mix floating data type with integer, it will give you a data conversion by promotion.
For example:
    int num = 5;
    System.out.println(num / 2);    //Gives you 2
    System.out.println(num / 2.0);  //Gives you 2.5
    System.out.println(num * 2);    //Gives you 10
    System.out.println(num * 2.0);  //Gives you 10.0
    System.out.println(num + 2.5);  //Gives you 7.5

If all operands in the operation are integers, your output will be integer as well. This is how you got into an integer division accidentally.
((20/100) * userGrossPay);

I see that you already accepted Eran's answer and understood what went wrong, I am here to give you some additional information.


text:
Q: How do i stop the infinite loop for the if and elif part? c = random.randint(0,5)
guess =int(input("="))
while True:
    if guess > c:
      print("you failed the test")
    elif guess <c:
      print("you messed up")
    else:
      print("you are the one" + x)
      break

A: You can use break in more than one place in the loop. It doesn't have to be in else block or anywhere in particular. This will still work:
c = random.randint(0,5)
guess =int(input("="))
while True:
    if guess > c:
      print("you failed the test")
      break
    elif guess <c:
      print("you messed up")
      break
    else:
      print("you are the one" + x)
      break

This code doesn't make much sense though as the loop will never run a second time. You probably want to ask for input every time the loop runs. So you should move the input() call into the loop as well. It seems like you're looking for:
c = random.randint(0,5)
while True:
    guess =int(input("="))
    if guess > c:
      print("you failed the test")
    elif guess <c:
      print("you messed up")
    else:
      print("you are the one" + x)
      break

A: What do you think will happen when while(true) is present?

*

*The condition is always true and so the loop will never stop running unless it encounters a break statement. The else part works fine since it has a break statement.

What should you do?

*

*Add break statement in if and elif too so that the control moves out when condition is met.


text:
Q: c# wpf set link in the right-click context menu of windows I want to set in the right-click menu of windows, a shortcut to my app.
The goal is to select a document (image, pdf etc.) -> right-click -> 'Send with my app' ( and optionnaly open a certain class with arguments, like the files path)
I've saw some many possibilities to do that ...
but I would like to know the good way to do that with a c# wpf app.
The goal is to send an installation program to many clients to allow them to use the app, and set the entry on the context menu

A: In order to show custom options in Windows context menu, you will need to update the registry. Here is how to do it
http://www.howtogeek.com/107965/how-to-add-any-application-shortcut-to-windows-explorers-context-menu/
Once done, in your wpf application, you can get the command line arguments passed using :
string[] args = Environment.GetCommandLineArgs();

from these args, you can extract any argument passed (file location etc)


text:
Q: How can I change background color of previously selected option? I would like to style previously selected option background-color (this light-blue one). I'm using Bootstrap 4, however I don't know how can I target currently selected option in CSS.
Here is my code snippet:

<select class="form-control" id="time-select">
  <option value="" class="fb-select-option">Dowolna godzina</option>
  <option value="" class="fb-select-option">8:00-9:00</option>
  <option value="" class="fb-select-option">9:00-10:00</option>
  <option value="" class="fb-select-option">10:00-11:00</option>
  <option value="" class="fb-select-option">11:00-12:00</option>
  <option value="" class="fb-select-option">12:00-13:00</option>
  <option value="" class="fb-select-option">13:00-14:00</option>
  <option value="" class="fb-select-option">14:00-15:00</option>
  <option value="" class="fb-select-option">15:00-16:00</option>
  <option value="" class="fb-select-option">16:00-17:00</option>
</select>

A: You can give another class name that selected item and change it's background color with css


text:
Q: Clearing Object Duplicates In a vector produces infinite loop I have a vector called:
vector<MiniPair> miniPairVector;

MiniPair object has 2 property inside,1 is an integer docNumber other is a string word
I am trying to clear duplicates in this vector which means that if docNumber and word exist in another object inside vector remove the duplicates
This is what i have tried but it is producing an infinite loop:
for (int i = 0; i < miniPairVector.size(); i++) {

    for (int k = i + 1; k < miniPairVector.size(); k++) {

        if (miniPairVector[i].getDocNumber() == miniPairVector[k].getDocNumber() && miniPairVector[i].getWord() == miniPairVector[k].getWord()) {
            cout << "i am erasing" << endl;
            miniPairVector.erase(miniPairVector.begin() + k);

        }

    }

}

this is the minipair class:
#pragma once
// classes example
#ifndef MINIPAIR_H
#define MINIPAIR_H
#include <iostream>
using namespace std;

class MiniPair {
    friend bool operator<(MiniPair const &a, MiniPair const &b) {

        return a.docNumber < b.docNumber || a.docNumber == b.docNumber && a.word < b.word;
    }
    friend bool operator==(MiniPair const &a, MiniPair const &b) {

        return a.docNumber == b.docNumber && a.word == b.word;
    }
private:
    string word;
    int docNumber;

public:
    MiniPair();
    MiniPair(string word, int docNumber);
    string getWord();
    int getDocNumber();

};
#endif

A: My presumption is that you are doing this for a class.
First, while this may not be relevant for the problem you're solving write now because of class imposed constraints, this is a poor way of implementing this. When implemented correctly the number of comparisons will be something like miniPairVector.size() * miniPairVector.size(). That's a lot of comparisons, and way more than you actually need.
If I were trying to do this in a non-toy (or non-assignment) program, I would use the <algorithm> section of the standard library. I would use ::std::sort and then ::std::unique.
Here's how I would do it using those two:
#include <algorithm>

void remove_dupes(::std::vector<MiniPair> &minipair_vec)
{
    ::std::sort(minipair_vec.begin(), minipair_vec.end(),
                [](MiniPair const &a, MiniPair const &b) -> bool {
                    return (a.getDocNumber() < b.getDocNumber())
                           || ((a.getDocNumber() == b.getDocNumber())
                               && (a.getWord() < b.getWord())));
               }); // End lambda and sort.
     auto newend = ::std::unique(minipair_vec.begin(), minipair_vec.end(),
                                [](MiniPair const &a, MiniPair const &b) -> bool {
                                   return a.getDocNumber() == b.getDocNumber()
                                          && a.getWord() == b.getWord();
                                }); // End lambda and unique.
     minipair_vec.resize(newend - minipair_vec.begin());
}

I have tested it, so it should work just fine.
The general lesson is that if you find yourself looping, go through this set of questions:

*

*Am I indexing into a linear data structure? If so, why am I using indexes instead of iterators?

*Is there an algorithm that already does what I need, or can a couple of algorithms be easily composed to do what I need?

The code I presented should run in a time that's proportional to minipair_vec.size() * ::std::log2(minipair_vec.size()). The code you wrote would run in a time proportional to minipair_vec.size() * minipair_vec.size() (once you got it to work), which is a lot longer for a large list.

A: A C++98 solution:
#include <algorithm>
#include <string>
#include <vector>

struct MiniPair {
    int docNumber;
    std::string word;
    friend bool operator<(MiniPair const &a, MiniPair const &b) {
        return a.docNumber < b.docNumber || a.docNumber == b.docNumber && a.word < b.word;
    }
    friend bool operator==(MiniPair const &a, MiniPair const &b) {
        return a.docNumber == b.docNumber && a.word == b.word;
    }
};

int main() {
    std::vector<MiniPair> miniPairVector;
    // fill miniPairVector with data
    std::sort(miniPairVector.begin(), miniPairVector.end());
    miniPairVector.erase(std::unique(miniPairVector.begin(), miniPairVector.end()), miniPairVector.end());
}


text:
Q: Something went wrong in the last update I have a very big document (book, over 400 pages, a dozen chapters with a lot of tikz pictures) which used to compile OK. But last TeXlive update, something went wrong. Now the compilation gives me errors on some of my pictures (if not all).
Problem is, I didn't change anything in my class files, and I can't seem to find anything wrong in the code (which used to compile).
I wonder how I could find the problem (which, in my opinion, is some kind of conflict between tikz and another package, maybe tkz-euclide, or something else, which could be solved by putting the packages loading in the right order, or something like that).
I know my question is quite vague, but maybe someone is used to this kind of problem (big document, not possible to provide a minimum example on this site...).
Thanks for any help :-)
Edit : this is the kind of error message I receive :
Chapitre VII.
(./geometrie.mtc7) [177] [178]
Missing character: There is no = in font nullfont!
Missing character: There is no @ in font nullfont!
Missing character: There is no @ in font nullfont!
Runaway argument?
-5:-0.1,samples=200] plot ({fx1(\x )},{fy1(\x )}); \draw     [thick,blue,\ETC.
./courbesaff.tex:209: Paragraph ended before     \pgfmath@local@@functions was complete.
<to be read again>
                   \par
l.209

Missing character: There is no L in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no t in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no n in font nullfont!
Missing character: There is no g in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no n in font nullfont!
Missing character: There is no t in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no u in font nullfont!
Missing character: There is no p in font nullfont!
Missing character: There is no o in font nullfont!
Missing character: There is no i in font nullfont!
Missing character: There is no n in font nullfont!
Missing character: There is no t in font nullfont!
Missing character: There is no d in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no p in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no r in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no m in font nullfont!
Missing character: There is no  in font nullfont!
Missing character: There is no t in font nullfont!
Missing character: There is no r in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no s in font nullfont!
Missing character: There is no t in font nullfont!
Missing character: There is no d in font nullfont!
Missing character: There is no i in font nullfont!
Missing character: There is no r in font nullfont!
Missing character: There is no i in font nullfont!
Missing character: There is no g in font nullfont!
Missing character: There is no  in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no p in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no r in font nullfont!
Missing character: There is no l in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no v in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no c in font nullfont!
Missing character: There is no t in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no u in font nullfont!
Missing character: There is no r in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no t in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no p in font nullfont!
Missing character: There is no o in font nullfont!
Missing character: There is no u in font nullfont!
Missing character: There is no r in font nullfont!
Missing character: There is no  in font nullfont!
Missing character: There is no q in font nullfont!
Missing character: There is no u in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no t in font nullfont!
Missing character: There is no i in font nullfont!
Missing character: There is no o in font nullfont!
Missing character: There is no n in font nullfont!
Missing character: There is no 3 in font nullfont!
Missing character: There is no t in font nullfont!
./courbesaff.tex:213: Missing $ inserted.
<inserted text>
                $
l.213       3t^
               2(x-a t^2)-2t(y-a t^3)=0\iff 3tx-2y-a t^3=0
./courbesaff.tex:214: Missing $ inserted.
<inserted text>
                $
l.214     \end{equation*}

The "faulty code :
\begin{figure}[htbp]
  \centering
  \begin{tikzpicture}[declare function = {
      fx1(\t) = 2/\t;
      fy1(\t) = 2*\t*\t;
      fx2(\t) = 3*\t/(\t*\t+pow(4,-1/3));
      fy2(\t) = 6*pow(4,-2/3)/(\t*\t+pow(4,-1/3));
    }]
    \tikzdrawaxislabelclip{-5.2}{5.2}{-0.5}{7.2};
    \draw[thin] (1,-0.05) node[below]{$\spt1$} -- (1,0.05)
    (-0.05,1) node[left]{$\spt1$} -- (0.05,1) (0,0) node[below
    left]{$\spt O$} (0-0.05,{3*pow(4,-1/3)}) node[left]{$\spt A$} --
    (0+0.05,{3*pow(4,-1/3)});
    \draw[thick,blue,domain=-5:-0.1,samples=200] plot
    ({fx1(\x)},{fy1(\x)});
    \draw[thick,blue,domain=0.1:5,samples=200] plot
    ({fx1(\x)},{fy1(\x)});
    \draw[thick,violet,domain=-100:-10,samples=200] plot
    ({fx2(\x)},{fy2(\x)});
    \draw[thick,violet,domain=-10:-1,samples=200] plot
    ({fx2(\x)},{fy2(\x)});
    \draw[thick,violet,domain=-1:1,samples=200] plot
    ({fx2(\x)},{fy2(\x)});
    \draw[thick,violet,domain=1:10,samples=200] plot
    ({fx2(\x)},{fy2(\x)});
    \draw[thick,violet,domain=10:100,samples=200] plot
    ({fx2(\x)},{fy2(\x)});
    \draw[thin,red,domain=-5.2:5.2] plot (\x,6-2*\x);
    \draw[thin,red,domain=-5.2:5.2] plot (\x,{\x/2+6*pow(4,-2/3)});
  \end{tikzpicture}
  % \includegraphics[scale=0.75]{courbesaff.101}
  \caption{Orthoptique de l'arc paramétré $x=\frac{a}{t}$, $y=at^2$}
\end{figure}
\item \fbox{$f(t)=(a t^2,a t^3)$}

La tangente au point de paramètre $t$ est dirigée par le vecteur
$(2,3t)$ et a pour équation
\begin{equation*}
  3t^2(x-a t^2)-2t(y-a t^3)=0\iff 3tx-2y-a t^3=0
\end{equation*}

That used to compile fine. I'm getting a lot of those "Missing character in font nullfont" these days, wonder why, too.
Another error at another picture : I draw some Euler line of a triangle. I define all my points, and on the first line drawing something :
\tkzDrawLine[add= 1 and 1](A,B)

I get this error message :
./enveloppes.tex:143: Package tikz Error: + or - expected.

See the tikz package documentation for explanation.
Type  H <return>  for immediate help.
 ...

l.143       \tkzDrawLine[add= 1 and 1](A,B)

./enveloppes.tex:143: Package tikz Error: Giving up on this path.     Did you forget a semicolon?.

If someone have an idea (I know, it may be hopeless...), I would be so glad :-)

A: I finally found the problem : it was an error between tikz and babel. Adding the library babel to the tikz libraries solved it.
Sorry for the noise.


text:
Q: fully qualified name vs import statement case 1.
class A extends java.util.ArrayList
{

    public static void main(String[] args)
    {

        ArrayList a=new ArrayList();
    }

}

Here I am getting a compiletime error saying,
  cannot find symbol

  Symbol:class ArrayList

  location:class A

case 2.
class A extends java.util.ArrayList
{

}

This one is compiling successfully.
Then what's the need of extending ArrayList class? If we can't make use of it (as in case 1)?

A: Based on my understanding of your question, you would like to use fully qualified name against import.
The reason you are getting error in first case is because you missed to mention fully qualified class name while doing:
ArrayList a=new ArrayList();

Each time you are declaring ArrayList object in this scenario, you have to use fully qualified name.
Reference : https://docs.oracle.com/javase/tutorial/java/package/usepkgs.html


text:
Q: How Can i convert MPP file into CSV using Script I was trying to fetch data from MPP file , Since it is hard i was thinking about converting the MPP file into something more readable and have some library support, Is there any way to convert MPP file into CSV by script

A: There are many online converters to convert mpp to csv. One of them are MPP to CSV
Also you can visit Automate MPP to CSV for references.


text:
Q: Woocommerce: Any way to list all products *without* a specific attribute? We're going back through an existing site and adding attributes to the products, but we need a way to verify that every product has gotten them.
Is there any method or function call that will give me a list of all products missing the attribute "color"?

A: I've had to do something similar recently, create a list of all attributes by product and product variation.
I used SQL to produce the list. It's a bit basic and I'm sure could be improved easily.
SELECT  wp_posts.id,wp_woocommerce_attribute_taxonomies.attribute_id, wp_woocommerce_attribute_taxonomies.attribute_name,wp_woocommerce_attribute_taxonomies.attribute_label, wp_posts.post_type, wp_posts.post_title FROM wp_woocommerce_attribute_taxonomies,wp_posts WHERE wp_posts.post_type = 'product_variation' OR wp_posts.post_type = 'product'

I hope that helps, or points you in the right direction
Cheers
David


text:
Q: Does the order of defining a variable and using it matters in Makefile? I'm a little confused of the behavior of Makefile while working on a mini project. In Makefile, when I have
all: $(TARGETS)

TARGETS = stats

....

the make command gives "make: Nothing to be done for `all'."
When I declare the TARGETS before using it:
TARGETS = stats
all: $(TARGETS)
....

the make command compiles and works as expected.
It seems the order of defining a variable and calling that variable matters here.
But later I find:
stats: LDLIBS+=$(STATS_LIBS)
STATS_LIBS = -lm

and
STATS_LIBS = -lm
stats: LDLIBS+=$(STATS_LIBS)

both work and give the right behavior, so it seems the order does not matter anymore? How should I understand this?

A: You are seeing two distinct effects.

*

*Expansion of a reference to a macro for which currently there is no definition yields an empty string.  That fully explains your TARGETS case.

*By default, macro references in a macro's body are not expanded until the macro is used.  Thus, supposing that LDLIBS is a macro with this behavior, when make processes LDLIBS+=$(STATS_LIBS), it adds the literal characters $(STATS_LIBS) to the value of LDLIBS.  It expands that only when a reference to LDLIBS is expanded, using the definition of STATS_LIBS relevant at that time.


text:
Q: SQL Custom Grouping and Selection Query I recently asked this question here and got some great answers!
Custom SQL GROUP BY Clause
However, it turns out I provided the wrong requirements for my problem.  Sorry guys!
Sooooo.  What I need to select is:
Distinct values in the Column 'PartNumbers', however:
-->For EACH unique PartNumber, I want to select the specific ROW from that table that has the MAX VALUE of the 'PO' Column for that particular part number.
-->Also, to make life more difficult, I want to exclude the ANY of the PartNumbers who have ANY VALUE in the Column 'Receipt'
You guys have been a great help!  Much appreciated everyone!
EDIT:
Table Name: Log
Columns: ID, Supplier, PartNumber, PO, Quantity, DateReceived
Note: only the ID column is unique.

A: Using CTE:
with TableWithRowNumber as
    (select
        *,
        row_number() over (partition by PartNumber order by PO desc) as RowNo
    from MyTable)
select * from TableWithRowNumber
where RowNo = 1
and PartNumber not in
    (select distinct PartNumber from MyTable where Receipt is not null)


text:
Q: Is there any possible way to drag entire email information (.msg) from outlook and drop into web application? My web application want to move out from third party add-on for drag and drop email from outlook. Currently looking for way to do it and just want to make sure i'm on the correct track.
I had tried and test the sample in drag and drop in winForm (
http://www.codeproject.com/Articles/28209/Outlook-Drag-and-Drop-in-C but it ) and WPF Application ( how to drag and save outlook email into WPF application ) but both does not work in web application after the changes i made.
The email does not load into my web application and no error shown on the web page.
Noted : The third party software is an add-on on IE and only work on IE. That why i wanted to move out from it.


text:
Q: How to ask google password from chrome extension? I'm trying to write extension which will not allow to use chrome window where google user already authetificated.
The reason for this is that computer might be used by other person, and I don't want anyone else to use my google account, and I don't want to sign out each time.
But anyway. I was thinking to use chrome.identity.getAuthToken but this will ask current user to approve to use token for my app. Not logon (remember, chrome user already logged in!). So how can I ask user to enter using password, then send it to google, so password is checked?


text:
Q: Rename multiindex level based on other level I have a dataframe with a multiindex column, more or less like so
import pandas as pd

columns = pd.MultiIndex.from_product((("Length", "Weight"), ("Max", "Min"), ("asd",)), names=("Measure", "Info", "Unit"))
df = pd.DataFrame(0., columns=columns, index=range(2))

>>> df
Measure Length  Weight
Info    Max Min Max Min
Unit    asd asd asd asd
0       0   0   0   0
1       0   0   0   0

I would like to change the units based on the measurements. The connection between measure and unit is expressed as a dictionary:
measure_to_unit = {"Length": "m", "Weight": "kg"}

I have tried using .replace but it simply doesn't seem to be the right tool for the job.
The expected result is
Measure Length  Weight
Info    Max Min Max Min
Unit    m   m   kg  kg
0       0   0   0   0
1       0   0   0   0

A: Update
measure_to_unit = {"Length": "m", "Weight": "kg"}

l1, l2, l3 = zip(*df.columns)
newcol = pd.MultiIndex.from_arrays([l1, l2, [measure_to_unit[i] for i in l1]])
df.set_axis(newcol, axis=1)

Output:
     Length      Weight
     Max  Min    Max  Min
       m    m     kg   kg
0    0.0  0.0    0.0  0.0
1    0.0  0.0    0.0  0.0

If the order of your dataframe columns match the order of your index, then you can do this:
df.set_axis(pd.MultiIndex.from_arrays([measure_to_unit.keys(), measure_to_unit.values()]), axis=1)

Output:
  Length Weight
       m     kg
0    0.0    0.0
1    0.0    0.0


text:
Q: How do i distribute 100 users in distributed mode using jmeter with 3 slaves and 1 master machine? Lets say, we have 100 users to performance load test using distributed testing user jmeter. How do I distribute these load among 3 slaves and 1 master machine?

A: By default each JMeter slave executes the Test Plan transferred from. master individually and independently.
So if you have 100 threads (virtual users) in the Thread Group each slave will kick off 100 users and actual load will be 300 users.
If you have 100 users in total you could

*

*go for 33 users in the Thread Group and get 99 total users

*or define the number of users in the Thread Group via __P() function like:
 ${__P(users)}

this way JMeter will read the number of users from users property. In this case you can put the desired number of users into user.properties file on each slave like:

*

*on slave 1 put users=10 and it will kick off 10 threads

*on slave 2 put users=50 and it will kick off 50 threads

*on slave 3 put users=40 and it will kick off 40 threads

amend the numbers according to your needs.
More information:

*

*Configuring JMeter

*Apache JMeter Properties Customization Guide

*Apache JMeter Distributed Testing Step-by-step


text:
Q: Which of these solutions is more efficient? I am rendering a header based on a condition, if the primary nav has enough space put in inline if not put it beneath. I got it to work but I am unsure which is a better way to go about this:
1# - I split the process into two hooks, one to break the nav and one to restore it if the current header width is now bigger than the width it had when it broke.
let breakWidth;
useLayoutEffect(() => {
    const hasNavOverflown = () => {
        let navOverflow = rightNavRef.current.clientWidth < rightNavRef.current.scrollWidth;
        let headerWidth = headerRef.current.clientWidth;

        if (navOverflow) {
            setHasSpace(false);
            breakWidth = headerWidth;
        }
    };

    hasNavOverflown();
    const throttledHasNavOverflown = throttle(hasNavOverflown, 50);
    window.addEventListener('resize', throttledHasNavOverflown);

    return () => {
        window.removeEventListener('resize', throttledHasNavOverflown);
    };
}, []);

useLayoutEffect(() => {
    const restoreNav = () => {
        let headerWidth = headerRef.current.clientWidth;
        if(headerWidth > breakWidth){
            setHasSpace(true);
        }
    };

    restoreNav();
    const throttledRestoreNav = throttle(restoreNav, 50);
    window.addEventListener('resize', throttledRestoreNav);

    return () => {
        window.removeEventListener('resize', throttledRestoreNav);
    };
}, []);

2# - I use the same hook for both operations.
useLayoutEffect(() => {
    let breakWidth;

    const hasNavOverflown = () => {
        let navOverflow = rightNavRef.current.clientWidth < rightNavRef.current.scrollWidth;
        let headerWidth = headerRef.current.clientWidth;

        if (navOverflow) {
            setHasSpace(false);
            breakWidth = headerWidth;
        }
    };

    const restoreNav = () => {
        let headerWidth = headerRef.current.clientWidth;
        if(headerWidth > breakWidth){
            setHasSpace(true);
        }
    };

    hasNavOverflown();
    const throttledHasNavOverflown = throttle(hasNavOverflown, 50);
    window.addEventListener('resize', throttledHasNavOverflown);

    restoreNav();
    const throttledRestoreNav = throttle(restoreNav, 50);
    window.addEventListener('resize', throttledRestoreNav);

    return () => {
        window.removeEventListener('resize', throttledRestoreNav);
        window.removeEventListener('resize', throttledHasNavOverflown);
    };
}, []);

A: I believe using separate hooks is more efficient than using the same hook because of the following reasons:

*

*You can easily keep the track of changes that are being done separately which will ultimately help to debug the code easily in the future.

*Code readability is also very important, I believe one's code should be as easily readable as possible so that even a newbie finds it easy to understand.


text:
Q: Match data tables in 2 sheets & pull data from column in 2nd sheet I want to pull the data from a column if it matches the data of 2 cells in a table in sheet 1 & data in a table in sheet 2. For example, if c2 & d2 in sheet 1 matches the cells in column b & c on sheet 2 then pull data that is in cell of column f. The tables do have headings.

A: Column B                     Column C            Column F
Parish Name                   City              Families
St. Mary Parish               Aleppo                78
St. Joseph Parish             Andale                448
St. Vincent de Paul Parish    Andover               1118
Sacred Heart Parish           Arkansas City         338
St. Joseph Parish             Arma                  103
St. James Parish              Augusta               482
St. Joseph Parish             Baxter Springs        28
Holy Name of Jesus Parish     Bushton               57

The above are in sheet2
in sheet1 if in B2 you have the Parish Name
and in C2 you have the City
in D2 write this formula:
=IFERROR(INDEX(Sheet2!$F$2:$F$9,MATCH(Sheet1!C2&Sheet1!D2,Sheet2!$B$2:$B$9&Sheet2!$C$2:$C$9,0)),"")

press Ctrl+Shift+Enter instead of just Enter it is an array Formula
change B2:B9 and C2:C9 to correspond the last Row in your Data and keep $ for fixed references and you will have the Families


text:
Q: balance calculation I have a table in which 5 column

accno  valuedate withdra diposits balance paymentaltkey
1     2015-01-01  25000    0     25000    0
1     2015-01-02  500      0      25500     1
1     2015-01-03   0      1000    24500   2
1     2015-01-03  2000      0     26500    0
1     2015-01-04   0      1000     25500    2
1     2015-01-05  2000      0     27500    1
1     2015-01-06   4000     0     29500    0

Now I need to calculate new balance in which if paymentaltkey = 1 then we don't add withdra in balance. If paymentaltkey = 2 then we don't substract deposit.
How to create new balance output like this:

accno  withdra diposits balance payme    newbalace
1       25000      0      25000    0       25000
1         500      0      25500    1       25000
1           0   1000      24500    2       25000
1        2000      0      26500    0       27000
1           0   1000      25500    2       27000
1        2000      0      27500    1       27000
1        4000      0      29500    0       31000
1           0   1000      25500    0       30000

A: First you need to have a column that describes the order of the records, otherwise you can't really calculate anything. Then just do a running total with case statement, something like this:
select *,
  sum(case when paymentaltkey = 1 then 0 else [withdra] end
    - case when paymentaltkey = 2 then 0 else [diposits] end)
         over (partition by [accno] order by yourorderingcolumn) as [newbalace]
from
  yourtable

This is for SQL Server 2012+, if you're using older version, just check how to do a running total.


text:
Q: When the definition of a set starts to matter in category theory In most introductory courses to category theory, the precise definition of a set is more-or-less ignored. The idea being that all basic results in the subject hold for any reasonable definition of a set.
At some point one feels that this must cease to be the case. So what is the simplest (a simple) example of a categorical concept or result that actually relies on the details of the definition of a set that one is using?

A: I didn't have time to write up a proper answer on initially seeing your question and much of what I have to say has been said in the comments and Tim's answer, but I'll still offer some specifics on things mentioned in the comments.
The definition of a set is, as Tim Campion pointed out, the axioms of whatever set theory you're working in.  They do not so much define a set as describe a primitive notion that behaves like what we think sets should behave like, with different axiomatizations giving rise to differing notions of set.
These differing axiomatizations do have an impact on category theory because they change the behavior of ${\bf Set}$, and consequently the behavior of presheaf categories, and they also impact our ability to manipulate large categories. As mentioned by Ingo Blechschmidt in the comments, Mike Shulman has an excellent paper surveying some of these consequences. I will summarize some of them here, but I highly recommend you check out his paper.
A striking result referenced in the Shulman paper is due to Colin McLarty, establishing that the NF axiomatization of what a set is yields a ${\bf Set}$ that isn't Cartesian closed.
In ZFC we really only run into issues if we want to manipulate large categories as a whole, for example ${\bf Set}$ or ${\bf Group}$, which are not actually objects in ZFC since they're proper classes. We can get around this with shenanigans about formulas the metalanguage, but anyone looking for an integrated and 'natural' treatment of large categories on level footing with small ones will be disappointed in this setting.
NBG is a conservative extension of ZFC (meaning it doesn't prove anything about sets that ZFC can't) which does allow proper classes to be real objects in the theory, but we still run into some discomfort when dealing with large categories. NBG manages to be conservative over ZFC by restricting it's comprehension axiom to only apply to sets, not proper classes -- in practical terms, as Mike points out in his paper linked above, this means (for example) that we can't prove by induction that a large category $\mathcal{C}$ has an $n$-fold Cartesian product $\mathcal{C}^n$. We can get around this by constructing it directly as the category of functions from $n$ into $\mathcal{C}$, but the unavailability of canonical proof methods like induction is troubling.
MK is a non-conservative extension of ZFC, essentially NBG but with full class comprehension allowed so we have access to all of the standard proof tools for large categories. This new theory can prove things ZFC can't, like the consistency of ZFC, and is thusly strictly stronger in a meaningful sense. MK also has its own serious issues when working with large categories -- we can't define the category of functors between two large categories, and this applies to NBG as well.
Using full MK further suggests that we try to look at the category of classes, since they're really the category of collections we want to work with right? And bam, once again we're back to a situation where we have to play games in the metalanguage, or conservatively extend/step up the consistency strength of our theory. This leads mathematicians to situations like Grothendieck universes, where it's always possible to step up to the next universe if we need to talk about 'all the somethings' in the current universe. This is equivalent to working in ZFC plus an axiom asserting the existence of an inaccessible cardinal.
All the extra baggage of universes or inaccessibles is still somewhat of a sledgehammer for the problem at hand, though; all we want is for large categories to 'be like small categories' in enough ways that we can carry out all the constructions we care about with large categories, but inaccessibles or Grothendieck universes also have a plethora of other consequences (like the need to juggle universes1). A solution to these problems comes in the form of reflection principles, which are essentially axioms asserting that proper classes look enough like sets that we don't have to soil ourselves when they appear, but don't endow them with enough independence to give rise to a whole hierarchy of universes we need to ask questions about. All of this is discussed at length in the Shulman paper referenced above, with additional references therein.
First paper: Shulman, Mike. Set theory for category theory. arXiv:0810.1279v2 [math.CT]
Second paper: McLarty, Colin. Failure of Cartesian Closedness in NF. J. Symbolic Logic 57 (1992), no. 2, 555--556. https://doi.org/10.2307/2275291

1As Tim points out in the comments, how many universes we have to juggle when taking this route is up to us. Skilled jugglers may use an infinite number, while those new to the approach may use only two.

A: To consolidate a clarification from the comments:

In mathematics as normally practiced, there is no such thing as a "definition" of the notion of set. There are various axiomatic theories one can use to reason about objects which we call "sets" (or think of as "set-like"), such as ZFC, ETCS, type theory, etc. But in these theories, "set" is typically a primitive, undefined notion. This is much as in classical Euclidean geometry, where the terms "point", "line", etc. are undefined, but we have well-defined rules for reasoning about them. The only place you would "define what a set is" is if you were constructing a model of one of these theories -- then you have to define what the model is going to say a "set" is, relative to whatever metatheory you're using.

But I think the larger question is -- "when does one have to worry about set-theoretic details when doing category theory?" The question is a bit ill-defined, but maybe there are a few things to say anyway:

*

*The most prominent "set-theoretic consideration" in category theory is that of size. When doing category theory, it's important to develop a sense for which "set-like things" one considers are actually sets, and which ones are "too big to be sets" -- i.e. are actually proper classes [1]. Two theorems of basic category theory come immediately to mind -- both due to Freyd:

*

*Any small category with all small products is a preorder. This theorem tells us that if we want to work with completeness conditions in category theory, then we really have to live with the fact that there's a difference between large and small.

*The adjoint functor theorem crucially requires that certain collections appearing in the hypotheses be small (i.e. that they be sets rather than proper classes). The standard counterexample is: for each cardinality $\kappa$, let $G_\kappa$ be a simple group of cardinality $\kappa$, and define $F: Grp \to Set$ to be the functor $G \mapsto \prod_\kappa Hom(G_\kappa,G)$. This functor preserves limits, but has no left adjoint.

*

*There are also "set-theoretic considerations" which are really just an annoyance. For instance, for most purposes it doesn't matter whether, say, the category $Ab$ of abelian groups is skeletal or not (because $Ab$ is equivalent to any of its skeleta, which are all isomorphic -- there is nothing special about $Ab$ here). But sometimes you might want to do something like take the product of all countable abelian groups. When you do this, it technically matters -- if $Ab$ is skeletal, this is a perfectly well-defined small abelian group, whereas if $Ab$ is defined as usual in ZFC say, there is a proper class of countable abelian groups (though just a small number of isomorphism classes). So to perform this construction in usual set theory, you should probably say something like "the product of one copy from each isomorphism class of countable abelian groups" and then proceed as you would have otherwise.

[1] In this post, I will use the language of a set / class distinction to talk about size. There are also other approaches, most notably the approach of using one or more Grothendieck universes. In the Grothendieck universe approach, there are no proper classes -- everything is a set. It's just that some sets are "small" while others are "large".


text:
Q: declaring user function with default non-value parameters At declaring user function with default non-value parameters, what way is better, define parameters as false or as NULL ?
that is,  what is better, this
 function func ($param = false) {

 }

or this
 function func ($param = NULL) {

 }

?

A: This would be better:
function func ($param = NULL) {

}

A "default non-value" parameter should be NULL, not false. False is a value. If you intend to test the parameter for its value or perform any operation on/with it, I would go with false.

A: We can also use
function func ($param = "") {

}


text:
Q: No input file specified in laravel Spatie I'm trying to save laravel database backup, my cron command is:
cd /home/user/foldername/ && php artisan schedule:run >> /home/user/cron.out

Kernel:
 $schedule->command('backup:clean')->daily()->everyMinute();
 $schedule->command('backup:run')->daily()->everyMinute();

when cron is run i get

No input file specified. Status: 404 Not Found X-Powered-By:
PHP/7.3.26 Content-type: text/html; charset=UTF-8

in the cron.out file, I have saved public folder content in public_html folder rest of the files are in root.


text:
Q: Unity. Проблема с заполнением массива Написал код, который должен заполнять стринговый массив с клавиатуры через поле ввода.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Game : MonoBehaviour
{
    public GameObject Question;   // Сцена с полем ввода
    public GameObject Answer;     // Сцена с введённым текстом

    public InputField PoleVvoda; // Поле ввода

    public Text ShowText;    // Выводимый текст

    public string[] QuestionsArray = new string[20];  // Стринговый массив

    public void Confirm ()
    {
        Question.SetActive(false);     // Выключает сцену с полем ввода
        Answer.SetActive(true);        // Включает сцену с введённым текстом
        ShowText.text = PoleVvoda.text + ("?");     // Добавляет к введённому тексту знак вопроса
        for (int i = 0; i < 20; i++)         // Массив состоящий из 20 элементов
        {
            QuestionsArray[i] = ShowText.text;     // Должен присваивать каждому элементу свое слово
        }
        PoleVvoda.text = string.Empty;  // Очистка строки ввода
    }

Запускаю приложение, ввожу слово, а он присваивает введённое слово всем элементам.

Когда присваиваю через код, все отображается нормально, а через клавиатуру - никак.
Как сделать так, чтобы было поочередное присваивание? Если, что не бейте D:

A: Вы берете одну строку и циклом вставляете ее во все элементы массива, в этом и проблема.
Я полагаю вам нужно что то такое. После каждого нажатия происходит одна вставка в массив, _curIndexQuestionsArray это текущий индекс для массива. Я предусмотрел элементарную защиту от переполнения _curIndexQuestionsArray, через его обнуление. Вам возможно это нужно реализовать как то по другому.
    private int _curIndexQuestionsArray;
    public string[] QuestionsArray = new string[20];  // Стринговый массив

    public void Confirm ()
    {
        Question.SetActive(false);     // Выключает сцену с полем ввода
        Answer.SetActive(true);        // Включает сцену с введённым текстом
        ShowText.text = PoleVvoda.text + ("?");     // Добавляет к введённому тексту знак вопроса
        if(_curIndexQuestionsArray >= QuestionsArray.Length)
            _curIndexQuestionsArray = 0;
        QuestionsArray[_curIndexQuestionsArray] = ShowText.text;
        _curIndexQuestionsArray++;
        PoleVvoda.text = string.Empty;  // Очистка строки ввода
    }


text:
Q: Why kendo Grid is not generating any html output and no serverside/clientside errors? I have this kendo grid in one of my views:
@model IEnumerable<IJRayka.Core.Utility.ViewModels.OrderDto>
@using IJRayka.Core.Web.Code
@{
    ViewBag.Title = "Order List";
}

Order List

    @{
Html.Kendo().Grid(Model).Name("grid").Columns(columns =>
    {
        columns.Bound(ord => ord.CustomerName);
        columns.Bound(ord => ord.MarketerName);
        columns.Bound(ord => ord.OrderDate);
        columns.Template(ord => ord.CurrentStatus.GetDisplayName());
        columns.Bound(ord => ord.PaymentMethod);
        columns.Bound(ord => ord.Description);
        columns.Command(cmd => cmd.Edit().Text("ویرایش"));
        columns.Command(cmd => cmd.Select().Text("مشاهده"));
        columns.Command(cmd => cmd.Destroy().Text("حذف"));

    }).DataSource(ds => ds.Server()
        .Model(m => m.Id(ord => ord.ID))
            .Create(create => create.Action("Create", "OrderManagement"))
            .Read(read => read.Action("Details", "OrderManagement"))
            .Update(update => update.Action("Edit", "OrderManagement"))
            .Destroy(destroy => destroy.Action("Delete", "OrderManagement"))
        ).Pageable().Sortable()
    .ToolBar(toolbar => toolbar.Create().Text("ایجاد سفارش"))
    .Selectable(selectable => selectable.Mode(GridSelectionMode.Single)));
}

When I debug, I see there is 4 items in the Model collection, but I don't know why without any errors, the grid won't show up at all. Not a single HTML tag is generated on client side, and there's no errors shown in the firebug console.
It was working great before, but all of a sudden, after some changes to my model I don't know what happened to it.
EDIT:
I just realized if I write this all lines, in one single line it works !
But I don't understand why?

A: When you are using the construct @{ .. } then you are in a code block in razor. And inside in a code block nothing gets written to the response by default.
You need to use @ to output something to the output or you need to use some special methods like Render() on the Grid.
So the following invocations are all working:
Using Render on any Kendo Widget:
@{
    Html.Kendo().Grid(Model).Name("grid").Columns(columns =>
    {
      //...
    })
    .Selectable(selectable => selectable.Mode(GridSelectionMode.Single)))
    .Render(); //Render method provided by Kendo UI.
}

Using @:
@{
    @(Html.Kendo().Grid(Model).Name("grid").Columns(columns =>
    {
      //...
    })
    .Selectable(selectable => selectable.Mode(GridSelectionMode.Single))))
}

Or if you anyway have this one statement in the code block don't use the code block at all just write:
@(Html.Kendo().Grid(Model).Name("grid").Columns(columns =>
{
    //...
})
.Selectable(selectable => selectable.Mode(GridSelectionMode.Single))))

Note: if youe have a multiline statement after the @ you need to wrap the whole statement with an extra set of parens (())


text:
Q: The TextField on Paper closes unexpectedly in Material UI In a Project, I have list of countries with its specific country codes. In order to search the countries and their codes I have created TextField on Paper(Material UI component). When clicked on it closes unexpectedly. See the code below for reference.
<TextField
          id="standard-select-currency"
          select
          value={countryCode}
          onChange={handleChange}
          SelectProps={{
            renderValue: (value) => value
          }}
        >
          <Paper style={{ width: "280px" }}>

             {/* Here this component closes when clicked on it */}
              <TextField
                placeholder="Enter Your Country"
                onChange={onChange}
                type="text"
              />

            {Object.values(countryData).map((values, i) => (
              <MenuItem key={values.calling_code} value={values.calling_code}>

{values.country}

{"+" + values.calling_code}

              </MenuItem>
            ))}
          </Paper>
        </TextField>

What could be best possible solution to prevent it from shutting down?
Codesandbox Link: https://codesandbox.io/s/material-demo-forked-hfwb4

A: just add,
<TextField
                placeholder="Enter Your Country"
                onChange={onChange} onClick={(event)=>event.stopPropagation()}
                type="text"
              />
it will

it will not close unexpectedly.


text:
Q: Spring ThreadPoolTaskExecutor shutdown with Async task I'm excuting an Async task using spring task execution framework.
Doing so I annotated my method with the @Async annotation and added the following to my XML based application context:
<!-- async support -->
<task:annotation-driven executor="myAsyncExecutor" />
<task:executor id="myAsyncExecutor" pool-size="5-10" queue-capacity="100" />

Wondered in this case - how does the shutdown method of this executor gets invoked? I would like to make sure my app doesn't wait forever for this threadPool.
I could (instead of using the task namespace) define my executor as a bean and then set its destroy-method to "shutdown" but wondered regarding the task namespace definition style.
Any ideas?

A: Internally spring uses org.springframework.scheduling.concurrent.ThreadPoolTaskExecutorfor namespace of task:executor.  If you look at the relevant source code (which is inherited) the shutdown on the executor is invoked at bean destroy; so no need to worry.


text:
Q: Failed to show XML Data with PHP Script I have about 60000 xml files that i have to insert into a MySQL database. so i thought about making a simple php script that would be executed for once to load data from this xml files and insert it into my db on a localhost.
Before inserting it into my DB i tried to show them on the data on the page but it shows nothing, and its type is NULL.
here is the code :
<?php
$dir = new DirectoryIterator('organismes');
foreach ($dir as $fileinfo) {
   if (!$fileinfo -> isDot()) {
         $XMLFILE = $fileinfo -> getFilename();
         echo $XMLFILE . "
\n"; /*the filename shows correctly, so the DirectoryIterator is working*/
         $pathtofile = "http://localhost/www/organismes/$XMLFILE"; /*the link to the xml file made with a variable*/
         echo $pathtofile . "
\n"; /* the link shown is correct */
         $xml = simplexml_load_file($pathtofile);
         echo gettype($xml) . "
\n";
         if ($xml == FALSE) {
                echo "failed to load xml"; /* this message never shows so the xml file   loads correctly */
         } else {
                $Org = $xml->Organisme->Nom; //this variable $Org gets a NULL Value
                echo $Org . "
" ;
                echo gettype($Org);
         }
   }
}
?>

when i used a print_r($xml), it shows some data so the file loads correctly.
and here is an example of the xml file that i have :
<Organisme id="adil-01053-01" codeInsee="01053" dateMiseAJour="2013-02-27" pivotLocal="adil">
<Nom>Agence</Nom>
<EditeurSource>A2 A3</EditeurSource>
<Adresse type="géopostale">
<Ligne>34, rue du Général-Delestraint</Ligne>
<CodePostal>01000</CodePostal>
<NomCommune>Bourg-en-Bresse</NomCommune>
<Localisation>
<Latitude>46.196535</Latitude>
<Longitude>5.2191997</Longitude>
<Précision>6</Précision>
</Localisation>
<Accessibilité type="ACC"/></Adresse>
<CoordonnéesNum>
<Téléphone>00000000000</Téléphone>
<Télécopie>00000000000</Télécopie>
<Email>adil.01@wanadoo.fr</Email>
<Url>http://www.adil01.org</Url>
</CoordonnéesNum>
 <Ouverture><PlageJ début="vendredi" fin="vendredi"><PlageH début="09:00:00" fin="17:00:00"/></PlageJ><PlageJ début="lundi" fin="jeudi"><PlageH début="09:00:00" fin="18:00:00"/></PlageJ>
</Ouverture>
</Organisme>

so i am trying to figure it out why it doesn't show correctly and why it gets a NULL Value
So brothers if you can help that would be wonderful :)

A: $pathtofile = "http://www.w3schools.com/xml/note.xml";
$xml = simplexml_load_file($pathtofile);
if ($xml == FALSE) {
    echo "failed to load xml";
}
else
{
    $A = $xml->to;
    echo "$A
";
}

Focusing on just that part of the code, it seems to work correctly. Either one of two things are happening. The "$xml->Organisme->Nom;" has a spelling error and/or the xml file being pulled does not include those field names.
For testing do
print_r($xml);

right after
echo "$A
";

to get an accurate representation of the xml file being pulled.
Hope this helps.

A: I am not exactly sure what you want but I assume you want to insert XML data into your database. If that's the case, try this:
function create_xml()
{

    $xml = simplexml_load_file("file.xml");

    $nodes = new SimpleXMLElement('file.xml', null, true)
             or die("cannot create");

    $i = 0;

    foreach ($nodes->children() as $child)
    {

             $var= $child->xml_child;

              $sql = "INSERT INTO ...)";

              mysqli_query($connect, $sql);

             $i++;

             echo "xml set";

    }

}


text:
Q: Script does not work intendedly This script (for Greasemonkey) doesn't work intendedly.
I want to insert an script, and after the script loaded, replace text "Download" to Japanese word (I will use "TEST" instead.).
(function() {
    if ((document.URL.match("www.youtube.com/watch?"))||(document.URL.match("c.youtube.com/videoplayback?"))) {
    var head = document.getElementsByTagName('head')[0]; //Working
    var script = document.createElement('script'); //Working
    script.type = 'text/javascript'; //Working
    script.src = 'http://userscripts.org/scripts/source/25105.user.js'; //Working
    script.onload = 'document.getElementsByClassName("yt-uix-button-content")[0].innerHTML.replace("Download","TEST")'; //Not working.
    head.appendChild(script); //Working
};})();

What is the problem?

A: You have to make sure that the elements are already loaded.
Which means, after body content is loaded you can query elements in the body.
This leads to the following solution.
on the BODY tag you have to add the following
<body onload="myOnloadFunc()">

then you have to create the myOnloadFunc as follows:
<script type="text/javascript>
function myOnloadFunc () {

  // in here you should place the original code you have created.

  if ((document.URL.match("www.youtube.com/watch?"))|| (document.URL.match("c.youtube.com/videoplayback?"))) {
     var head = document.getElementsByTagName('head')[0]; //Working
     var script = document.createElement('script'); //Working
     script.type = 'text/javascript'; //Working
     script.src = 'http://userscripts.org/scripts/source/25105.user.js'; //Working
     script.onload = 'document.getElementsByClassName("yt-uix-button-content")[0].innerHTML.replace("Download","TEST")'; //Not working.
     head.appendChild(script); //Working
}
</script>


text:
Q: Laravel Eloquent Query Where nested relationship I am new to laravel and i am trying to write a query whereby the selected stock->OrderProduct->product_id is passed to get the relevant result. The query looks like this :
$stock = Stock::where('orderProductid.product_id', $pharmacyEvent->prescription->product_id)
                ->whereHas('orderProduct.product.prices')
                ->with(['orderProduct.product.price' => function ($query) use ($paymentMode) {
                    $query->where('scheme_id', $paymentMode->scheme_id);
                }])->first();

            $price = $stock->orderProduct->product->price;

This doesnt work as it is bad practise and i rewrote the query like below, which brings me wrong results.
$stock = Stock::whereHas('orderProduct.product.prices')
        ->with([
            'orderProduct.product' => function ($query) {
                $query->where('id', $pharmacyEvent->prescription->product_id);
            },
            'orderProduct.product.price' => function($query) {
                $query->where('scheme_id', $paymentMode->scheme_id);
            }
        ])->first();

Any advise on eloquent methods to use when i want to pass a condition based on relationships in a query will be highly appreciated. I am using lavel 5.8

A: I used whereHas :
$stock = Stock::whereHas('orderProduct.product', function($query) use ($pharmacyEvent) {
                    $query->where('id', $pharmacyEvent->prescription->product_id);
                })
               // ->whereHas('orderProduct.product.prices')
                ->with(['orderProduct.product.price' => function ($query) use ($paymentMode) {
                    $query->where('scheme_id', $paymentMode->scheme_id);
                }])->first();

            $price = $stock->orderProduct->product->price;


text:
Q: Do I need to manually repartition a big csv file when I read it with spark.read I have a big CSV file on my local disk 10GB (no HDFS).
I read it with:
val df = spark.read.format("csv").load("file:///data/big.csv")

Do I need to repartition (or manually split) it before doing some transformations or actions on it or does spark dataframe will do this for me automatically?
When I was using RDD I needed to repartition it to get more than 1 core working on it but with DF I do not know.
Thanks

A: Spark by default created 200 shuffle partition. So you don't need to do it manually.  However to improve performance you can choose to repartition data. However make sure that it will do the full shuffle of table data.


text:
Q: Add folder to finder favorites programmatically I'm trying to find a way to add a folder to the favourites sidebar in finder.
Was hoping there was a way to do it via terminal or automator somehow so I can replicate it across several machines.


text:
Q: Assigning a 'Y/N' for each StudyId I am using SQL Server 2016.
I am working on assigning a 'Y' or 'N' to a column GLP with the following condition:

*

*a 'Y' if one of the GLP values = 'FDA'. It is possible that one StudyId has GLP = FDA but then have GLP = not applicable as well but most won't fall into this category. In this instance, it would still be a 'Y' since it has 'GLP - FDA'.

I have this code which successfully gets the GLP types and assigns a 'Y' or 'N' for each study:
SELECT DISTINCT
    StudyId,
    GLP = CASE
              WHEN GLP IN ('non-GLP', 'Not Applicable')
                   OR GLP IS NULL
                  THEN 'N'
                  ELSE 'Y'
          END
FROM
    AgenciesTable

This code returns:

StudyId
GLP

123456
Y

123456
N

456789
N

123456
Y

I want:

StudyId
GLP

123456
Y

456789
N

But I am lost as to what I would do to get just one 'Y' or one 'N' per StudyId with the conditions I have above. I have tried doing a subquery which would be something like:
SELECT
    StudyId,
    COUNT(GLP) AS TOT = CASE
                            WHEN TOT >= 2 THEN 'Y'
                            ELSE 'N'
                        END
FROM
    (SELECT DISTINCT
         StudyId,
         GLP = CASE
                   WHEN GLP IN ('non-GLP', 'Not Applicable')
                        OR GLP IS NULL
                       THEN 'N'
                       ELSE 'Y'
               END
     FROM AgenciesTable AT)

No luck with the above but I feel I am headed in the right direction. Not sure what to do to advance this. I might be missing something simple or overthinking this but I cannot for the life of me, figure it out.
Any help, clarification or general ideas are appreciated. Thanks!

A: Why not use a conditional aggregation ?
Example
SELECT StudyId
      ,GLP = max( CASE WHEN GLP IN ('non-GLP', 'Not Applicable') OR GLP IS NULL THEN 'N'  ELSE 'Y'  END)
FROM AgenciesTable
Group By StudyId

Results
StudyId GLP
123456  Y
456789  N