c # – Grouping into several groups in a single iteration

I needed to group the same dataset into several groups. So, instead of repeatedly querying the dataset, I've created an extension capable of doing it once. The caveat is that the result is materialized in dictionaries, because I have not managed to find a way to avoid that. Maybe you can?

public static IDictionary <string, Dictionary <object, HashSet>> MultiGroupPar(this IEnumerable source, params (string Label, Func getter)[] groupers)
{
if (source == null) throws a new argument ArgumentNullException (nameof (source));
if (groupers == null) throws a new argument ArgumentNullException (nameof (groupers));

IDictionary <string, Dictionary <object, HashSet>> results = new Dictionary <string, Dictionary <object, HashSet>> ();

using (var enumer = source.GetEnumerator ())
{
while (enumer.MoveNext ())
{
foreach (var label, var func) in grouper)
{
if (! results.TryGetValue (label, as dictation))
{
dict = new Dictionary <object, HashSet> ();
results[label] = dict;
}

var key = func (enumer.Current);
if (! dict.TryGetValue (key, out var set))
{
set = new HashSet();
dict[key] = together;
}

set.Add (enumer.Current);
}
}

}

return the results;
}

Use case:

static empty TestMultiGrouping ()
{
chain[] data =
{
"Black",
"White",
"Yellow",
"green",
"Red",
"blue",
"Cyan"
"Magenta",
"Orange"
};

foreach (result var in data.MultiGroupBy (
("First UCase", s => s.Length> 0 && char.IsUpper (s[0])),
("Length", s => s.Length),
("Length four", s => s.Length == 4),
("Contains & # 39;"), s => s.Contains (& # 39; e),
("Num n", s => s.Count (c => c == n))))
{
Console.WriteLine ($ "Results for {result.Key}:");
foreach (var dict in result.Value)
{
Console.WriteLine ($ "{dict.Key}: {dict.Value.Count} [{(string.Join(", ", dict.Value))}]");
}
Console.WriteLine ();
}
}

cta – A single linked button or a linked integer?

Without seeing the broader context of your user interface and your use case, the advantage of a larger contact area is that the user "clicks" or selects the CTA in a larger contact area.

look Law of Fitt

Fitts' law states that the time required for a person to move a pointer (for example, the mouse cursor) over a target area is a function of the distance to the target divided by the size of the target. Thus, the longer the distance and the smaller the size of the target, the longer it takes.

By making the whole map clickable (or mobile-touch), you reduce the time needed to move the mouse and allow less skilled users to select it correctly.

Are there disadvantages for users accidentally by selecting this CTA?

If they engage in irreversible action, you can simply keep the button clickable, but you have not suggested that CTA is destructive or irreversible in your question, as indicated.

php – How to make a query in SQL grouped in a single record in MYSQL?

Good nights, I suffer from a query that I am implementing in my system. I currently have the following tables:

activities:
enter the description of the image here

tasks:
enter the description of the image here

The task table has idactividad as foreign to the table of activities.
What I want to do is show the percentage of tasks in each activity.

For example: "Activity 1" has "3 tasks" that are in the current state. Therefore, the progress of the activity would be 100%. If a task had the initial state (pending), the activity would have a lead of about $ 66.66. .

I hope your support. Thank you

Is it reasonable, if we use the popup mode for Single Sign On?

Our apps have oauth for Google, and we use popup mode. Login page have a button for authorization via google. But now, customers want to use single sign-on (SSO).
As I know SSO, we did not use a login application, we redirect to the login page of the SSO website.
It is therefore logical to use the popup mode for single sign-on. We put the keycloak button (SSO), and show a popup for authorization. But it's the flow is the same oauth.
Would you like to show me a reasonable way to use the popup mode for SSO or SSO to use only the redirection mode.

Permanent merge of objects into a single object (Adobe Illustrator)

In Adobe Illustrator, I have a file that has a lot of points aligned closely, so that it seems like they are forming a line. The ".ai" file is very large (55 MB). To reduce the size of the file, is there a way to permanently merge the aligned points into a single object?

Note that I know the following options, which I am explicitly do not looking for:

  1. group their,
  2. Transform them into compound path,
  3. Manually replace the points for a line.

The first two options do not work for me because they do not reduce the file size. The third option does not work for me because I have a lot of separate "score lines" so it would be too laborious to replace them all.

However, it may be feasible to separately select each row of points and then convert them to a single object.

In short, to reduce the file size, how can I merge objects permanently and irreversibly into one, please? Thank you.

SQL Server – Save a single table

I would recommend using the BCP utility. From this documentation:

Copy rows from a table to a data file (with a secure connection)

Basic

This example creates a data file named StockItemTransactions_character.bcp and copies the data from the table using the character format.

At the command prompt, enter the following command:

bcp WideWorldImporters.Warehouse.StockItemTransactions on D:  BCP  StockItemTransactions_character.bcp -c -T

logstash – Configuring multiple data types with a single filter

I have several types of data that I put logstash to configure it. I'm writing a filter, but this filter only works for some of my data and is perfectly suited to its filter context. How to type a filter able to configure all my data?

This is my filter:

filter {


if[method]== "POST"
{
grok {
match => {
& # 39; "% {DATA: username} [%{HTTPDATE:time_local}] "% {WORD: method}% {DATA: type}?% {WORD: page} =% {DATA: page_size} &% {DATA: referrer_page_size} =% {DATA: total_page} HTTP /% {NUMBER: http_version}" % {NUMBER: response_code} (?:% {NUMBER: bytes} | -) "% {DATA: login} //% {DATA: search} /% {DATA: try2} / ?% {DATA: typeof_query} = % {DATA: look_for} ""% {DATA: agent} ""% {DATA: http_x_forwarded_for} ""% {DATA: country} "& # 39;
}
}


}
}

Here are my first data:

IP adress - - [01/Jul/2019:15:36:18 +0300] "POST / search? Page = 1 & page_size = 25 HTTP / 1.1" 200 78 "https://dofo.com/search/?contains=pflichtteilberatung" "Mozilla / 5.0 (Windows NT 10.0; Win64; x64; rv: 67.0 ) Gecko / 20100101 Firefox / 67.0 "" IP Address "" DE "

This is my second data:

IP adress - - [01/Jul/2019:12:46:26 +0300] "POST / search? Page = 64 & page_size = 100 HTTP / 1.1" 200 3171 "https://try.com/search/?on_sale=y&price_max=3000&sale_type=1,3&extension=com&length=1-15&hyphen=n&number=n&number= n & idn = n & cdate_min = 19971105 & sort = cdate_a & page_s = 100 & page = 64 "" Mozilla / 5.0 (Windows NT 10.0; Win64; x64) AppleWebKit / 537.36 (KHTML, like Gecko) Chrome / 75.0.3770.100 Safari / 537.36 "" IP address "" BD "

That's my third data:

IP adress - - [01/Jul/2019:03:09:55 +0300] "POST / search? Page = 1 & page_size = 100 HTTP / 1.1" 200 2661 "https://try.com/search/?contains=real&page_s=100" "Mozilla / 5.0 (Macintosh, Intel Mac OS X 10_14_5) AppleWebKit / 537.36 (KHTML, like Gecko) Chrome / 75.0.3770.100 Safari / 537.36 "" IP Address "" LT "

I want to analyze them after "Https://try.com/search/?" value. For the first data I need "Contains" land with "Pflichtteilberatung" value
For the second data I need "on sale" land with "Y" value and "PRICE_MAX" land with "3000" value …..
For the third one I need "Contains" land with "real" value and "Page_s" land with "100" value.

Is it possible to do this in the logstash filter?

interface – monthly payment and single payment in one place

Hello, I am making a payment space, where the user can buy a monthly product and a single purchase product, the project owner requests that the payment be the same for both forms, that 's the same. it is a credit card or bank statement. But it makes no sense to pay for a product that is paid monthly in multiple installments with one purchase. Would any one have any suggestions?

enter the description of the image here

What if I create configurations in a single product?

What will happen if I create configurations in a single product? Will the simple product switch itself into a configurable product?

html5 – Generate a single header in Table with PHP with Foreach

One possibility is that the table encapsulates the forbecause this allows for the unique presentation of the header and iterates the build function of the table body.

        // The beginning of the table and the header are outside for and foreach loops
echo "";
echo "";
echo "";
echo "";
echo "";
echo "";
echo "";
echo "";
echo "";
echo "";
echo& # 39 ;;

echo ""I added the statement of the body of the table

// I kept the same code in php I just removed spaces and comments
for ($ i = 0; $ i < count($arquivo);$i++ ){
     $totArquivos +=count($arquivo);  
     foreach( $arquivo as $arquivo[$i]){        
        $xml ->load ($ file[$i]) or die ("");
$ file[$i] = $ xml-> getElementsByTagName ("nfeProc");
$ keyS = $ xml-> getElementsByTagName ("infNFe");
$ key = $ keyS-> item (0) -> getAttribute ("Id");
$ dataEMS = $ xml-> getElementsByTagName ("dhEmi");
$ dataEmi = $ dataEMS-> item (0) -> nodeValue;
$ cfopS = $ xml-> getElementsByTagName ("CFOP");
$ cfop = $ cfopS-> item (0) -> nodeValue;
$ modelS = $ xml-> getElementsByTagName ("mod");
$ model = $ modelS-> item (0) -> nodeValue;

// This part of the code is specific to the construction of table rows.

echo "";
echo "";
echo "";
echo "";
echo "";
echo "";
echo "";
echo "";

} // Leave the foreach block
} // Close the block for

echo "// close the body of the table

echo "
ACCESS KEYDate of issueCFOPValueModelStatus
key $".date ('j / m / y', strtotime ($ dataEmi))."$ cfop".number_format ($ vaPag, 2)."model reason
"// Conclude the table declaration

To encapsulate, I practically kept your code. I just restructured it and removed the comments and spaces between the lines in order to center the PHP code and highlight the purpose that is the structure of the table outside the iterators.

I removed it from the inside for each the table declaration, opening tag

I put it before for and the closing tag

I put it after for. I also took the header and I grouped it next to the opening tag of the table.

I put the tag

.

In the for each I just left the tags responsible for generating the rows of the table.

And here is the code of the question with the modification:

load ($ files) or die ("");
// Gets inside the parent node of XML
$ files = $ xml-> getElementsByTagName ("nfeProc");

// Get the name
$ names = $ xml-> getElementsByTagName ("xName");
$ name = $ names-> item (0) -> nodeValue;
// Get the CNPJ
$ cnpjS = $ xml-> getElementsByTagName ("CNPJ");
$ cnpj = $ cnpjS-> item (0) -> nodeValue;

// Display the data of the transmitter
echo "
"; echo "
Company (general ledger):

name

"; echo "
CNPJ:

$ cnpj

"; echo "
"; pause } // I do not understand why this redundancy ??? $ file = $ file; // The beginning of the table and the header are outside for and foreach loops echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo& # 39 ;; echo ""I added the statement of the body of the table // modified fragment for ($ i = 0; $ i < count($arquivo);$i++ ){ $totArquivos +=count($arquivo); foreach( $arquivo as $arquivo[$i]){ $xml ->load ($ file[$i]) or die (""); $ file[$i] = $ xml-> getElementsByTagName ("nfeProc"); $ keyS = $ xml-> getElementsByTagName ("infNFe"); $ key = $ keyS-> item (0) -> getAttribute ("Id"); $ dataEMS = $ xml-> getElementsByTagName ("dhEmi"); $ dataEmi = $ dataEMS-> item (0) -> nodeValue; $ cfopS = $ xml-> getElementsByTagName ("CFOP"); $ cfop = $ cfopS-> item (0) -> nodeValue; $ modelS = $ xml-> getElementsByTagName ("mod"); $ model = $ modelS-> item (0) -> nodeValue; // This part of the code is specific to the construction of table rows. echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } // Leave the foreach block } // Close the block for echo "// close the body of the table echo "
ACCESS KEYDate of issueCFOPValueModelStatus
key $".date ('j / m / y', strtotime ($ dataEmi))."$ cfop".number_format ($ vaPag, 2)."model reason
"// Conclude the table declaration ?>