text:
Q: How to insert empty line in array environment with custom delimiter `@{...}`? I am using the array environment with \begin{array}{l@{::=}ll} to typeset a formal grammar:

How can I insert an empty line without my delimiter ::= appearing there?
Minimal working example:
% !TeX TS-program = xelatex
% !TeX encoding = UTF-8
% !TeX spellcheck = en_US
\documentclass[]{article}
\usepackage{amsmath}
\begin{document}

\[
    \begin{array}{l@{\quad::=\quad}l@{\quad}l}
        T   & \varepsilon \mid \mathrm{leaf} \mid \mathrm{bin}(T, T) & \text{trees}\\
        \\
        F   & \varepsilon \mid F, T                                  & \text{forests}
    \end{array}
\]

\end{document}

A: You can simply use an empty \multicolumn, as its column specifications override the specifications of the tabular/ array it is inserted in.:
\documentclass[]{article}
\usepackage{amsmath}

\begin{document}

\[
    \begin{array}{l@{\quad::=\quad}l@{\quad}l}
        T & \varepsilon \mid \mathrm{leaf} \mid \mathrm{bin}(T, T) & \text{trees}\\
       \multicolumn{1}{c}{} & &\textit{Fiddle dee dee }\\\\
        F & \varepsilon \mid F, T & \text{forests}
    \end{array}
\]

\end{document}

A: Some suggestions and observations:

*

*Instead of inserting a not-so-empty line in the array via a \\ directive, just increase the amount of vertical skip after the first \\ directive by, say, 3ex.

*Setting an explicit intercolumn whitespace amount of \quad is redundant in most document classes, i.e., in all those document classes which set the value of \tabcolsep to 6pt and the value of \quad to 12pt. Unless specified otherwise, intercolumn whitespace amounts to 2\tabcolsep.

\documentclass{article}
\usepackage{amsmath} % for "\text" macro
\begin{document}
\[
    \begin{array}{ l @{\quad::=\quad} l l }
        T   & \varepsilon\mid\mathrm{leaf}\mid\mathrm{bin}(T, T) & \text{trees}\\[3ex]
        F   & \varepsilon\mid F, T                               & \text{forests}
    \end{array}
\]
\end{document}


text:
Q: How to distribute a custom Ohai plugin I'm writing an Ohai plugin to add some custom attributes to be used by the chef-client. Where do I include the plugin.rb file?
Is it inside the cookbook?
Or do I have to copy it to some standard place?
Chef docs and other tutorials don't offer much on this information (or I must have missed a huge obvious fact). I know in Puppet you can include the custom facts in lib/facter/ folder of the module. Is it the same in chef?

A: This is not as hard as it sounds but I agree that the documentation on Ohai 7 lacks the bit of information that was present in the Ohai 6 docs.
However, the ohai resource and the ohai cookbook are what you are looking for. An example of using that can be found in a recipe of mine.
Basically, you first have to put the plugin's .rb file into Ohai's plugin path (node[:ohai][:plugin_path]) and then reload Ohai in order to make the attributes available in the current chef run:
ohai "reload" do
  action :reload
end

template "#{node[:ohai][:plugin_path]}/myplugin.rb" do
  notifies :reload, "ohai[reload]"
end

A: For all the time the workflow of using custom ohai plugins changed many times. That's chef. This is normal for chef!
First ensure that you are using latest ohai cookbook (currently 5.2.0)
If you use chef-server you can does this as follows:
knife cookbook site download ohai
cd ~/you/cookbooks/folder
tar xzf ohai-5.2.0.tar.gz
rm ohai-5.2.0.tar.gz
knife cookbook upload ohai

On the official site there is no cases how to use custom plugins.
Suppose you already have a plugin (ohai version 7) to deploy.
Include it in any application/wrapper cookbook you want following recipe:
ohai_plugin 'myplugin_status_ohai_plugin'

And puts in you application/wrapper cookbook a file with you plugin code in files/default/myplugin_status_ohai_plugin.rb. And that's all. By default you plugin will be installed to a directory named 'plugins' under the directory 'ohai' in the Chef config dir. Install and plugin collecting data function will be triggered at compile time.
If you do not specify /etc/chef/ohai/plugins as additional path in chef-client configuration is will be warn. But /etc/chef/ohai/plugins will be used by default.
To get rid of warning, use chef-client cookbook, recipe chef-client::config, node variable node['ohai']['plugin_path'] as additional path to load Ohai plugins from.

redpajama_set_name: RedPajamaStackExchange


text:
Q: HTML PHP get select value in same page I have a question about HTML select form.
I have 5 select forms something like following picture.

You have to select from the first select form, and then the second select form will display the lists by value select from the previous select form.
The lists are getting from MYSQL.
How should I perform above function?

A: You can accomplish this by wrapping a jQuery.ajax call inside of a .change() listener on each of the drop downs.
The ajax call would hit a PHP file that would execute the MySQL queries and return the HTML to generate the list on the next dropdown.
I would start here.
https://api.jquery.com/jQuery.ajax/
https://api.jquery.com/change/
This should get you started, If you need help along the way just post a comment or edit your question above to provide more information and I would be happy to help.


text:
Q: How do you change the automatically created password? I've got a Cloudant service that is associated with my Bluemix app. When it was setup, a username/password combo was created automatically. I accidentally shared the credentials (it is just a demo), so now I want to change the password. As far as I can see, there is no way to actually change the password - either on the dashboard or the site itself. Where is this done?

A: There is no UI to change your credentials. You can contact support. I recommend you create a new instance, use the Replication tab in the Cloudant console to migrate your database, and then delete the old one.

A: Service credentials are usually created by binding the service instance to an application. Not every service broker works this way, but most do. Simply unbinding the service:
cf unbind-service myapp myservice-instance

And then rebinding:
cf bind-service myapp myservice-instance

Should result in new credentials being generated to the same service instance. Since you can bind a service to multiple applications, each application generally gets different credentials (depending on the service broker implementation).


text:
Q: The ± sign in square root As I was doing a SAT question when I came across this question:
$\sqrt {x-a} = x-4$
       If $a=2$,what is the solution set of the equation?
Options

*

*{$3,6$}

*{$2$}

*{$3$}

*{$6$}     Correct Answer

I evaluated the equation and got $0=(x-3)(x-6)$If you put those number in the equation, you should get:
For 3:
$\sqrt {3-2} = 3-4$
Since $\sqrt {1} = ±1$
$±1 = -1$
For 6:
$\sqrt {6-2} = 6-4$
Since $\sqrt {4} = ±2$
$±2 = 2$
For the answer, they(SAT) evaluated $\sqrt {1}$ as $\sqrt {1} = -1$ and $\sqrt {4}$ as $\sqrt {4} = 2$ Why is it that $\sqrt {1}$ is equal to $-1$ and not $1$ and why $\sqrt {4}$ is equal to $2$ and not $-2$ Why isn't the solution set {$3,6$} a correct answer?

A: The standard way to solve equations with square roots is to use this rule:
$$ \sqrt A=B\iff (A=B^2\quad\textbf{and}\quad B\ge 0). $$
So here you obtain
$$\sqrt{x-2}=x-4\iff x-2=x^2-8x+16\;\text{and}\; x\ge 4\iff(x-3)(x-6)=0\;\text{and}\; x\ge 4,$$
which shows there's only one root: $6$.

A: The square root sign over a real number always denotes just the nonnegative square root. There's no $\pm$. If you square an equation with a square root in it you run the risk of allowing an extraneous solution.
In this example, $\sqrt{3-2} = 1 \ne 3-4$ .
There are many questions on this site with this answer, It was just easier for me to write it than to find them.

A: By definition $\sqrt{}$ is always the non-negative root.  Every positive number has exactly two square roots equal in magnitude, on positive and one negative.
$\sqrt{25} =5$ and $\sqrt {25} \ne -5$.  But both $5$ and $-5$ are solutions to $x^2 = 25$.
To solve an equation $x^2 = k$ there will be two answers.  One is $\sqrt k$ and $\sqrt k > 0$ and the other is $-\sqrt{k}$ and $-\sqrt {k} < 0$
So if you try to solve an equation by "squaring both sides", you will be changing the equation to allow for two different square roots that were not part of the original problem.  This is called superfluous solutions.
So to solve
$\sqrt {x-2} = x- 4$
Is not just to solve $x-2 = (x-4)^2$ but is to ALSO solve $x - 4 \ge 0$.
So you did $\sqrt{x-2}^2 = (x-4)^2$.  But that adds in the negative solution as well.
$x^2 - 8x + 16 = x-2$ and $x^2 - 9x + 18 = (x-6)(x-3)$ so both of those solve $x-2 = (x-4)^2$ but only one of them solve $\sqrt{x-2} = x-4$. (Because we must have $x-4 \ge 0$.)
$\sqrt{6-2} \overset?= 6-4$
$\sqrt{4} \overset?= 2$
$2 \overset \checkmark = 2$ check.  $6$ is an answer and $6-4 > 0$.
$\sqrt{3-2} \overset?= 3-4$
$\sqrt{1} \overset?= -1$
$1 \ne -1$. No!  $\sqrt{1} = 1$.  $\sqrt{1} \ne -1$.   And $3-2 < 0$.

A: You factored it correctly, but your mistake is considering both roots of $x$. When we say $\sqrt{x}$, we refer to the principal root of $x$; that is, the $positive$ square root of $x$  (issue in red, corrections in blue):
For 3:
$\sqrt {3-2} = 3-4$
$\sqrt {1} = \color{red}{±}1$
$\color{blue}{\sqrt {1} = -1}$
$\color{blue}{1 = -1 \, \, \, \, \, \, \, \text{false; not in solution set}}$
For 6:
$\sqrt {6-2} = 6-4$
$\sqrt {4} = \color{red}{±}2$
$\color{blue}{\sqrt {4} = 2}$
$\color{blue}{2 = 2 \, \, \, \, \, \, \, \text{true; in solution set}}$
The extraneous solution $x=3$ was brought about when you squared the radical, because squaring removes the restriction that $\sqrt{u} \geq 0$.


text:
Q: How to create autoincrement field in Mandango I'm using in my project mandago ODM for mongodb.
http://mandango.org
I know that in MongoDb you can define JS functions on fields but I don't know how to do it with mandango. I create autoincrement ID field in more clever way than getting last record then incrementing it in PHP and saving in db. So my question is how to create an autoincrement field in mandago ODM?
I'd put some code but there's really nothing to put just pure code classes generated by Mondator.

A: After some research I have found out how to solve problem.
You need to add in your model mapping file 'idGenerator' => 'sequence'
in my case it looks as following:
$modelMapping = array(
    'Model\User' => array(
        'isEmbedded'    => false,
        'idGenerator'   => 'sequence',
        ...

It will autoincrement _ID key in your document.


text:
Q: Alternative for missing app bar in Android TV I just notice that my Android app, when I run it on
Android TV with leanback intent, that it doesn't
show a sandwich button for the menu items.
This is missing, and everthing else like the title:

What is the suggested alternative? Is it possible
to listen to a button on the remote control and
make the menu items visible?

A: Incase you are looking for tab based navigation, The Leanback templates provide side navigation in the browse experience, which works well for many apps. If you need tab navigation (typically displayed horizontally across the top of the app), you can instead use Leanback Tabs.
Add the library to your project:
implementation "androidx.leanback:leanback-tab:$version"

Sample code
val leanbackTabLayout = findViewById<LeanbackTabLayout>(R.id.tab_layout)
val leanbackViewPager = findViewById<LeanbackViewPager>(R.id.view_pager)

leanbackViewPager.setAdapter(adapter)
leanbackTabLayout.setupWithViewPager(leanbackViewPager)

Then implement tabs using LeanbackTabLayout and LeanbackViewPager by following the existing ViewPager guide. Note that LeanbackViewPager is based on ViewPager, not ViewPager2.
Note that only themes that are derived from Theme.AppCompat are supported.


text:
Q: Pandas group by column and add numbered rows to each group I have the following data stored in a pandas.DataFrame object named df. The column id is a unique identifier and the remaining columns are irrelevant for the purpose of this question.

id
x1
x2
x3

0
01001
523.41
639673
1222.13

1
01002
54.832
33746
615.443

2
01003
48.3824
45196
934.142

I want to know if there's a way to group by id and use assign to add multiple numbered rows to each group.
In other words, I want to use range to add an arbitrary number of rows to each id. The desired result looks as follows:

id
x1
x2
x3
new_col

0
01001
523.41
639673
1222.13
2020

0
01001
523.41
639673
1222.13
2021

1
01002
54.832
33746
615.443
2020

1
01002
54.832
33746
615.443
2021

2
01003
48.3824
45196
934.142
2020

2
01003
48.3824
45196
934.142
2021

I was hoping something along these lines would work.
df = df.groupby('id').assign(new_col=range(2020, 2022))

A: You can repeat the index and use numpy.tile to tile the new data:
import numpy as np

new = ['2020', '2021']

df2 = df.loc[df.index.repeat(len(new))]
df2['new_col'] = np.tile(new, len(df))

Output:
     id        x1      x2        x3 new_col
0  1001  523.4100  639673  1222.130    2020
0  1001  523.4100  639673  1222.130    2021
1  1002   54.8320   33746   615.443    2020
1  1002   54.8320   33746   615.443    2021
2  1003   48.3824   45196   934.142    2020
2  1003   48.3824   45196   934.142    2021

Alternatively:
new = range(2020, 2022)
df2 = df.loc[df.index.repeat(len(new))]
df2['new_col'] = new.start + df2.groupby('id').cumcount()

A: We can also create a MultiIndex.from_product and reindex relative to level=0, to scale up the DataFrame, and reset_index to convert the inner level of the MultiIndex into a column:
df = df.reindex(
    index=pd.MultiIndex.from_product(
        [df.index, range(2020, 2022)],
        names=[None, 'new_col']
    ),
    level=0
).reset_index(level='new_col')

df:
   new_col    id        x1      x2        x3
0     2020  1001  523.4100  639673  1222.130
0     2021  1001  523.4100  639673  1222.130
1     2020  1002   54.8320   33746   615.443
1     2021  1002   54.8320   33746   615.443
2     2020  1003   48.3824   45196   934.142
2     2021  1003   48.3824   45196   934.142

We can reorder new_col to the end if needed:
df = df.reindex(
    index=pd.MultiIndex.from_product(
        [df.index, range(2020, 2022)],
        names=[None, 'new_col']
    ),
    level=0
).reset_index(level='new_col')

# Re-order columns
df = df.reindex(
    columns=df.columns[df.columns != 'new_col'].union(['new_col'], sort=False)
)

df:
     id        x1      x2        x3  new_col
0  1001  523.4100  639673  1222.130     2020
0  1001  523.4100  639673  1222.130     2021
1  1002   54.8320   33746   615.443     2020
1  1002   54.8320   33746   615.443     2021
2  1003   48.3824   45196   934.142     2020
2  1003   48.3824   45196   934.142     2021

Setup:
import pandas as pd

df = pd.DataFrame({
    'id': [1001, 1002, 1003],
    'x1': [523.41, 54.832, 48.3824],
    'x2': [639673, 33746, 45196],
    'x3': [1222.13, 615.443, 934.142]
})

A: df1.merge(pd.Series(range(2020, 2022),name='col1'),how='cross')

    id        x1      x2        x3  col1
0  1001  523.4100  639673  1222.130  2020
1  1001  523.4100  639673  1222.130  2021
2  1002   54.8320   33746   615.443  2020
3  1002   54.8320   33746   615.443  2021
4  1003   48.3824   45196   934.142  2020
5  1003   48.3824   45196   934.142  2021


text:
Q: How to use custom R modules in Azure ML env.? So, I have a program with multiple functions. Each of these functions has been packaged in zip files with the XML, and all have been successfully uploaded as custom modules to Azure.
I'm trying to call these functions via a custom R script. Something like:
# Map 1-based optional input ports to variables
dataset1 <- maml.mapInputPort(1) # class: data.frame

# Importing my custom module
source("src/A.R")
source("src/B.R")
source("src/C.R")

#function A performs work and calls function B & C while doing so.
for(i in 1:100){
  a = A(data[i,])
}

data.set <- data.frame(a)
# Select data.frame to be sent to the output Dataset port

maml.mapOutputPort("data.set");

However, this is failing. Completely. It doesn't even import any of the custom modules with the
source("src/A.R")

commands.
How do I do this?
Additionally, the custom modules call each other during the course of their processing. Azure Ml would support that behavior, right?
(the project has at the end moment been ported to this platform, so I'm stuck with trying to ensure my code works on something it wasn't designed for.)


text:
Q: Why EnvDTE.ProjectItem.FileCodeModel is Null on .net core project? I am trying to constrcut a net core console app project programmatically. To do this, I coded like below.
The problem is .....  FileCodeModel instance "fcm" is always null in the code. if I forcefully show the messagebox after calling AddFromTemplate(), the issue does not occur. but i do not prefer this workaround. does anyone know why this issue ouucrs and how to avoid it?
string itemName = "View.cs";
string itemTemplatePath =solution2.GetProjectItemTemplate("CodeFile", "CSharp");

destProject.ProjectItems.AddFromTemplate(itemTemplatePath, itemName);

//if I forcefully show the msgbox, fcm is not null.!!
//MessageBox.show("ok","ok");

ProjectItem destProjectItem = null;
foreach(ProjectItem projectItem in destProject.ProjectItems)
{
if(projectItem.Name == itemName)
     {
     destProjectItem = projectItem;
      break;
          }
}

FileCodeModel fcm = destProjectItem.FileCodeModel;
if (fcm == null)
 throw new ArgumentNullException("fcm is null!!");

fcm.AddNamespace("MyNameSpace");

now I am using VS 2017 latest version wit net core sdk.


text:
Q: Merge data from several MS Access databases I am trying to merge data from several tables in several MS Access databases.  All the tables have the same structure.  I found this script online and, visually, it seems to do exactly what I want it to do.
Parent.Folder <- "D:/Documents/Rwd"
subfolders <- list.dirs(Parent.Folder, recursive = TRUE)[-1]

list_filenames <- list.files(subfolders, full.names = TRUE, recursive = FALSE)
acc_files <- list_filenames[grep(".mdb|.accdb", list_filenames)]

output <- lapply(acc_files,
                 function(file) {
                    channel <- odbcConnectAccess(file)
                    # ALTERNATIVE CONNECTION
                    # channel <- odbcDriverConnect(paste0('driver=
                    #            {Microsoft Access Driver (*.mdb, *.accdb)};
                    #            DBQ=', file))
                    data <- sqlQuery(channel, "select * from HRESULTS")
                    close(channel)
                    return(data)
                })

data <- do.call(rbind, output)

The thing is, it gives me an error.
Error in odbcConnectAccess(file) :
  odbcConnectAccess is only usable with 32-bit Windows

I started R in 32-bit mode and it throws the error described above.
Any idea what could be wrong? I googled it, and didn't find anything useful.


text:
Q: How to send a string from a application to DAL plugin using IPC on MacOS? I have a CoreMediaIO based DAL plugin written in Swift which currently poll a website to get that string. Which is not a good approach.
I want to send that string to DAL plugin via Operating System supported IPC(Inter Process Communication).
But there are many ways to do IPC on MacOS like

*

*Apple Events

*Distributed Notifications in Cocoa

*BSD Notifications

*Transferring Raw Data With CFMessagePort

*Communicating With BSD Sockets

*Communicating With BSD Pipes

*Distributed Objects

*Pasteboard

*XPC
In my case I just want one way communication from a application to DAL Plugin.
I am new to MacOS development so not sure which approch will be efficiant and best for my case of one way comminucation from Application to DAL Plugin?


text:
Q: Why Does this code not compile when the compiler creates the exact same type of instruction from the c++ code Consider the following code
int a = 10;
int b = 2;
int c = 0;

int asmdivide(void);

int main(int argc, char* argv[])
{

     c = a / b;
    asmdivide();
    return 0;
}

int asmdivide()
{
    __asm

    {
        push dword ptr[a]
        push dword ptr[b]
        pop ecx
        idiv ecx, dword ptr[a] //causes compile error
        push ecx
        pop dword ptr[c]
    }
    return c;
}

why does this line idiv ecx, ds:dword ptr[a] //causes compile error Cause a compile error when the compiler generates this instruction idiv eax,dword ptr ds:[1308004h]from this line  `int b = 2;
The error outputted is
error C2414: illegal number of operands

Please see the screenshot below for assembly output

I am using Visual Studio 2013.
Any explanation would be valued

A: It might seem like your code and the disassembly are the same, but that's just due to how the debugger chooses to display the disassembly.
The dividend for IDIV is implicit, and is always EAX when dividing by a 32-bit value (actually EDX:EAX). To quote Intel's manual:
F7 /7    IDIV r/m32   M   Valid   Valid   Signed divide EDX:EAX by r/m32, with result
                                          stored in EAX ←Quotient, EDX ←Remainder.

So your attempt to specify a different register as the dividend will fail.
You can only specify the divisor for IDIV, as in:
cdq                 ; sign-extend eax into edx:eax
idiv dword ptr [a]  ; divide edx:eax by [a]


text:
Q: C# :Does Client machine need SQL Server installed on it while connecting to other machine having SQL Server installed on it (the Server machine) I have written an C# windows application form which runs on a client machine and connects to SQL server on another machine.While building the connection in C# i have used dlls like
1)microsoft.sqlserver.management.smo.
2)microsoft.sqlserver.management.connectioninfo
3)microsoft.sqlserver.management.sdk.sfc

The client machine on which the aplication was built was having sql server installed on it.
so importing and accessing dlls was not a problem.
However on the other client machine on which i am going to run the C# windows application would not be having SQL server installed on it.
So will it cause a problem.Will the connection fail on that client machine due to absence of sql server.
If yes, what could be the way around to solve the problem without installing sql server on that client machine.
PS: I am asking beforehand to avoid the last minute hassle on the day of installation.

A: The pieces needed to connect to SQL server are built into the .net framework. As long as you used those when coding the client piece you can connect to a SQL Database without MSSQL installed on the client.
using System.Data;
using System.Data.SqlClient;

SqlClient

PS: I am asking beforehand to avoid the last minute hassle on the day of installation.

You should always test locally first. You can probally get your hands on a random test machine to verify that everything is good to go.

A:
So will it cause a problem.Will the connection fail on that client machine due to absence of sql server.

No, as long as you have all the required dll's installed along with your application.

connects to SQL server on another machine

Not a good option though. I would recommend you to use some middle layer to connect to database. Perhaps web services. Something of the following architecture.
GUI-->Webservices-->DataBase

A: You need to make sure you deploy the Server Management Objects Redistributable (SharedManagementObjects.msi) when you install on the client machine.
This will install the SMO classes without having to install a full Sql Server install.

Microsoft SQL Server 2008 Management Objects
The SQL Server Management Objects (SMO) is a .NET Framework object model that enables software developers to create client-side
  applications to manage and administer SQL Server objects and services.
  This object model will work with SQL Server 2000, SQL Server 2005 and
  SQL Server 2008.
Note: Microsoft SQL Server 2008 Management Objects Collection requires Microsoft Core XML Services (MSXML) 6.0, Microsoft SQL Server
  Native Client, and Microsoft SQL Server System CLR Types. These are
  available on this page.


text:
Q: Как менять кастомные темы в настройках Android приложений Делаю свое первое приложение на Android. Хотелось бы реализовать функционал настроек (смена стиля). Стили сделал, реализовал спиннер, установил ArrayAdapter. Вот что есть:
package com.churkin.myprojectfirst;

import android.content.SharedPreferences;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.Toast;

public class Settings extends AppCompatActivity {
Spinner spinnercolor;
SharedPreferences colorPref;
final String COLOR_PREF = "COLOR_PREF";
@Override
protected void onCreate(Bundle savedInstanceState) {

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    setContentView(R.layout.settings);
    setTheme(R.style.FireBrickTheme);
    setTitle("Настройки");
    spinnercolor = (Spinner) findViewById(R.id.spinnercolor);
    ArrayAdapter<?> adapter = ArrayAdapter.createFromResource(this, R.array.spinnersettings, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinnercolor.setAdapter(adapter);
    spinnercolor.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
            String[] choose = getResources().getStringArray(R.array.spinnersettings);
            String item = (String)adapterView.getItemAtPosition(i);
            setColor(item);
            if(!item.equals("Стандарт")){
            Toast toast = Toast.makeText(getApplicationContext(), "Установлена тема: " + item, Toast.LENGTH_SHORT);
            toast.show();}
        }
        @Override
        public void onNothingSelected(AdapterView<?> parent) {

        }
    });

    super.onCreate(savedInstanceState);
}
private void setColor (String color){

switch(color){
    case "Стандарт":
        pref(color);
        setTheme(R.style.AppTheme);
        break;
    case "DodgerBlue":
        pref(color);
        setTheme(R.style.DodgerBlueTheme);
        break;
    case "ForestGreen":
        pref(color);
        setTheme(R.style.ForestGreenTheme);
        break;
    case "FireBrick":
        pref(color);
        setTheme(R.style.FireBrickTheme);
        break;
    case "DarkOrange":
        pref(color);
        setTheme(R.style.DarkOrangeTheme);
        break;   }
}
private void pref(String color){
    colorPref = getPreferences(MODE_PRIVATE);
    SharedPreferences.Editor ed = colorPref.edit();
    ed.putString(COLOR_PREF, color);
    ed.apply();
}

Как нужно сделать, чтобы при выборе какого-либо пункта Spinner тема менялась на соответствующий цвет в других Activity, а также в текущем?

A: Можно много разных способов придумать, например, можно сделать так:

*

*Создаем класс ThemeUtils.  Так как мы динамически меняем тему из spinner'a мы должны сделать это программно. Это делается путем вызова метода setTheme() в методе активности onCreate(), перед любым вызовом setContentView(). Чтобы изменить тему, вам нужно просто перезагрузить activity.
public class ThemeUtils{
private static int sTheme;

public final static int FIRE_BRICK = 0;
public final static int DODGER_BLUE = 1;

public static void changeToTheme(Activity activity, int theme) {
    sTheme = theme;
    activity.finish();
    activity.startActivity(new Intent(activity, activity.getClass()));
    activity.overridePendingTransition(android.R.anim.fade_in,
            android.R.anim.fade_out);
    }

public static void onActivityCreateSetTheme(Activity activity) {
    switch (sTheme) {
    default:
        activity.setTheme(R.style.AppTheme);
        break;
    case FIRE_BRICK:
        activity.setTheme(R.style.FireBrickTheme);
        break;
    case DODGER_BLUE:
        activity.setTheme(R.style.DodgerBlueTheme);
        break;
    }
}
}

*Далее можно оформить выбор темы в отдельном activity, ну или вставите код в свое, просто как пример использования.
public class ThemeActivity extends AppCompatActivity {
private Spinner spThemes;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Обязательно делаем вызов метода по установке темы до setContentView
    ThemeUtils.onActivityCreateSetTheme(this);
    // и только после установки делаем сам setContentView
    setContentView(R.layout.activity_theme);
    setupSpinnerItemSelection();
}

private void setupSpinnerItemSelection() {
    spThemes = (Spinner) findViewById(R.id.spinnercolor);
    spThemes.setSelection(ThemeApplication.currentPosition);

    spThemes.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parent, View view,
                int position, long id) {
            if (ThemeApplication.currentPosition != position) {
                ThemeUtils.changeToTheme(ThemeActivity.this, position);
            }
            ThemeApplication.currentPosition = position;
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {

        }
    });

}
}

*Чтобы запомнить какая у нас тема сейчас установлена, создадим параметр на уровне Application:
public class ThemeApplication extends Application {
      // Храним текущее положение спинера
      public static int currentPosition;
}


text:
Q: After changing Docker Root Directory: Failed to start Docker Application Container Engine After changing the default Docker Root Directory /var/lib/docker by adding my new directory --data-root /media/abdelaziz/1E6AFBDE6AFBB09F1/installation/docker to the docker.service file:
1- I reloaded the daemon-reload file with  systemctl daemon-reload
2- Moved my containers created previously at /var/lib/docker to my new destination
3- Restarting the docker service with : systemctl restart docker
BUT
The service didn't start and I got this message:
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

And systemctl status docker.service returned:
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: failed (Result: start-limit-hit) since ر 2020-05-20 14:46:43 CET; 7min ago
     Docs: https://docs.docker.com
  Process: 23842 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --data-root /media/abdelaziz/1E6AFBDE6AFBB09F1/insta
 Main PID: 23842 (code=exited, status=1/FAILURE)

ماي 20 14:46:41 abdelaziz-VPCEH3U1E systemd[1]: Failed to start Docker Application Container Engine.
ماي 20 14:46:41 abdelaziz-VPCEH3U1E systemd[1]: docker.service: Unit entered failed state.
ماي 20 14:46:41 abdelaziz-VPCEH3U1E systemd[1]: docker.service: Failed with result 'exit-code'.
ماي 20 14:46:43 abdelaziz-VPCEH3U1E systemd[1]: docker.service: Service hold-off time over, scheduling restart.
ماي 20 14:46:43 abdelaziz-VPCEH3U1E systemd[1]: Stopped Docker Application Container Engine.
ماي 20 14:46:43 abdelaziz-VPCEH3U1E systemd[1]: docker.service: Start request repeated too quickly.
ماي 20 14:46:43 abdelaziz-VPCEH3U1E systemd[1]: Failed to start Docker Application Container Engine.
ماي 20 14:46:43 abdelaziz-VPCEH3U1E systemd[1]: docker.service: Unit entered failed state.
ماي 20 14:46:43 abdelaziz-VPCEH3U1E systemd[1]: docker.service: Failed with result 'start-limit-hit'.

Does anyone have any idea about what should I do?


text:
Q: Use Node.js as standalone LESS-compiler in project? I've been trying to incorporate the lessc compiler in a large project that has the basic setup from Bootstrap and it only results in various compileerrors (for which there are tickets for everyone with different solutions).
Not one solution give me what I want, which is a way to compile the less-pile through the command line.
I compile various other assets through node.js and hoped to do the same thing with the less, but every googlepage I find on the subject is Node.js+Express which is not what I want. I want a standalone compiler. (Idea: require.js r.js-file)
I found Node-less but it hasnt seen a update in 2 years and as such isnt ideal.
So. Question: Is there a commandline way to compile less-files with node.js? Ideal impl:
node compiler.js build.js

where build.js is a file with path to bootstrap.less and everything else needed.
Example of a r.js config file:
({
    baseURL : "../assets",
    mainConfigFile : "../assets/main.js",
    name : "../assets/main",
    out : "../assets/main.optmin.js",
    optimize : "uglify"
})

A: Here is how to use node and less to output to a file:
node path/to/less/bin/lessc -x -O2 path/to/assets/main.less > path/to/output.css

-x : compress
-O2 : optimization mode
which creates output.css from main.less. Might be simple but I havn't found this ANYWHERE on the net. That line can be incorporated in a deployment-script.


text:
Q: API Web HTTP Request from DLE Vision Flow (Austria) I have a question regarding with API Web HTTP Request of Vision Flow DLE Programm.
How can i read this code?
HTTP-Abfrage: http://api.test.de/address/v1/consolidate?includeDetails=true POST
$LOCAL:AdresseAPI(={"Name1": "Test","Name2": "Spedition GmbH","Name3": "", "Street": "Justus-Straße 8","CountryCode": "D", "ZipCode": "1xxx4","City": "BTESTIM"})
$respstat(=200)
See attached photo:enter image description here


text:
Q: Volume of $B(p, r)$ on cylinder $\mathbb{R} \times S^{n-1}$ I am reading p. 431 "Riemannian Geometry" by Petersen Lemma 11.4.9 that has the following claim in the proof:
Let $(M, g)$ be a Riemannian manifold, that looks like a cylinder (that is the wording, so I guess $\mathbb{R} \times S^{n-1}$). Then for $p \in M$ we must have
$\lim_{r \rightarrow \infty} \frac{\text{vol} B(p, r)}{r^{n-1}} < \infty$.
Can you help me see where this comes from?


text:
Q: Showing that sequence is convergent by proving it is Cauchy sequence $x_n=\frac{n+sin(n)}{n+7}$
I'm still new on this field and I would be so pleased,if someone let me know that my steps are valid and I haven't done any mistakes
My attemps for showing that $|x_{n+1}-x_n| < \epsilon$ failed because I'm having 2 terms $sin(n)$ and $sin(n+1)$, and both of them cannot get their max values for same $n$.
And when I chose $n'$ as $2n$, I've got
$\epsilon>|x_{2n}-x_n|=|\frac{sin(n)(2(n+7)Cos(n)-2n-7)+7n}{(2n+7)(n+7)}|\leq\frac{9n+7}{(2n+7)(n+7)}<\frac{9n}{2n^{2}}=\frac{9}{2n}$
So now I can assume that $n>\frac{9}{2\epsilon}$ and choosing $n_0=[\frac{9}{2\epsilon}]+1$ this statement would remain true.
$\forall\epsilon>0,\exists n_0=[\frac{9}{2\epsilon}]+1, \forall n,n' \in N, |x_{n'}-x_n|<\epsilon$ so I can assume that this is Cauchy sequence so is convergent.I'm not really sure that this is true for $n_0$ I've got. Also 1 more question, Is there more simple way to prove this?

A: Note that for all $n\ge1$,
$$
\frac{n-1}{n+7}\le\frac{n+\sin(n)}{n+7}\le\frac{n+1}{n+7}
$$
Thus,
$$
\frac{n+k-1}{n+k+7}-\frac{n+1}{n+7}\le x_{n+k}-x_n\le\frac{n+k+1}{n+k+7}-\frac{n-1}{n+7}
$$
which can be written as
$$
\frac6{n+7}-\frac8{n+k+7}\le x_{n+k}-x_n\le\frac8{n+7}-\frac6{n+k+7}
$$
The last inequality implies that
$$
|x_{n+k}-x_n|\le\frac8{n+7}
$$


text:
Q: How to detect Pull to Show More event in Lightning Components Is there a way we can detect Pull to Show More event and load the data accordingly?My objective is that, user will be displayed first 50 items that he is searching for and upon sliding the screen up he should be able to see next 50 items of search results.

A: From my exploration of the one.app code in debug mode, your component needs to implement ui:handlesShowMore, but we don't seem to be able to implement it yet. This looks like another feature that isn't there yet.


text:
Q: git lfs push is still attempting to upload many GB of non-lfs files I think I understand the root cause of the issue I'm having but I don't know the best way to fix it. In the process of adding many .fbx files to my Unity game project, I did the following.
Before adding git lfs to my project:

*

*I added the .fbx to my project

*git add .

*git commit -m "add fbx"

*attempted a push to origin

Of course, this push failed, as the push in question was over 2 GB in size. I did some research on what I should do to address this, and found git lfs, which I have since installed, and created a proper .gitattributes which is properly marking all the large files. Using git lfs ls-files, I've confirmed that the large files in question are being handled by git lfs, and have been properly committed.
However, after all this setup, when I add, commit, and push, (and after a ~6GB LFS upload which seems to go off without a hitch) standard git is still attempting to upload a large amount of files (multiple GB in size, enough to get the push to fail). I assume this is happening because of my previous commit, before the files were marked as lfs.
How can I "reset" the situation here so that git stops attempting to upload a large amount of files without lfs?
I have tried checking out a new branch, adding, committing, and pushing, but the issue persists.


text:
Q: Android - Single data request class that handle a lot of activity Im new to android and just learning how to pass data from server using json and volley.
what i want to ask is:
if i have a lot of activities on my apps, and each of every activity need to take data from the server, and I need to use json in every single class, and put the requeststring in it, which is very redundant.
Is there a way to put all the functions in just 1 class (maybe static), so I will have 1 class that only handling the data request from the client to the server. I found it really confusing, because at the same time, I need to modify the UI when the apps received the data (eg. move to another activity, or just simple change the textview).
So, basically the class will check whether the data exist on the database, if not, it will request the data from the server, and return it to the activity
it is possible to do this? Is there any tutorial that I can refer to?
Thanks a lot! cheers!


text:
Q: Use Ruby On Rails on Chromebook? I am leaning Ruby on Rails but, I have a chromebook. Is there a way to install it on a chromebook or use it? The chromebook is latest version.
Thank You Very Much!

A: You can use a cloud ide from a browser like c9.io


text:
Q: Centralize vendor folder in Laravel 4.1.x I wonder if is possibile to "move" the vendor folder to another location. I mean, I've a structure like this

*

*/

*Laravel Project 1

*Laravel Project 2

*Laravel Project 3

*[... others ...]

*CDN (For vendor if I can)

Well as you know every project comes with the vendor/ folder. I want to move that folder inside the CDN and "merge" all the requirements for every project in another composer outside the projects folder (inside CDN i guess).
Why this?
Simply because I've notice that vendors folder are nearly the same for every project so if I can combine all the "differences" in one single big vendor folder I can manage all the dependencies in one single location, pretty cool
Is that possible?
TY for any help :) Have a nice day.

A: In Laravel you can change the folder your applications load the framework and dependencies from bootstrap/autoload.php.
There's a require __DIR__.'/../vendor/autoload.php'; line in it and you can change it to whatever you need.
Thus you can change it to some outside folder, common to all projects.


text:
Q: IOS8 VPN Extension on demand connection I'm trying to create an on-demand rule NEVPNManager object. The rule is simple -  once a connection to a given ip/host will be established start the VPN connection.
The following code just starts the VPN for every http request, more so it can't be disabled. When changing the host to and ip nothing happens.
NEOnDemandRuleConnect *connectRule = [NEOnDemandRuleConnect new];
NSURLComponents *components = [NSURLComponents new];
components.scheme = @"http";
components.host = @"yahoo.com";
NSURL *url = [components URL];
connectRule.probeURL = url1;

Ideally I'll be able to start the VPN for every type of communication.
Thanks!

A: You need to create another rule but use NEOnDemandRuleDisconnect.


text:
Q: The element of one div is going in to another div

          <button class="carousel__button carousel__button--left is-hidden">

          </button>

          <button class="carousel__button carousel__button--right">

          </button>

            <button class="carousel__indicator current-slide"></button>
            <button class="carousel__indicator"></button>
            <button class="carousel__indicator"></button>

Happy Clients

That div with the happy clients is going inside the 3 dots
nav that i have like it isn't even there,
I can increase margin but that's a temporary solution,
can anyone tell me why the div with the h3 can not see the nav dots,
and here is my css.

.carousel{
    position:relative;
    height:800px;
    width: 90%;
    margin: 0 auto;
    border: red solid 2px;
}

.carousel__image{
    width:100%;
    height: 100%;
    object-fit: cover;

}

.carousel__track-container{
    background: lightgreen;
    height:100%;
    position: relative;
    overflow: hidden;

}

.carousel__track{
    padding:0;
    margin: 0;
    list-style:none;
    position: relative;
    height: 100%;
    transition: transform 250ms ease-in;
}

.carousel__slide{
    position: absolute;
    top:0;
    bottom:0;
    width:100%;
}

.carousel__button{
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border:0;
    cursor: pointer;
}

.carousel__button--right{
    right:-40px;
}

.carousel__button--left{
    left:-40px;
}

.carousel__button img{
    width:20px;
}

.carousel__nav{
    display: flex;
    justify-content: center;
    padding: 10px 0;
    margin-bottom: 10px;
}

.carousel__indicator{
    border:0;
    border-radius:50%;
    width:15px;
    height:15px;
    background: rgba(0,0,0,.3);
    margin:0 10px;
    cursor: pointer;
}

.carousel__indicator.current-slide{
    background: rgba(0,0,0,.75);
}

.is-hidden{
    display: none;
}

and that is my CSS that I used for html i tried to change it with margin and padding,
but i want to know why it does not see the nav dots at all
as u can see in the photo it stops below that image but that image and the nav dots are in the same div

A: I didn't really understand what you need to achieve

$(".carousel__indicator").on("click", function() {
  $(".carousel__indicator").removeClass("current-slide");
  $(this).addClass("current-slide");
})
.carousel {
  position: relative;
  height: 800px;
  width: 90%;
  margin: 0 auto;
  border: red solid 2px;
}

.carousel__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel__track-container {
  background: lightgreen;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.carousel__track {
  padding: 0;
  margin: 0;
  list-style: none;
  position: relative;
  height: 100%;
  transition: transform 250ms ease-in;
}

.carousel__slide {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
}

.carousel__button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.carousel__button--right {
  right: -40px;
}

.carousel__button--left {
  left: -40px;
}

.carousel__button img {
  width: 20px;
}

.carousel__nav {
  display: flex;
  justify-content: center;
  padding: 10px 0;
  margin-bottom: 10px;
  position: relative;
  z-index: 3;
}

.carousel__indicator {
  border: 0;
  border-radius: 50%;
  width: 15px;
  height: 15px;
  background: rgba(0, 0, 0, .3);
  margin: 0 10px;
  cursor: pointer;
}

.carousel__indicator.current-slide {
  background: rgba(0, 0, 0, .75);
}

.is-hidden {
  display: none;
}

      <button class="carousel__button carousel__button--left is-hidden">

          </button>

      <button class="carousel__button carousel__button--right">

          </button>

        <button class="carousel__indicator current-slide"></button>
        <button class="carousel__indicator"></button>
        <button class="carousel__indicator"></button>

Happy Clients

but your code works. Maybe you need get right z-index for your navigation


text:
Q: How to get text from specific tag in XML using Java? I have an xml which web resource and I have String to URL where the xml is and in it I have to find specific tag someTag and to get its text content. How to do it in java?
I search but only find ways where there is specific XPath,but in my case I do not know where someTag can be. Which parser to use? And how to implement it?

A: An XPath expression starting with a double slash will find an element anywhere:
 XPathExpression xpw = xpath.compile( "//someTag" );

A: I recently used transformer class to process stix xml messages.
http://docs.oracle.com/javase/7/docs/api/javax/xml/transform/Transformer.html


text:
Q: Why won't padding-left in select box options show in Chrome but works in FF? I added a css class to options in a select dropdown box for indention,
<select id="users" name="users">
    <option value="[1,2,3]">Devs team</option>
    <option value="1" class="member">user1</option>
    <option value="2" class="member">user2</option>
    <option value="3" class="member">user3</option>
</select>

It shows correctly on Firefox but not on Chrome. :(
Hope you guys could help me with this little problem.

A: You cannot reliably style select and option elements.  Browsers typically like to stick to the OS defaults for these elements.
If you are looking to pad .member because they are children of the Devs Team, you may want to look at the OPTGROUP tag:  http://www.w3schools.com/tags/tag_optgroup.asp

A: Found the answer. Sadly chrome doesn't support giving styles to option.


text:
Q: Messages disappearing from SQS queue to Lambda I am sending messages from an SQS queue to a Node.js Lambda function. I send about 20 messages at the same time to the queue after which Lambda starts working.
Some of these messages never seem to appear in the queue, or at least don't make it to Lambda. I don't see any activity in the Cloudwatch logs for those missing messages.
It's a long polling queue with these settings:

*

*Default Visibility Timeout: 2 minutes

*Delivery delay: 0 seconds

*Receive Message Wait Time: 5 seconds

*Queue type: Standard

The Lambda script finished in a few seconds and has concurrency set to 'Use unreserved account concurrency'.
For debugging purposes, I'm now also sending all the messages to a second queue that doesn't get processed. There I can see all the messages, also the ones that are missing from the other one.
The messages just contain about 3 numeric variables in a json, so the size shouldn't be an issue.
I have set up a redrive policy, and the missing messages don't show up in the dead letter queue either.
Kinda pulling my hair out here. Any ideas why these messages seem to disappear?


text:
Q: crawler4j do not recognize all links on a page Basically I am facing a problem where crawler4j do not recognize all links on the page.
say for example there are 5 links existing on the page out of them only 3 gets recognized and hence fetched. Rest 2 are not even recognized.
What is the expected output? What do you see instead?
All the links in a page shall be recognized so that they can be fetched
What version of the product are you using?
crawler4j 4.1
Please provide any additional information below.
Only difference I found in the links which are not recognized is that these links has angled bracket in it.
ex.
<a title="some text" href="http://www.example.com/abc/xyz-<sometext>-abc-xyz/abc_xyz" >some text

A: Yes, it seems like a bug in the crawler4j page parser.
It finds the  tag, then it searches for a closing bracket - here is the failure point I assume.
Please submit an issue to the new crawler4j site - on github:
https://github.com/yasserg/crawler4j/issues
Thanks


text:
Q: Published an npm but its nowhere to be seen on the internet I just published an npm while following the procedure and it is found as published on https://www.npmjs.com/ also.
Like -

However, I am unable to find it on the internet when I search it.

A: Not all the packages you publish come to the top of google search results.
Google searches the results across a wide range of content across internet. Not just npm registry.The search results are based on the relevance of search term with content across the internet. Results from other websites may also pop up.
It can also depend on popularity(usage) of the package and other criteria which I'm not aware of. Since you have published the package recently, google won't be even aware of it. Next time when the google crawlers crawl npmjs they might see the package(May be its possible that npm registry might have custom feed pushing to google depending on package usage rather than google crawlers crawl them) .
So don't worry if it doesn't appear in google search. Your package can be searched from npmjs and is available for all to use, and can be shared with everyone. May be eventually you reach the top of google search results :)
Also you can add relevant description,  keywords to your package.json that so that people can find it easily in npm registry search. Right now it shows up only if its an exact package name match.


text:
Q: randomly change columns in mysql table I have the following view
sqms_question_id (int),
question (text),
sqms_answer_1 (text),
correct_id_1,
sqms_answer_2 (text),
correct_id_2 (T/F),
sqms_answer_3(text),
correct_id_3 (T/F)

I now need to mix the answer randomly (because answer 1 is always true). I would create another view based on the first view since i cannot change the first one
Any idea I can do this in mysql directly?
Ok. sample data -
sqms_question_id (int), question (text), sqms_answer_1 (text), correct_id_1, sqms_answer_2 (text), correct_id_2 (T/F), sqms_answer_3(text), correct_id_3 (T/F)
1, "What is ?", "answer1A",TRUE,"answer1B",TRUE,"answer1C",FALSE
2, "What is ?", "answer2A",TRUE,"answer2B",TRUE,"answer2C",TRUE
3, "What is ?", "answer3A",TRUE,"answer3B",FALSE,"answer3C",FALSE
4, "What is ?", "answer4A",TRUE,"answer4B",FALSE,"answer4C",TRUE
Output (randomly)
1, "What is ?", "answer1C",FALSE,"answer1B",TRUE,"answer1A",TRUE,
2, "What is ?", "answer2B",TRUE,"answer2A",TRUE,"answer2C",TRUE
3, "What is ?", "answer3A",TRUE,"answer3B",FALSE,"answer3C",FALSE
4, "What is ?", "answer4C",TRUE,"answer4B",FALSE,"answer4A",TRUE,
Hope this example made it more clear - in this example row 3 was not changed ....


text:
Q: Why postgresql encount duplicate key when key not exists? When I am inserting data into Postgresql(9.6),throw this error:
ERROR:  duplicate key value violates unique constraint "book_intial_name_isbn_isbn10_key"
DETAIL:  Key (name, isbn, isbn10)=(三銃士, , ) already exists.
SQL state: 23505

I add uniq constraint on columns name, isbn, isbn10.But when I check the distination table,it does not contains the record:
select * from public.book where name like '%三銃%';

How to fix?This is my insert sql:
insert into public.book
select *
from public.book_backup20190405 legacy
where legacy."name" not in
(
    select name
    from public.book
)
limit 1000

A: An educated guess, there may be more than one row in the source table book_backup20190405 which has the unique key tuple ('三銃', '', '').
Since the bulk INSERT INTO ... SELECT ... will be be transactional, you'll be none the wiser to the error, since all data will have been rolled back when the constraint fails.
You can verify this by running a dupe check on the source table:
SELECT name, isbn, isbn10, COUNT(*)
FROM public.book_backup20190405
WHERE name = '三銃'
GROUP BY name, isbn, isbn10
HAVING COUNT(*) > 1;

To see if there are duplicates.
Here's an example of how the source table can be the sole source of duplicates:
http://sqlfiddle.com/#!17/29ba3


text:
Q: Using HTML5's VIDEO tag in ASP.NET I am using the video tag in asp.net as such:
    <%@ Page Title="" Language="C#" MasterPageFile="~/fort.master" AutoEventWireup="true"
CodeFile="Training.aspx.cs" Inherits="Training" %>

    <asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <video width="320" height="240" controls="controls">
     <source src="movie.mp4" type="video/mp4" />
    </video>

   </asp:Content>

When I run the program the video comes up put not clickable. It works fine in a html file, just not in a .aspx file.


text:
Q: How can I get the feed_dict using hook when I run estimator.predict I am using tensorflow estimator to train a model and try to predict some value, then save the predicted result together with the input data, so that users can check the prediction result from one table
to see if it's correct.
I've tried below code but feed_dict outputs None, I call predict using a dataset object.
class InsertPredictResultHook(tf.estimator.SessionRunHook):
    def after_run(self, run_context, run_values):
        print(run_context.original_args.fetches)
        print(run_context.original_args.feed_dict)
        print(run_values)

predictions = classifier.predict(input_fn=mydataset,
    hooks = [InsertPredictResultHook()])

How can I get the input tensors together with predict result so that I can save these data for my users?
I am using tensorflow 2.0 alpha0


text:
Q: Documents directory path of simulator in Xcode 6 Any idea why Apple changed the documents directory path in Xcode 6? I read pinkstone's post but curious to know whether there is an explanation for the change.

A: The simulator architecture was rewritten on top of a new framework called CoreSimulator.framework.  As part of that, you now have a library of devices that you can create or delete for your testing rather than just having one path of data that is used for all devices.


text:
Q: PowerEdge T610 H700 controller upgrade I have a PowerEdge T610 server with Perc H700 RAID controller.
I wanna use the controller for non-raid, but I read some posts and the H700 controller doesn't support the non-raid operation. The problem is the Debian (yes, I know this OS not supported, but it will be works fine) installer can't detect the physical drives. So I need to create a virtual volume but I wanna use software RAID (MDADM).
On Dell drivers page I saw a Dell 6Gbps SAS HBA Firmware here
Can I use this driver for H700? Or I must buy another controller which is supports non-raid? Or any controller flasing method?
Thanks in advance :)

A: Dell PERCs really are rebranded LSI gear which can often flashed with non-RAID (IT) firmware, but I don't know if the one you linked really is appropriate for your H700 controller.
That said, passing the raw devices to the OS should be only useful when using something as ZFS, whose native RAID implementation offers additional features versus HW RAID capabilities.
Linux MDRAID, while fast and versatile, is going to be slower than H700's HW RAID, due to the latter powerloss protected writeback cache. So my advice is to stick with HW RAID in this case.
If you really want to use MDRAID, you can create multiple 1-disk RAID0 sets, using them as the underlying devices for a Linux software RAID array.

A: The firmware you linked is really only that, a firmware update. What it means is that the server will be able to work with 6gb/s sas HBA card (it really is the name of the card). If you want to use your disk with the server you have now, you will need to make raids with the card already installed, then your OS will see the disks.
Considering you have a Dell machine, I would not see the benefit of doing a software raid as the h700 is already a good hardware option. As shodanshok said you could always make multiple raids and use those for your software raid (but from what I've read it's not good to mix software and hardware raids, never tested though).
Also, though this has nothing to do with the raid configuration, why would debian not be supported ?


text:
Q: Выравнивание двух блоков относительно друг друга CSS Возникла проблема, хочу выровнять картинку и блок с вводом данных на одном уровне, но не могу уменьшить блок div, может кто-то подсказать решение?

#information {
  position: relative;
  width: auto;
  margin-left: 70%;
}

#picture {
  margin-left: 10%;
  margin-top: 0;
}

A: Для этого можно воспользоваться Flex:

body {
  display: flex;
  align-items: center;
}

#information h1 {
  margin-top: 0;
}

#information p {
  margin-bottom: 0;
}

#picture {
  width: 140px;
  height: 200px;
  border: 1px solid red;
  margin-left: 30px;
}

Information:

line 1

line 2

line 3


text:
Q: What is a good alternative to webpack.DefinePlugin for create-react-app? I'm working on an ejected React application that uses webpack.DefinePlugin to store globally an object defining the folder names in the application for a specific path (kind of an ls in shell but using node fs)
I'm researching how to go back to the original create-react-app without loosing this functionality as some parts of the app relies on this, but I can't find anything other than a script that writes these names into a variable in js file prior to the commands npm start or npm run build.
The project is currently using Webpack 3 and Babel 6, the idea behind going back to react-scripts is get rid of the manual maintenance and simplify the project dependencies while upgrading the project
// analysis.js
module.exports = {
  key: values from fs node package
};

// WEBPACK
    new webpack.DefinePlugin({
      "ANALYSIS": JSON.stringify(require('./analysis')),
    }),

I expect the same values to be available in the application without needing to eject react-scripts
Any suggestions? Thanks!

A: I finally chose to develop a script that runs before any webpack script and creates the file that I import later like any other file inside the React app
Regards


text:
Q: Get user rows using their ID from an array in PHP I have two MySql tables, one called users and the other one posts.
There are two rows in the "users" table, each containing a user ID and a username.
There's also a row in the "posts" table and in one of the cells called "contributors" there are two IDs from the users in the "users table." separated with a comma, so it looks something like this: 0000000000,1111111111 (not the actual IDs, these are just for reference.).
I want to to a "foreach" for all the IDs in the "contributors" cell, basically loop through all of them and for each of them IDs display the corresponding usernames.
I tried many things including this:
function post_contributors()
{
    $contributor_ids = get_post()[8];
    $contributor_array = explode(",", $contributor_ids);
    $contributors = array_values($contributor_array);

    foreach ($contributors as $contributor) :
        $conn = include '../includes/dbh.inc.php';

        $sql = "SELECT * FROM users WHERE user_id=$contributor";
        $result = mysqli_query($conn, $sql);

        if ($row = $result->fetch_row()) {
            return $row ?? null;
        }

        return null;

        echo '
' . $result['user_username'] . '
';
    endforeach;
}

This doesn't work. I think it's because of the way I get the user ID (I'm left with an improper array).
Hope this all makes sense and someone can help.

A: You can rewrite your function like this.
<?php
function post_contributors($postID)
{
    global $conn;
    $contributor_info = "";

    $contributor_ids = get_post($postID)[8];
    $contributor_array = explode(",", $contributor_ids);
    //$contributors = array_values($contributor_array); <== not needed, explode is enough

    foreach ($contributor_array as $contributor) :
        //$conn = include '../includes/dbh.inc.php'; <== not needed here

        $sql = "SELECT * FROM users WHERE user_id=$contributor";
        $result = mysqli_query($conn, $sql);

        if ($row = $result->fetch_assoc()) {
            //return $row ?? null;  <== this would stop your foreach loop
            $contributor_info .= '
' . $result['user_username'] . '
';
        }

        //return null;  <== this would stop your foreach loop

        //echo '
' . $result['user_username'] . '
';
    endforeach;

    return $contributor_info; // or echo $contributor_info, if you only want to display it
}
?>

A few explanations.
global $conn assumes that you have included your dbh.inc.php file in such a way that the script in which you call your post_contributors function has access / knowledge of it.
$contributor_info is there to store what you would normally echo out where needed, once you call your function.
The if / else doesn't need to return anything, because it would end your loop, and you would only get the info on the first contributor (if they exist in your contributors table.
Also, I've added $postID as an argument for your function, since you'd need to know that in order to be able to get the contributors.


text:
Q: XNA: I only have 1 supported display mode (800x600) I'm trying to get my game to automatically set the window size as the correct resolution for the monitor.
For example, my desktop PC is at 1920x1080 resolution, so I want my game to run at 1920x1080 on here, however my laptop is at 1366x768 so I want my game to run at 1366x768 on there, etc.
I've tried so many different things such as GraphicsDevice.Adapter.CurrentDisplayMode.Width/Height, and even printed out the list of GraphicsDevice.Adapter.SupportedDisplayModes and they all tell me that the only display mode supported for me is 800x600. This is surely not the case, because I'm running my Windows 7 at 1920x1080.
So what on earth am I doing wrong? I tried putting this code in the Game1 constructor, the initialiser, I can't figure out why it isn't working properly!

A: Okay I fixed it. I just realised I was being a little bit stupid in that I forgot to mention this a "MonoGame" application, not a straight forward XNA project... (I didn't think it would make a difference but oh I was wrong)..
As it turns out, MonoGame has a massive bug to do with the graphics devices, and there is supposedly a way to solve it (build from the latest source or something?) but what I did was install the XNA 4.0 Refresh for Visual Studio 2013, and copied all my source code across to a new XNA project as opposed to a MonoGame project.
And hey presto, GraphicsDevice.DisplayMode.Width and Height are now correctly registering as 1920 and 1080 pixels. So now I can carry on with my game FINALLY.
Thanks to all the people that tried to help me solve this issue!

A: You can set the resolution of your game in the constructor by adjusting the graphics' PreferredBackBufferWidth and PreferredBackBufferHeight:
For example this will produce a game window that's 480x320:
    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";
        graphics.PreferredBackBufferHeight = 320;
        graphics.PreferredBackBufferWidth = 480;

    }

Keep in mind that when in windowed mode your game will (by default) have a title bar which prevents the game window from being as big as your full screen.

A: This is my method on how to get your maximum supported resolution(and set it, as an example to clarify it):
// in the Initialize method
graphics.PreferredBackBufferWidth = GraphicsDevice.DisplayMode.Width;
graphics.PreferredBackBufferHeight = GraphicsDevice.DisplayMode.Height;
graphics.IsFullScreen = false;
graphics.ApplyChanges(); // <-- not needed in the Game constructor

However, I don't know what you're doing wrong.


text:
Q: ValueError: no results when using pd.apply() I have a column with genres of movies. n genres clumped together per movie into a single cell. I want to separate them into a list and ultimately compare the genres of a particular movie to the total list of all genres and have the total list of all genres be just 1s and 0s. 1 if the genre is in my particular movie and 0 if it isn't.
The pd.apply() function returns an error I can't seem to fix.
ValueError: no results
list_of_genres = list(genre_df['genres'])
genre_array = []

my_movie = "xyz"

def map_genres():
    my_genre = movies_df.loc[movies_df['title'] == my_movie]['genres']
    my_genre = list(my_genre.str.split('|'))
    my_genre = sum(my_genre, [])

    for count in range(0, len(list_of_genres)):
        for count1 in range(0, len(my_genre)):
            if list_of_genres[count] == my_genre[count1]:
                list_of_genres[count] = 1
        if list_of_genres[count] != 1:
            list_of_genres[count] = 0

    return np.asarray(list_of_genres)

movies_df['genre_array'] = movies_df['genres'].apply(map_genres())


text:
Q: Resize Windows 10 notification area For a long time, the windows notification area (aka, system tray) would stack icons 3 high, thus conserving real estate on the task bar. (Below in an example in XP).

I just upgraded from Windows 7 to windows 10 and now my system tray icons look like:

All icons are in a single row, which causes my taskbar to be truncated.  Is there any way to get back the more intelligent configuration of previous windows versions?


text:
Q: Displaying Text in a Formview Label while in Edit Mode I have a Formview which is in EditMode by default and that has no other mode template added. I need to write to a Label within that Formview.
    FileUpload Upload = (FileUpload)Formview_EditProcessData.FindControl("FileUpload2");
    Label Log = (Label)Formview_EditProcessData.FindControl("LoadLog2");
    if (Upload.HasFile)
        try
        {
            if (Upload.PostedFile.ContentType != "image/svg+xml")
            {
                Log.Text = "Wrong Filetype!;
                Log.ForeColor =  System.Drawing.Color.Red;
                return;
            }
            Upload.SaveAs(Server.MapPath(@"~/"+ Upload.FileName));
            MessageBox.Text = "File successfully uploaded!";
            Log.Text = "File successfully uploaded!";

The weird thing in my code is, that this works while displaying the error ("Wrong Filetype!") but does not for the "File successfully uploaded!". I do send this message to a Label (MessageBox) outside the Formview and there everything is displayed as expected.
This seems so illogical to me!
--
I found a workaround by defining the Formview's Label in the same way as above, but this time at the very end. I assigning the error messages to an invisible Label outside the Formview and set the Log's content to that message content.
    FileUpload Upload = (FileUpload)Formview_EditProcessData.FindControl("FileUpload2");
    if (Upload.HasFile)
        try
        {
            if (Upload.PostedFile.ContentType != "image/svg+xml")
            {
                MessageBox.Text = "Wrong Filetype";
                return;
            }
            Upload.SaveAs(Server.MapPath(@"~/"+ Upload.FileName));
            MessageBox.Text = "File successfully uploaded";
    .
    .
    Label Log = (Label)Formview_EditProcessData.FindControl("LoadLog2");
    Log.Text = MessageBox.Text;
    if (Convert.ToString(MessageBox).Substring(0,4) == "File")
    {
        Log.ForeColor = System.Drawing.Color.Black;
    }
    else
    {
        Log.ForeColor = System.Drawing.Color.Red;
    }

I still do not understand why the label seems to loose it's definition after the if(Upload.PostedFile.ContentType...) condition; but at least now it's working the way I wanted


text:
Q: RegEx: Issue parsing forum post body (with quote) This is usually the type of thing I just hammer away on until I can get it right, however in this case I believe it's a part of regex which I've never had my head around completely. The greedy vs. non-greedy stuff.
I have this content:
[quote=mick-mick topic=33586]
I just gave DayZ an hour of my life. I can never get that back. :/
I had to wait to wait. Slow loads just to get to the server selection screen then once I           chose a server it took another almost 3 minutes to get into the server.

I'll still give H1Z1 a shot for sure. :)
[/quote]

This is a test

The regex I'm attempting to use is:
/(\[quote=[a-zA-Z0-9]+\](.*)\[\/quote\])?(.*)/m

But it's only matching the quote line.
As you can see I need the username (mick-mick), as well as the topic id, and the content of the quote, and the content following the quote. Also, the quote may not exist in the content at all.
Can you help me on this? What am I missing? I am using preg_match in PHP.

A: Final Update:
To match multiple quotes and grab all content that isn't even in a quote got a little difficult.  But, here goes:
(?:
  \[quote=([a-z0-9\-]+)
  \s*topic=(\d+)\]
  (.*?)
  \[/quote\]
 |
  (.+?)
  (?=\[quote|$)
)

This time we use an alternating non-capture group around everything.  We either match a quote (with our capture groups 1, 2, and 3) OR we match 1+ other characters into capture group 4 (this is anything that isn't part of a quote).  The crucial addition here is the positive lookahead ((?=...)).  This is a zero-length assertion (meaning it just "checks" but doesn't match) that looks for either [quote or the end of the string ($) following it.  This is used so that we don't just keep matching into a new quote.
Note: to do a global match in PHP, you'll need to use preg_match_all().

Update:
I updated this to grab content before/after the quote and make the quote optional (by adding an optional non-capturing group: (?:...)?).  I also re-read your question and saw that all quotes have a quote/topic (if this isn't the case, you'll need to combine these to expressions a bit..here it is:
(.*?)(?:\[quote=([a-z0-9\-]+)\s*topic=(\d+)\](.*)\[/quote\])?(.*)

And used like:
preg_match('~(.*?)(?:\[quote=([a-z0-9\-]+)\s*topic=(\d+)\](.*)\[/quote\])?(.*)~si', $html, $matches);
$matches[0]; // Full match
$matches[1]; // Before the quote (empty if quote doesn't exist)
$matches[2]; // Quote value: `mick-mick`
$matches[3]; // Topic value: `33586`
$matches[4]; // Quote contents: `I just...`
$matches[5]; // Everything else (entire string is quote doesn't exist)

Demo

You have some issues in your expression, but it was pretty close.  Here is a cleaned up version:
\[quote=([a-z0-9\-]+)\s*(.*?)\](.*)\[/quote\]

You can use it like this:
preg_match('~\[quote=([a-z0-9\-]+)\s*(.*?)\](.*)\[/quote\]~si', $html, $matches);
$matches[0]; // Full match
$matches[1]; // Quote value: `mick-mick`
$matches[2]; // Quote parameters: `topic=33586`
$matches[3]; // Quote contents: `I just...`

Demo

The fundamental issue was you had everything wrapped in (...)? and followed by (.*).  This means the first part was optional, couldn't be matched, and then you matched 0+ characters..since . does not match new line (unless you use the s modifier like in my example), you matched the first line which was the quote.
Also, you used quote=[a-zA-Z0-9]+ when your quote ([quote=mick-mick topic=33586]) had a hyphen, space, and equal sign in it.  Instead, I used [a-z0-9\-] (with i modifier for case-insensitivity), followed by whitespace (\s*) followed by a lazy capture of the rest of your parameters.
Let me know if you have questions or want different functionality.


text:
Q: Add dynamic subtotals to Shiny DataTable I am trying to add a summary row to a filterable table that shows the totals/subtotals and other summary functions.  In my example below I would like totals for investment, Value, and Profit and  average  ROI  for any combination of the the filters Asset and Symbol.
Here are pictures to show my desired result:
All Assets:

Stock Selected:

Bond Selected:

I am also trying to format my columns but wherever I add this formatting code in theif pipeline it does not work.
formatCurrency( ~investment+Value+Profit ) %>%
               formatStyle( c('ROI','Profit'),color = styleInterval(c(0),
               c('red', 'green')),fontWeight = 'bold') %>%
               formatPercentage(~ROI,digits=1)

R Shiny code:
    library(tidyverse)
    library(DT)
    library(formattable)
    library(shiny)

    assetTable <- structure(list(symbol = c("A", "B", "C", "D", "E", "F", "G",
                                            "H", "I"), Asset = c("Stock", "Stock", "Bond", "Bond", "Stock",
                                            "Bond", "Stock", "Bond", "Stock"), investment = c(154, 362, 181,
                                             851, 510, 539, 527, 369, 234), Value = c(330, 763, 911, 535,
                                             220, 450, 576, 903, 905), Profit = c(176, 401, 730, -316, -290,
                                             -89, 49, 534, 671), ROI = c(1.14285714285714, 1.10773480662983,
                                             4.03314917127072, -0.371327849588719, -0.568627450980392,
                                             -0.165120593692022,0.0929791271347249, 1.44715447154472,
                                             2.86752136752137)), row.names = c(NA,-9L),
                                             class = c("tbl_df", "tbl", "data.frame"))

    ui <- fluidPage(
        titlePanel("Table with column summary"),

        # Create a new Row in the UI for selectInputs
        fluidRow(
            column(4,
                   selectInput("Asset",
                               "Asset Type:",
                               c("All",
                                 unique(as.character(assetTable$Asset))))
            )
            ,
            column(4,
                   selectInput("symbol",
                               "Symbol",
                               c("All",
                                 unique(as.character(assetTable$symbol))))
            )
        ),

        DT::dataTableOutput("table")

    )

    server <- function(input, output) {

        # Filter data based on selections
        output$table <- DT::renderDataTable(DT::datatable({
            data <-assetTable

            if (input$Asset!= "All") {
                data <- data[data$Asset == input$Asset,]
            }

            if (input$symbol != "All") {
                data <- data[data$symbol == input$symbol,]
            }
            data
        }))

    }

# Run the application
shinyApp(ui = ui, server = server)

A: In order to get the sum and mean, we can use adorn_totals from janitor
library(dplyr)
library(janitor)

Also, as we are redoing the same summarisation, it could be made into a function
f1 <- function(dat, colnm, colval) {

  dat %>%
    # // filter the rows based on the input string  from colval
    filter({{colnm}} == colval) %>%
    # // create a mean column for ROI
    mutate(ROImean = mean(ROI)) %>%
    # // make use of adorn_totals for the selected columns
    adorn_totals(where = "row", fill = '-',
                 na.rm = TRUE, name = 'Total', c('investment', 'Value',
                                                 'Profit', 'ROI', 'ROImean')) %>%
    # // replace the ROI last row (n() => last row index)
    # // with first element of ROImean
    mutate(ROI = replace(ROI, n(), first(ROImean))) %>%
    # // remove the temporary ROImean column
    select(-ROImean) %>%
    # // change the format of specific columns
    mutate(across(c(investment, Value, Profit),
           ~ as.character(formattable::currency(., symbol = '$',
         digits = 2L, format = "f", big.mark = ","))),
       ROI = as.character(formattable::percent(ROI, digits = 2)))
}

Now, the call becomes much more compact within server
server <- function(input, output) {

  # Filter data based on selections
  output$table <- DT::renderDataTable(DT::datatable({
    data <- assetTable

    if (input$Asset!= "All") {
      data <- f1(data, Asset, input$Asset)
    }

    if (input$symbol != "All") {
      data <- f1(data, symbol, input$symbol)
    }
    data
  }))

}

-output


text:
Q: Definition of entropy for relativistic fluids In section 5.2 of (https://link.springer.com/article/10.12942/lrr-2007-1) ( version on Arxiv ), the authors mention that the equation of state $\rho=\rho(n)$ for a single relativistic fluid system can be written in terms of a local theory, i.e. we can identify:
$$\rho=u^au^b\langle T^{(loc)}_{ab}\rangle$$ and particle number density $n=-u^a\langle J^{(loc)}_a\rangle$, where $u^a$ is the unit time-like vector representing fluid particle velocity. $T^{(loc)}_{ab}$ and $J^{(loc)}_a$ are the stress energy tensor and conserved current associated to some local physical system. However, in chapter 9 they have also considered dependency on entropy density '$s$' in equation of state ($\rho=\rho(s,n)$) without giving a formal definition in terms of a local theory.
For single relativistic fluid system, can we identify our macroscopic entropy density $s$ in terms of local (microscopic) quantities?

A: There is no operator expression for the entropy in the same way that we have operator expressions for $T_{\mu\nu}$ and $j_\mu$, so that the macroscopic stress tensor and current can be viewed as expectation values of microscopic operators. However, once you are in approximate local equilibrium, then $s$ is fixed by equilibrium thermodynamics, $dE=TdS-pdV+\mu dN$. In other words, the equilibrium equation of state determines $s=s(\rho,n)$, once $\rho$ and $n$ are known.


text:
Q: Analysis of repeated survey data I would need some help in analyzing a survey that I have been asked to run in my workplace. The survey is run in successive waves on the same group of people. I know how big is the universe and I know the number of respondents, but I don't have their identity (no paired test possible). The number of respondents can be different from wave to wave even if the universe is the same.
The survey is made of four questions that are answered via a Likert scale (from 1=strongly disagree to 4=strongly agree).
I would like to be able to test if the results of, i.e. wave 1 and wave 2, are significantly different and eventually which are the questions that are driving the change. Thanks.


text:
Q: When do left and right Kan extensions coincide? Let $F:\mathcal{C}\to\mathcal{D}$ be a functor of small categories, and let $\mathcal{A}$ be a (co)complete category. The pre-composition with $F$ induces a functor
$$F^\ast:\mathbf{Fun}(\mathcal{D},\mathcal{A})\to \mathbf{Fun}(\mathcal{C},\mathcal{A}).$$
A left (resp. right) Kan extension along $F$ is a left (resp. right) adjoint to $F^\ast$.

*

*Is there a sufficient and necessary conditions on $F$, so that the left and right Kan extensions coincide?

*What can one deduce when the left and right Kan extensions coincide?  Particularly, does it imply that $F^\ast$ is an equivalence of categories?


text:
Q: How to create a shared access signature with a stored access policy for an Azure Blob container in Azure Portal? I read about shared access signatures generated with stored access policies for Azure Storage from here.
I also read how to create this shared access signature with stored access policies for Azure Storage using PowerShell here.
However, I want to do the above using Azure Portal. I know how to generate an ad-hoc shared access signature. I also know how to create a stored access policy for a container in my Azure Blob.
How do I create a shared access signature with a stored access policy for an Azure Blob container in Azure Portal?

A: Preview of Storage Explorer is now available in Azure portal.
You can generate SAS for a container by right clicking on the container and select Get Shared Access Signature like we do in Storage Explorer using the preview

A:
How do I create a shared access signature with a stored access policy
  for an Azure Blob container in Azure Portal?

Simple answer to your question is that as of today you can't create a shared access signature (SAS) using a stored access policy in Azure Portal. This feature is not there yet. In fact, feature to create a SAS on a blob container is not there on the portal as of yet. You could only create account level SAS using Azure Portal.
If you need to create a SAS on a container using a stored access policy, please use Microsoft Storage Explorer tool (or any other storage explorer tool that has support for blobs management). Using this tool you will be able to specify a stored access policy when creating a SAS on the container.


text:
Q: Custom attributes for products Magento 2? I'm trying to import around 5k products using Magento's native import. Unfortunately, I can't use third-party tools otherwise I would, I imagine this would simplify the process significantly.
My issue is, I'm trying to import a .csv from a wholesaler who has included a lot of extra information within the CSV I would like to provide potential customers. For example:

*

*Multiple quantities say a pack of 5, pack of 10, pack of 15. I would like this to be a drop-down on my actual site for a user to select before adding to the basket - there doesn't seem to be a csv header for this.

*Manufacturer, allowing me to group products by their respective manufacturer.

*Other custom attributes that I could show under a "details" tab (Like the warranty, expected battery life, screen size) - these would not be applicable to all products, but relevant.

I've tried to look at this for reference, as well as this but I can't seem to get my head around it.


text:
Q: Cant set three items on a single row I have a react component with some content that is going to be shown three times.
I want the components to be on a single row, in three separate columns. I have tried a lot but havent been able to do it.
This is gonna be shown three times:
 return (

{ Utilities.trimWord(this.props.title, 80, '...')}

                        {Utilities.trimWord(this.props.subheader, 50, '...')}

                            <NewsInfo publishedDate={this.props.publishedDate} likes={this.props.likes} comments={this.props.comments} />

                            <NewsTags tags={this.props.tags} tagPageUrl={this.props.tagPageUrl} background={BackgroundType.Grey} />

        );

My CSS:
.grid {
    // display: flex;
    // flex-wrap: wrap;
    // margin: auto auto auto;

    .relatedNews {
        float:left;

        // display: flex;
        &:hover {
            .textContainer i.bookmark {
                display: block;
            }
        }

        .row {
            // display: flex;
            // flex-direction: row;
            // align-items: center;
            display: block;
            width: 400px;

            .imageContainer {
                //position: relative;
                // flex: 0 0 215px;
                float:left;
                width: 115px;
                height: 130px;
                overflow: hidden;
                box-sizing: border-box;
                border: 1px solid #eaeaea;

               /*

                .video {
                    position: absolute;
                    width: 100%;
                    height: 100%;
                    top: 0;
                    right: 0;
                    background-image: linear-gradient(41deg, rgba(0, 0, 0, 0) 77%, rgba(0,0,0,0.8) 110%);

                    i {
                        position: absolute;
                        width: 20px;
                        height: 21px;
                        top: 14px;
                        right: 13px;
                        color: #ffffff;
                        font-size: 20px;

                    }
                }

                */
            }
            .textContainer {
                //position: relative;
               // flex-grow: 1;
                padding-left: 27px;

                @media all and (max-width: 479px) {
                    padding-left: 0;
                }

                a {
                    text-decoration: none;
                }

                .newsTitle {
                    font-size: 17px;
                    color: #333;
                    //margin: 0 0 12px 0;
                    font-weight: normal;
                    //margin-right: 20px;
                    width: 190px;
                }

                .subHeadline {
                    font-size: 15px;
                    color: #858585;
                    margin-bottom: 17px;

                  //  display: inline-block;
                }

                .info {
                    font-size: 12px;
                    color: #c7c7cd;
                }

                .bookmark {
                    position: absolute;
                    top: 0;
                    right: 0;
                    font-size: 18px;
                    padding: 3px;
                    display: none;
                    cursor: pointer;
                    z-index: 9999;
                }
            }
        }

        @media all and (max-width: 479px) {
            display: block;
        }

        // .relatedarticles {
        //   width: 206px;
        //   height: 32px;
        //   font-family: "Segoe UI WestEuropean","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;
        //   font-size: 24px;
        //   font-weight: 300;
        //   font-style: normal;
        //   font-stretch: normal;
        //   line-height: normal;
        //   letter-spacing: normal;
        //   color: #424242;
        // }
    }
}

No mater what I try, the components will never been shown in one single row, but instead in one single column.

A: It seem problem is with your html hence it not wrap properly because there only two column see below so i.e it not showing in three column

                  //This is 1st Column Start

                  //This is 1st Column END
                  //This is 2nd Column Start

{ Utilities.trimWord(this.props.title, 80, '...')}

                        {Utilities.trimWord(this.props.subheader, 50, '...')}

                            <NewsInfo publishedDate={this.props.publishedDate} likes={this.props.likes} comments={this.props.comments} />

                            <NewsTags tags={this.props.tags} tagPageUrl={this.props.tagPageUrl} background={BackgroundType.Grey} />

                  //This is 2nd Column end

if you want the three column to display use below simple html & css Sinpet

.row{
    display: flex;
    flex-wrap: wrap;
    width:100%;
    margin: 0 auto;
}

.row > div{
   flex-basis: 33.33%;
   text-align: center;
   font-size: 24px;
}

Column 1

Column 2

Column 3

A: The way the flex property works, it applies the flex on a direct child and only on a direct child, not it's children's children. So from your example it looks as if you didn't go deep enough on your display: flex; & flex-direction: row; properties.
These properties should be on the text-container class and would make the , ,
, and
 all flex in a row direction.
When you apply display: flex; and flex-direction: row to the row class the only thing flexing is the
 and the
 everything inside the textContainer is still going to display block and hence be vertical because the flex property doesn't extend to children's children.


text:
Q: Antd - How to expand all tree items by default in Table with async data?
*

*The context: I want to create a tree-like Table using the component <Table /> of antd, the data source is loaded asynchronously from the server. And when the data is loaded, I want all the nodes to be expanded.

*Current situation: code sandbox. There are 2 weird points remain:

*

*Look at the images, when in the red rectangle the value is null, the nodes are expanded by default (which is what I want), but when the value in the rectangle is a clone dummy <Table />, the nodes are not expanded, why? Whether is it null nor Table, both would not be used anyway?

*When I click on the collapse button [-] near Phòng ban kinh doanh which is a level 2 node, why does it collapse all the tree? What is wrong with collapsing here?

Updated: I have resolved the 2 concern here. Now, how it make the nodes expanded by default?

A:

*

*Why does the tree expands all by default when rendering the Table conditionally?

In React, default[YourPropValue] (for example defaultValue, defaultChecked,...) is a term frequently used to describe a prop value that only works when the component first mounts, this value is not used in subsequent renders. The default[YourPropValue]  is useful when you want an uncontrolled component where the value is handled by the DOM element, not inside React code, and you want to initialize the value for the first time before React creates an element.
When you render conditionally based on the current data:
data ?
  <Table {...props} defaultExpandAllRows />
  :
  null

First there is no data, you return nothing. After the data is fetched, you start rendering the Table. This is the first time React sees you return the Table so it mounts with the defaultExpandAllRows set to true which works as expected.
The code below behaves differently because when you return the Table for the first time, you doesn't set defaultExpandAllRows (even if you set it, it doesn't matter because there is no data to expand). When the data is fetched, you also return the Table with the populated data. React reuses the last Table component and render for the second time, so the defaultExpandAllRows prop doesn't work anymore:
data ?
  <Table {...props} dataSource={data} />
  :
  <Table {...props} dataSource={[]} defaultExpandAllRows />

A simple solution to fix it is to tell React that the empty Table and the Table with the populated data is different so it can unmount and remount the component and make the default value applied correctly:
data ?
  <Table {...props} dataSource={data} defaultExpandAllRows />
  :
  <Table {...props} dataSource={[]} key='dummyTable' />

A: they say they only do on inital render https://github.com/ant-design/ant-design/issues/19166
so unfortunately the easiest way to do that with this limitation is
set initial state of data to null, and if there is no data don't render table
https://codesandbox.io/s/dreamy-drake-2287i?file=/index.js

A: Incase if anyone looking for how to use defaultExpandAllRows in latest versions, try like this
<Table ... expandable={{ defaultExpandAllRows: true }} />
Here's more info


text:
Q: End of the 2nd mission cinematic (spoilers from flashpoint) If I recall correctly after Flashpoint,

 The raiders only had 1 battlecruiser in their fleet.
 The Bucephalus gave it's life to allow the Hyperion to escape Mengsk trap in Narud's labs.
 So why does Valerian have 6 or 7 battlecruiser in his "fleet" in the cinematic? Where did they get that fleet?

A: Prince Valerian is working with the Umojan Protectorate (hence the base on... Umoja).
Given that all of the units in the first two missions are either mercenaries or Umojan forces. (Instead of War Pig mercenaries, the unit, when selected, explicitly states "Umojan Marine") it seems a fair assumption that these ships and soldiers belong to the Umojans, who are working with Valerian for unknown reasons.


text:
Q: how to retrieve xml data from three tables of mysql I want to retrieve xml data from three table stored in MySQL. I used the below code it works fine but first it retrieve one record from first table than iterate to second table and print the whole table and then iterate to third table and print the whole table but I want to print first table along with relevant records in second table (not whole table) then from third table and so on. My code is:
$table_first = 'recipe';
$query = "SELECT * FROM $table_first";
$resouter = mysql_query($query, $conn);

$table_second='instructions';
$query="SELECT instructions.instruction_id,instructions.instruction_text FROM $table_second";
$resinner=mysql_query($query, $conn);

$table_third='ingredients';

$query="SELECT ingredients.ingredient_id,ingredients.ingredient_name,ingredients.ammount FROM $table_third";
$resthird=mysql_query($query, $conn);

$doc = new DomDocument('1.0');

$root = $doc->createElement('recipes');
$root = $doc->appendChild($root);

while($row = mysql_fetch_assoc($resouter)){

$outer = $doc->createElement($table_first);
$outer = $root->appendChild($outer);

 foreach ($row as $fieldname => $fieldvalue) {
    $child = $doc->createElement($fieldname);
    $child = $outer->appendChild($child);
    $value = $doc->createTextNode($fieldvalue);
    $value = $child->appendChild($value);
  }// foreach
 //while
$inner = $doc->createElement($table_second);
    $inner = $outer->appendChild($inner);
 while($row = mysql_fetch_assoc($resinner)){
    // add node for each record

    $inner1=$doc->createElement('instruction');
    $inner1=$inner->appendChild($inner1);
    // add a child node for each field
    foreach ($row as $fieldname => $fieldvalue) {
        $child = $doc->createElement($fieldname);
        $child = $inner1->appendChild($child);
        $value = $doc->createTextNode($fieldvalue);
        $value = $child->appendChild($value);
    } // foreach
 }// while

 $inner=$doc->createElement($table_third);
    $inner=$outer->appendChild($inner);

while($row=mysql_fetch_assoc($resthird)){

     $inner2=$doc->createElement('ingredient');
    $inner2=$inner->appendChild($inner2);

    foreach($row as $fieldname=> $fieldvalue)
    {
        $child=$doc->createElement($fieldname);
        $child=$inner2->appendChild($child);
        $value=$doc->createTextNode($fieldvalue);
        $value=$child->appendChild($value);
    }
}
}

mysql_close($conn);
$xml_string = $doc->saveXML();
echo $xml_string;

A: There is a much better way to accomplish what you're doing.  It looks as though you pulling data from 3 different tables, using three different SQL queries, and three calls to the database.
The best way to accomplish this would be to build your table on the SQL side, using a single query.   The queries are a little more complicated (you'll need JOIN) however the result will be much easier to work with in your program.   You'll also probably avoid having to create your document on the fly using DOM.  You could simple build your recipe using SQL, pull the whole result back and simply iterate through the table with the result.


text:
Q: Struggled with some unknown css-overriding issues by "inline" I have recently a css-overriding problem with kind of "unknown" reason.
The background:
I have constructed a website which contains a table with three columns and in the middle column is a map constructed with help of openlayers, the other columns just show some Infos to the map/layers.
The Problem:
I have all the css under control until I set a popover with jQuery to show some map informations. The popover it self works well but at the moment the popover-window shows, all the css-styles for the whole table change without a reason (e.g. font-size for the table, text-aglin, etc.).
When I check which document has overridden my css, it shows the html tag "tbody" would be changed by "inline" like the picture below:

But I don't even have a tbody Tag in my html, which i am sure and I also don't write any inline style css which may could have been the reason.
The original codes are too long to post hier so I just want to ask:

*

*In the picture, I tried to override the font-size by give the  tag a class, the debug-tool shows that my css style has the first priority but the font-size is still 11.2px not what I defined 14 px. How is that possible?

*Even I don't have a tbody tag in my html. The tbody tag will be styled by "Inline", what is Inline here actually (If I click the "inline", it shows me ol.css and it contains no usefull information) and how is the possible?

A: There are a couple of misunderstanding here, which I'll try to clarify.

*

*Every
 these days has a
, even if you don't specify it yourself. Meaning that

...

 becomes

...

 in the browser.

*The tbody font-size style is an inline style, meaning that something like tbody { font-size: 80% } was declared not in a .css file but in the page itself; either in a  block or by using
 (but you said that
 does not occur on the page).


text:
Q: Exclude errors from Summary Report in Jmeter I want to exclude errors results from summary report
for example, as u see on image below, there is few errors in responses when thread was working
enter image description here
Is there any solution to exclude failed requests with errors response from summary?
Not skip with Beanshell listener, like
if (sampleResult.getResponseMessage().equals("Non HTTP response message: Connection reset")) {
    sampleResult.setSuccessful(true);
}

but exclude at all and report only success response

A: *

*First of all I would recommend getting familiarized with JMeterSocketClosed wiki article as the errors you're getting might indicate the problem with the application under test. If you're absolutely sure that the application is fine there are hints on how you can amend JMeter configuration to prevent these "Connection reset" issues from happening

*You can mark all Samplers as successful by using Response Assertion configured like:

*All failed requests can be removed by Filter Results tool like:
FilterResults --output-file only-success.csv --input-file original-results-file.csv --success-filter true

Filter Reuslts Tool can be installed using JMeter Plugins Manager

*Since JMeter 3.1 you should be using JSR223 Test Elements and Groovy language for scripting


text:
Q: jQuery. Placeholder remove on focus and back on blur The site has input fields. No matter what. No matter how many. How to make it so that when the focus in each field placeholder is completely removed, and the loss of focus - placeholder back in its place.

A: There you go:

$(function(){
 $('input').on('focus blur', function(){
     if($(this).attr('placeholder')){
         $(this).attr('placeholder', '');
        } else {
         $(this).attr('placeholder', 'Placeholder');
        };
    });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" placeholder="Placeholder">

But the next time please provide some code of what you tried.

A: It's browser default behaviour(unless it's Old IE 9,8) to remove placeholder text on focus and put it back on blur if the field is empty. What do you want to achieve?
For unsupported browsers, use plugin https://github.com/mathiasbynens/jquery-placeholder. It's support passwords fields as well.