text:
Q: iFrame URL parameter to an in Wordpress? I have a page which has an iframe embed of an external page. I want to find zip code
Here is my iframe:
<iframe src="http://mortgagerates.icanbuy.com/?zip=" width="1020" height="1200">

http://mortgagerates.icanbuy.com/?zip=10458 (Main Site )
But i want i frame and my browser url same below:
http://www.mysite.com/?zip=10458 (I want something like that)
Is this possible in wordpress? how?

A: Please check it.. I hope work it...
<iframe src="http://mortgagerates.icanbuy.com/?zip" width="1020" height="1200"  class="iframe-wrapper">

And add this jQuery. Thats It!
<script type="text/javascript">
     $(function() {
    var search = window.location.search;
    search = search.replace("?","&");

    $(".iframe-wrapper").attr("src", $(".iframe-wrapper").attr("src")+search);
    });
</script>

A: This is ajax page. you want to use ajax.
http://mortgagerates.icanbuy.com/ajax/rates-search?callback=jQuery17209362620610679678_1385958692723&source=1&results_count=0&period=PERIOD_FIXED_30YEARS&state=33&property_type=34&occupancy=49&fico=740&points=1.5&currently_working=Yes&property_interested=Yes&show_fha=0&cashout=0&city=10458&valoans=0&militaryaff=1&hadvabefore=0&rate_lock=99&loan=200000&transaction=54&ltv=80&cltv=80&DO_UPDATE_WRITE=0&id=d4ea9f8db0477778&external=0&_=1385958692873

you need to pass your zipcode into city=10458. its return json encoded format. you simply parse this into your design.


text:
Q: Docker Flask app behind nginx reverse-proxy sending 404 Tl;DR:
I have a running Flask application in a docker container. When I set up a nginx reverse proxy on the host machine in order to avoid having to enter the port number in the URL, the app send a 404 each time I hit the homepage at the defined nginx location. Why?
Context
I've got a prototype Flask app running as:
flask run --host 0.0.0.0 --port 5000

It's dockerized and is exposed on port 8080 in a compose file:
ports:
  - "8080:5000"

Everything is working fine and when I hit the homepage at http://my-server.org:8080, the server happily says:
web_1  | in route /
web_1  | 166.24.119.203 - - [24/Sep/2041 10:29:20] "GET / HTTP/1.1" 200 -
web_1  | 166.24.119.203 - - [24/Sep/2041 10:29:21] "GET /static/css/style.css HTTP/1.1" 200 -
web_1  | 166.24.119.203 - - [24/Sep/2041 10:29:21] "GET /static/favicon.ico HTTP/1.1" 200 -

Now, in order to avoid having to enter the port in the URL, I've setup a simple MWE nginx reverse-proxy config file in /etc/nginx/sites-available/ on the host machine (not yet dockerized for simplicity) and which is automatically sym-linked in sites-enabled/. This file contains the following:
server {
    listen 80;
    listen [::]:80;

    server_name my-server.org;

    location /my-app {
        proxy_pass http://127.0.0.1:8080;
    }
}

Please, note that nginx is properly running:
# service nginx status
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2021-01-30 10:48:17 CET; 54min ago
   ...

Now, each time I hit the homepage at http://my-server.org/my-app now, the server returns:
web_1  | 172.27.0.1 - - [24/Sep/2041 12:34:26] "GET /my-app HTTP/1.0" 404 -

If that can help, I noticed that the IP shown here is actually the Gateway value of the my-app_default docker network used by the service.
Question
How do I get my Flask app to properly work behind the nginx reverse-proxy?
I hope to understand enough from the answer(s) to be able to set up the same thing using gunicorn after.

A: That
    location /my-app {
        proxy_pass http://127.0.0.1:8080;
    }

adds /my-app to http://127.0.0.1:8080.
Fix: Add a slash / after port:
    location /my-app/ {
        proxy_pass http://127.0.0.1:8080/;
    }

Yes, slash at end makes often a big difference in Nginx.
It is equivalent to:
    location /my-app/ {
        rewrite ^/my-app(.*)$ $1 last;
        proxy_pass http://127.0.0.1:8080;
    }

IIRC, but I never use it.
BTW: Normally you put the symlink in sites-enabled not in sites-available.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to create chartjs chart with data from database C# I am trying to create a chart.js graph in my .Net Core Web app, with data from the database. I am using ajax to call a method that will pull the data from the database, but I'm unsure how to group the data to display in the graph.
At the moment I have a database that looks like so:

I am looking to show the time along the bottom and count how many jobs success and how m any jobs exception. At the moment my graph is hard coded.

// Area Chart Example
var ctx = document.getElementById("canvas")
var lineChartData = {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [{
    label: 'Failed',
    borderColor: "MediumSeaGreen",
    backgroundColor: "MediumSeaGreen",
    fill: false,
    data: [
        30000, 30162, 26263, 18394, 18287, 28682, 31274, 33259, 25849,
 24159, 32651, 31984, 38451
    ],
    yAxisID: 'y-axis-1',
}, {
    label: 'Exceptioned',
    borderColor: "Tomato",
    backgroundColor: "Tomato",
    fill: false,
    data: [
        20000, 30162, 26263, 33259, 18287, 28682, 25849, 18394, 25849,
 24159, 32651, 31984, 38451
    ],
    yAxisID: 'y-axis-2'
}]
};

window.myLine = Chart.Line(ctx, {
    data: lineChartData,
    options: {
        responsive: true,
        hoverMode: 'index',
        stacked: false,
        title: {
            display: true,
            text: 'Processes'
        },
        scales: {
            yAxes: [{
                type: 'linear',
                display: true,
                position: 'left',
                id: 'y-axis-1',
            }, {
                type: 'linear',
                display: true,
                position: 'right',
                id: 'y-axis-2',

                // grid line settings
                gridLines: {
                    drawOnChartArea: false, // only want the grid lines for one axis to show up
                },
            }],
        }
    }
});

A: Here is a simple demo like below:
1.Model:
public class Job
{
    public int JobId { get; set; }
    public string JobName { get; set; }
    public string JobStatus { get; set; }
    public DateTime JobCompletion { get; set; }
}

2.View:
<canvas id="canvas" width="400" height="400"></canvas>
@section Scripts{
    <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.bundle.js" integrity="sha256-qSIshlknROr4J8GMHRlW3fGKrPki733tLq+qeMCR05Q=" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.bundle.min.js" integrity="sha256-xKeoJ50pzbUGkpQxDYHD7o7hxe0LaOGeguUidbq6vis=" crossorigin="anonymous"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.css" integrity="sha256-IvM9nJf/b5l2RoebiFno92E5ONttVyaEEsdemDC6iQA=" crossorigin="anonymous" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.js" integrity="sha256-arMsf+3JJK2LoTGqxfnuJPFTU4hAK57MtIPdFpiHXOU=" crossorigin="anonymous"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.css" integrity="sha256-aa0xaJgmK/X74WM224KMQeNQC2xYKwlAt08oZqjeF0E=" crossorigin="anonymous" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.js" integrity="sha256-Uv9BNBucvCPipKQ2NS9wYpJmi8DTOEfTA/nH2aoJALw=" crossorigin="anonymous"></script>
    <script>
        function GetJSON_Simple() {
          var resp = [];
              $.ajax({
                  type: "GET",
                  url: '/Jobs/Index',
                  async: false,
                  contentType: "application/json",
                  success: function (data) {
                      resp.push(data);
                  },
                  error: function (req, status, error) {
                      // do something with error
                      alert("error");
                  }
              });
          return resp;
     }
        var simpleData = GetJSON_Simple();
        var ctx = document.getElementById("canvas")
        var lineChartData = {
            labels: simpleData[0].myDate,
            datasets: [{
                label: 'Sucess',
                borderColor: "MediumSeaGreen",
                backgroundColor: "MediumSeaGreen",
                fill: false,
                data:   simpleData[0].mySuccess,
                yAxisID: 'y-axis-1',
            }, {
                label: 'Exceptioned',
                borderColor: "Tomato",
                backgroundColor: "Tomato",
                fill: false,
                data: simpleData[0].myException,
                yAxisID: 'y-axis-2'
            }]
        };

        window.myLine = Chart.Line(ctx, {
            data: lineChartData,
            options: {
                responsive: true,
                hoverMode: 'index',
                stacked: false,
                title: {
                    display: true,
                    text: 'Processes'
                },
                scales: {
                    yAxes: [{
                        type: 'linear',
                        display: true,
                        position: 'left',
                        id: 'y-axis-1',
                    }, {
                        type: 'linear',
                        display: true,
                        position: 'right',
                        id: 'y-axis-2',

                        // grid line settings
                        gridLines: {
                            drawOnChartArea: false, // only want the grid lines for one axis to show up
                        },
                    }],
                }
            }
        });

    </script>
}

3.Controller:
public class JobsController : Controller
{
    private readonly YourContext _context;

    public JobsController(YourContext context)
    {
        _context = context;
    }

    // GET: Jobs
    public async Task<ActionResult> Index()
    {
        var date = await _context.Job.Select(j => j.JobCompletion).Distinct().ToListAsync();
        var success =_context.Job
            .Where(j => j.JobStatus == "Success")
            .GroupBy(j => j.JobCompletion)
            .Select(group=>new {
                JobCompletion = group.Key,
                Count=group.Count()
            });
        var countSuccess = success.Select(a => a.Count).ToArray();
        var exception = _context.Job
            .Where(j => j.JobStatus == "Exception")
            .GroupBy(j => j.JobCompletion)
            .Select(group => new {
                JobCompletion = group.Key,
                Count = group.Count()
            });
        var countException = exception.Select(a => a.Count).ToArray();
        return new JsonResult(new { myDate=date,mySuccess= countSuccess, myException= countException });
    }
}

4.Database:

5.Result:

A: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script src="jquery-3.3.1.min.js" type="text/javascript"></script>
    <script src="chart.js" type="text/javascript"></script>

</head>
<body>
    <form id="form1" runat="server">

    <select id="ddlyear">
    <option>2010</option>
    <option>2011</option>
    <option>2012</option>
    <option>2013</option>
    <option>2014</option>
    <option>2015</option>
</select>

<select id="ddlMonth">
    <option value="1">Jan</option>
    <option value="2">Feb</option>
    <option value="3">Mar</option>.......... ...........</select>
<button id="btnGeneratePieChart">Show</button>
<br/>

<script type="text/javascript">

    $(document).ready(function () {

        $("btnGeneratePieChart").on('click', function (e) {
            e.preventDefault();
            var gData = [];
            gData[0] = $("#ddlyear").val();
            gData[1] = $("#ddlMonth").val();

            var jsonData = JSON.stringify({
                gData: gData
            });
            $.ajax({
                type: "POST",
                url: "WebService.asmx/getTrafficSourceData",
                data: jsonData,
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: OnSuccess_,
                error: OnErrorCall_
            });

            function OnSuccess_(response) {
                var aData = response.d;
                var arr = [];
                $.each(aData, function (inx, val) {
                    var obj = {};
                    obj.color = val.color;
                    obj.value = val.value;
                    obj.label = val.label;
                    arr.push(obj);
                });
                var ctx = $("#myChart").get(0).getContext("2d");
                var myPieChart = new Chart(ctx).Pie(arr);
            }

            function OnErrorCall_(response) { }
            e.preventDefault();
        });
    });

</script>

<canvas id="myChart" width="200" height="200"></canvas>

    </form>
</body>
</html>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;
using System.Web.Services;
using System.Data.SqlClient;
using System.Configuration;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    public class trafficSourceData
    {
        public string label { get; set; }
        public string value { get; set; }
        public string color { get; set; }
        public string hightlight { get; set; }
    }

    [WebMethod]

    public List<trafficSourceData> getTrafficSourceData(List<string> gData)
    {
        List<trafficSourceData> t = new List<trafficSourceData>();
        string[] arrColor = new string[] { "#231F20", "#FFC200", "#F44937", "#16F27E", "#FC9775", "#5A69A6" };

        string conn = ConfigurationManager.ConnectionStrings["ConString"].ConnectionString;

        using (SqlConnection cn = new SqlConnection(conn))
        {
            string myQuery = "select * from traffic_data where YEAR =@year and MONTH=@month";
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = myQuery;
            cmd.CommandType = CommandType.Text;
            cmd.Parameters.AddWithValue("@year", gData[0]);
            cmd.Parameters.AddWithValue("@month", gData[1]);
            cmd.Connection = cn;
            cn.Open();
            SqlDataReader dr = cmd.ExecuteReader();
            if (dr.HasRows)
            {
                int counter = 0;
                while (dr.Read())
                {
                    trafficSourceData tsData = new trafficSourceData();
                    tsData.value = dr["visit_count"].ToString();
                    tsData.label = dr["traffic_source"].ToString();
                    tsData.color = arrColor[counter];
                    t.Add(tsData);
                    counter++;
                }
            }
        }
        return t;
    }

}


text:
Q: How to add an image before a radio input in jsonschema-form lib? I'm using jsonschema-form lib and I would like to add an image before a radio input.
This image is an example of the final result:

My JSONSchema is:
"type": "object",
"title": "Title",
"properties": {
   "turni": {
      "type": "string",
      "format": "radio",
      "enum": ["optA", "optB", "optC"],
      "enumNames": ["a", "b", "c"],
      "images":["url-a", "url-b", "url-c"]
   }
}

How I can customize a radio widget for my purpouse?

A: I solved this issue in this way:
    "turns": {
        "type": "string",
        "represents": "turns",
        "enum": "option1", "option2", "option3"],
        "enumNames": ["a", "b", "c"],
        "uniqueItems": true,
        "imgs":["data:image/png;base64,...",
                "data:image/png;base64,...",
                "data:image/png;base64,..."
               ]
        }


text:
Q: Unable to save fetched data in Jquery I'm working on my front-end, and I've arrived at a roadblock. I'm trying to fetch data from my back-end, and it is actually fetching the data. But only after everything else? I'll show you.
$(function(){
    function GetURLId() {
        var url = window.location.href;
        var path = url.substring(url.lastIndexOf('/') + 1);
        var id = path.substring(path.lastIndexOf('?id=') + 4, path.lastIndexOf("?id") + 5)
        return id;
    }

    var url = 'https://localhost:5001/api/rental/byId/' + GetURLId();

        fetch(url)
        .then((resp) => resp.json())
        .then(function(data) {
            Object.keys(data).forEach(key => {
                console.log(`${key}: ${data[key]}`);
            })
        });
});

So first I get which id I'm working with out of the URL. Then where the problem lays is the code under it. I'm able to fetch my data as it console.logs this:
id: 2
status: "Open"
damage: true

So the data does actually fetch from my back-end. But now, everytime I try to save the data it goes undefined. I've tried:
$(function(){
    var rental = []; // Added an array
    var url = 'https://localhost:5001/api/rental/byId/' + GetURLId();

        fetch(url)
        .then((resp) => resp.json())
        .then(function(data) {
            Object.keys(data).forEach(key => {
                console.log(`${key}: ${data[key]}`);
                rental.push(rental[key] = data[key]);
            })
        });
    console.log(rental['id']); // Returns undefined
});

And:
var rental = []; // Added an array outside of the function
$(function(){
    var url = 'https://localhost:5001/api/rental/byId/' + GetURLId();

        fetch(url)
        .then((resp) => resp.json())
        .then(function(data) {
            Object.keys(data).forEach(key => {
                console.log(`${key}: ${data[key]}`);
                rental.push(rental[key] = data[key]);
            })
        });
    console.log(rental['id']); // Returns undefined
});

But! With the last one where the rental is outside of the function, I can actually call it in the console. And in the console it actually does return the value.
Inside Console:
> rental["id"]
< 2

Lastly I've tried to check the value of the key and value inside of the fetch, like this:
$(function(){
    var url = 'https://localhost:5001/api/rental/byId/' + GetURLId();

        fetch(url)
        .then((resp) => resp.json())
        .then(function(data) {
            Object.keys(data).forEach(key => {
                if(key == "status" && data[key] != "Reserved") {
                    console.log(`${key}: ${data[key]}`); // Returns damage: undefined 3 times
                }
            })
        });
});

But this as well doesn't work. It returns damage: undefined 3 times in console.
So if anyone knows what is going on here it would be awesome!
Thanks alot in advance.

A: Fetch requests are asynchronous. This means that when you call fetch it might take a while to complete it, so JavaScript allows the rest of the code to continue without blocking. So logging anything to the console before your request has finished will obviously result in an empty array.
Also, Arrays are index-, not name based in JavaScript. However, because arrays are essentially objects it still works, but you should never do the following below.
var rental = [];
rental['id'] = 'foo';
console.log(rental['id']);

Instead use a plain object which is meant to be used that way.
var rental = {};
rental['id'] = 'foo';
console.log(rental['id']);

In your last example you seem to do everything just fine. Are you sure your fetched data does not have a value of undefined in its structure? It would help to see what the data looks like.

A: The answer: 2 errors in my code.
 - First I didn't properly account for the asynchronous nature of the code.
 - Second, when trying to fix it with another then block and executing my code in there. I didn't return a value in the proceeding then block, but the forEach instead.
fetch(url)
        .then(resp => resp.json())
        .then(data => {
            var rentalStatus;
            Object.keys(data).forEach(key => {
                rental[key] = data[key];
                if(key == "status") {
                    rentalStatus = data[key];
                }
            })
            return rentalStatus;
        })
        .then(rentalStatus => {
            console.log(rental["id"]); // This does return the id now!
            if(rentalStatus == "Reserved") {
                $("#assign-items").removeClass("d-none");
            }
        }).catch(error => {
            console.log("Error:" + error);
        });


text:
Q: Win32 application not finding icon for window I created a icon as a resource

I checked explorer and it works just fine, my exe now has that icon
Next, I used hIcon to set the icon of my window but it says that IDI_ICON1 is undefined

Code:
wc.hIcon = LoadIcon (hInstance, MAKEINTRESOURCE(IDI_ICON1));

Is there any idea of why this is happening?

A: Symbolic constants for resource identifiers (such as IDI_ICON1) are usually stored in a separate header file called Resource.h by default. This allows both the resource script (.rc file) as well as source code to access the same symbols.
To use the constants in source code you need to introduce them through an #include directive. Otherwise the compiler is unable to find them, as the error messages indicates.


text:
Q: How to move "THANK YOU" to center
and this is part of my code

THANK YOU

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

            ระบบได้ทำการจองสินค้าของท่านเรียบร้อย

            <button type="button" class="btn btn-dark" data-dismiss="modal">Close</button>

How can I move "THANK YOU" to center? I have already tried centering it with align, but it doesn't seem to work.

A: EDIT: I created a container div element that contains the modal. Now you can use text-align: center; so that you can center the 'THANK YOU' text. Also, I added fit-contents so that the container can be easily moved about and resized as needed without effecting it's content or the other way around.

THANK YOU

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

ระบบได้ทำการจองสินค้าของท่านเรียบร้อย

                <button type="button" class="btn btn-dark" data-dismiss="modal">Close</button>


text:
Q: How can I emulate ajaxStart and ajaxStop without jQuery? I've been looking at the jQuery code but is kinda huge. Would this be an easy task? Any idea how to do it?
The reason I want to do this is because I want to use it not for a web page but for a C# application that needs to know when there is ajax activity going on in a WebBrowser. So I would inject my javascript code in any web page I want to detect ajax activity, instead of injecting the whole jQuery which might be already present and cause a conflict.

A: jQuery's ajaxStart doesn't fire for arbitrary XMLHttpRequest events, only for those coming from within jQuery.
You can trivially test* this by spinning up your own XMLHttpRequest after registering an ajaxStart handler.
So, technically, its easy to emulate: just route all your ajax traffic through a common method.
I doubt that's going to help you much since you won't actually capture all ajax requests, just the ones you kick off (and thus already know about, by definition).
*I did, since I wasn't sure.


text:
Q: Parsing Karma Coverage Output in Bash for a Jenkins Job (Scripting) I'm working with the following output:
=============================== Coverage summary ===============================
Statements   : 26.16% ( 1681/6425 )
Branches     : 6.89% ( 119/1727 )
Functions    : 23.82% ( 390/1637 )
Lines        : 26.17% ( 1680/6420 )
================================================================================

I would like to parse the 4 coverage percentage numbers without the percent via REGEX, into a comma separated list.
Any suggestions for a good regex expression for this? Or another good option?

A: The sed command:
  sed -n '/ .*% /{s/.* \(.*\)% .*/\1/;p;}' input.txt | sed ':a;N;$!ba;s/\n/,/g'

gives the output:
  26.16,6.89,23.82,26.17

Edit: A better answer, with only a single sed, would be:
  sed -n '/ .*% /{s/.* \(.*\)% .*/\1/;H;};${g;s/\n/,/g;s/,//;p;}' input.txt

Explanation:

*

*/ .*% / search for lines with a percentage value (note spaces)

*s/.* \(.*\)% .*/\1/ and delete everything except the percentage value

*H and then append it to the hold space, prefixed with a newline

*$ then for the last line

*g get the hold space

*s/\n/,/g replace all the newlines with commas

*s/,// and delete the initial comma

*p and then finally output the result

To harden the regex, you could replace the search for the percentage value .*% with for example [0-9.]*%.

A: I think this is a grep job. This should help:
$ grep -oE "[0-9]{1,2}\.[0-9]{2}" input.txt | xargs | tr " " ","

Output:
26.16,6.89,23.82,26.17

The input file just contains what you have shown above. Obviously, there are other ways like cat to feed the input to the command.
Explanation:

*

*grep -oE: only show matches using extended regex

*xargs: put all results onto a single line

*tr " " ",": translate the spaces into commas:

This is actually a nice shell tool belt example, I would say.

Including the consideration of Joseph Quinsey, the regex can be made more robust with a lookahead to assert a % sign after then numeric value using a Perl-compatible RE pattern:
grep -oP "[0-9]{1,2}\.[0-9]{2}(?=%)" input.txt | xargs | tr " " ","

A: Would you consider to use awk? Here's the command you may try,
$ awk 'match($0,/[0-9.]*%/){s=(s=="")?"":s",";s=s substr($0,RSTART,RLENGTH-1)}END{print s}' file
26.16,6.89,23.82,26.17

Brief explanation,

*

*match($0,/[0-9.]*%/): find the record matched with regex [0-9.]*%

*s=(s=="")?"":s",": since comma separated is required, we just need print commas before each matched except the first one.

*s=s substr($0,RSTART,RLENGTH-1): print the matched part appended to s

A: Assuming the item names (Statements, Branches, ...) do not contain whitespaces, how about:
#!/bin/bash

declare -a keys
declare -a vaues

while read -r line; do
    if [[ "$line" =~ ^([^\ ]+)\ *:\ *([0-9.]+)% ]]; then
        keys+=(${BASH_REMATCH[1]})
        values+=(${BASH_REMATCH[2]})
    fi
done < output.txt

ifsback=$IFS        # backup IFS
IFS=,
echo "${keys[*]}"
echo "${values[*]}"
IFS=$ifsback        # restore IFS

which yields:
Statements,Branches,Functions,Lines
26.16,6.89,23.82,26.17

A: Yet another option, with perl:
cat the_file | perl -e 'while(<>){/(\d+\.\d+)%/ and $x.="$1,"}chop $x; print $x;'

The code, unrolled and explained:
while(<>){  # Read line by line. Put lines into $_
  /(\d+\.\d+)%/ and $x.="$1,"
  # Equivalent to:
  # if ($_ =~ /(\d+\.\d+)%/) {$x.="$1,"}
  # The regex matches "numbers", "dot", "numbers" and "%",
  # stores just numbers on $1 (first capturing group)
}
chop $x; # Remove extra ',' and print result
print $x;

Somewhat shorter with an extra sed
cat the_file | perl -ne '/(\d+\.\d+)%/ and print "$1,"'|sed 's/.$//'

Uses "n" parameter which implies while(<>){}. For removing the last ',' we use sed.


text:
Q: How to integerate Jmeter + graylog + mongodb ?? We have all three(Jmeter + graylog +  mongodb) s\w readly installed with me in windows so please give me any reference or idea how to integerate to each other.

A: If you want to observe real-time results of your test in Graylog be informed that the current JMeter version 5.2.1 doesn't support storing results to MongoDB out of the box so you might want to consider InfluxDB instead of MongoDB and Grafana instead of Graylog
Check out How to Use Grafana to Monitor JMeter Non-GUI Results article for more details.

If you have to stay on this Mongo + Graylog stack you can implement your own BackendListener which will store JMeter metrics to MongoDB, but you will have to do some Java programming.


text:
Q: UITableViewCells not highlighting on touch I'm subclassing UITableViewCell and adding two subviews (image, UILabel).
When the row is touched. There's no cell highlighting indicating the cell was selected.
I'm pretty sure I missed something, not sure how to handle highlighting for subclassed cell.
Any help would be appreciated. Thanks.

A: Without the code it is hard to give you a specific answer of how to fix your subclass of UITableViewCell. It could be something as complex as overriding a method that deals with the selection or render to something as simple as when you where in Interface Builder you forgot to select the highlight color for your UILabel.
All I can do with the limited information provided is point you to Apple's documentation on Subclassing UITableViewCell.
If this doesn't help please post your subclass code for the community to review and I am sure myself or someone can give you a specific answer.


text:
Q: Adding Twitter's Bootstrap 2.x "active" Class to "li" element inside a div I'm using Bootstrap to create a nav menu. The nav is loaded into the asdf2.html page using jQuery load(). I am having difficulty adding the "active" class to the subLink when the user goes to asdf2.html.
How can I add the active class to the sublink when the user loads asdf2.html? I belive the div is causing issues but I'm not exactly sure why...
asdf2.html (loads the sub-nav.html page into the sub-nav div and adds the active class to links):

sub-nav.html (li in the div doesn't addClass):

Link

subLink

A: Issue :
The css rules in bootstrap.css that style a tags inside nav lists have the following kind of selectors :
// Hover/focus
.navbar .nav > li > a:focus,
.navbar .nav > li > a:hover {
    ...
}

// Active nav items
.navbar .nav > .active > a,
.navbar .nav > .active > a:hover,
.navbar .nav > .active > a:focus {
    ...
}

See the code here.
Adding an extra div in your markup does indeed break the markup - the .active node is not a direct child of the .nav node anymore.
I haven't browsed the javscript code, but I would imagine the events are also bound using the same kind of selector.
Suggestion :
If you want to follow the bootstrap framework structure, remove the div node.
Or maybe add class="nav" to your div - be sure to thoroughly test the result though...
Question :
Why do you need this div in the first place ?

A: 1. use document ready to fire your jquery (jQuery(document).ready(function($) {
// Code using $ as usual goes here.
});) see also: http://api.jquery.com/ready/
2. you put the li tags of your subnav in a div instead of an ul tag
3. use a css selector to make your submenu active item visible:
.nav-list li.active li.active > a{
background-color: #0088CC;
color: #FFFFFF;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2);
 }

Working example code:
 <!DOCTYPE html>

 <title>Responsive nesting</title>
 <meta name="viewport" content="width=device-width, initial-scale=1.0">

<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">

NOTE even when you put your li in a div it still works. Why should you? it breaks your html. (use .nav-list li.active > a in your css to make it visible)
See also: http://plnkr.co/9Xc2ThJ3ZEuJqlKLkj0r which shows the same result for the correct html and your li inside a div.

A: There is a simple way to do this. You need to check the url that has been loaded and then add your class to the relevant li item. So,


text:
Q: Can't create an alert for an App Insights custom metric on Azure I'm trying to create an alert for an App Insights custom metric on Azure.
e.g. alert if the "My Metric" metric is greater than 40 for 5 minutes.
According to Custom metrics in Azure Monitor this should be possible.

After they're published to Azure Monitor, you can browse, query, and alert on custom metrics for your Azure resources and applications side by side with the standard metrics emitted by Azure.

I created the metric with this code using the App Insights Python SDK (see Usage).
from applicationinsights import TelemetryClient
tc = TelemetryClient('<YOUR INSTRUMENTATION KEY GOES HERE>')
tc.track_metric('My Metric', 42)
tc.flush()

I can view the custom metric I created. It's the lone blue bar in the screenshot of the Metrics screen in the Azure portal.

However, when I click on the New rule alert button on that screen, I'm taken to the Create rule screen but it displays the following error.

Alerts configuration via Metrics not supported if selection includes multiple resources or more than two metric signals. Please modify your selection and try again or create the rule below. Please click to see the list of supported resources.

AFAIK, I'm only using one resource (the App Insights "Dev" resource) and one metric signal (the "My Metric" metric) as you can see from the screenshot.
Any ideas on what I've done wrong or what I'm missing and how I can correct it?
I'm pretty new to Azure so I'm also open to suggestions on others way of alerting on a custom metric.

A: Please follow the steps below:

*

*Nav to azure portal -> Monitor -> Metrics -> Add metric. Note that in the dropdown box "METRIC NAMESPACE" -> select azure.applicationinsights under CUSTOM:

*Then in the "METRIC" dropdown box, select your custom metric like "my metric", then click the "New alert rule":

*In the "create rule" page, under CONDITION section, click the link in the screenshot below, then fill in necessary info and click Done button:

A: Another approach to this is to create Alerts based on Analytics query using Custom log search (see also Create, view, and manage log alerts using Azure Monitor) but I prefer the answer I accepted as it's significantly simpler.


text:
Q: Is there any way to build TensorFlow from source without having internet? Currently building tensorflow from source need to connect to internet to download some dependencies. Every time when I rebuild it, bazel will delete what have been downloaded and re-download them.
I wonder if there is any possible way to avoid this by pre-download all the dependencies and just build it without internet?

A: It seems to be a case not well supported by TensorFlow, apparently one way is to build Docker or other VM environment, and distribute that --
https://github.com/tensorflow/tensorflow/issues/3194#issuecomment-231326381

A: Bazel automatically caches the external dependencies it downloads.  Is it possible you are:

*

*Moving the tensorflow source around

*Changing the BUILD files it uses for external repositories

*Building different targets (that might require other dependencies) each time?

If none of those seem likely, can you add the output for running identical bazel builds twice in a row where you're seeing re-downloading behavior, using --explain?

A: It is possible to pre-download 3rd party dependencies, as explained here.
In tensorflow v0.11.0, they are listed in "tensorflow/workspace.bzl". After downloading files you need, replace links like this:
url = "http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz",

to
url = "file:////mnt/a/usr/bzip2-1.0.6.tar.gz",

Note, that there's about 20 dependencies to download.


text:
Q: To rearrange structure of multi dimensional array array1:
Array
(
   "Page change" => Array
        (
           Array("parent_id" =>,"access_id" => 1),
           Array("parent_id" =>,"access_id" => 2),
           Array("parent_id" =>2,"access_id" =>3),
           Array("parent_id" =>2,"access_id" =>4),
           Array("parent_id" =>,"access_id" =>5),
           Array("parent_id" =>5,"access_id" =>6),
        )

   "Roles" => Array
        (
            Array("parent_id" =>5,"access_id" =>7),
            Array("parent_id" =>,"access_id" =>8),
        )
)

Array2:
Array
(
    [Page change] => Array
        (
            [0] => Array
                (
                    [parent_id] =>
                    [access_id] => 1
                )

            [1] => Array
                (
                    [parent_id] =>
                    [access_id] => 2
                    [sub]=>array(
                        [0]=>Array
                            (
                                [parent_id] => 2
                                [access_id] => 3
                            )
                        [1] => Array
                            (
                                [parent_id] => 2
                                [access_id] => 4
                            )
                    )
                )

            [2] => Array
                (
                    [parent_id] =>
                    [access_id] => 5
                    [sub]=>array(
                        [0] => Array
                        (
                            [parent_id] => 5
                            [access_id] => 6
                        )

                    )
                )

        )

    [Roles] => Array
        (
            [0] => Array
                (
                    [parent_id] =>
                    [access_id] => 7
                )

            [1] => Array
                (
                    [parent_id] =>
                    [access_id] => 8
                )

        )
)

I am struggling to change the structure of an array.My result array is like structure array one in my code.  I need to change that like array two using parent_id and access_id in first array.How can i possibly rearrange this multi-dimensional array
If need add "sub" key in every inner arrays.
Thanks for the help  in advance


text:
Q: Da erro ao executar esta pagina
import android.app.*;
import android.content.*;
import android.os.*;
import android.util.*;
import android.view.*;
import android.widget.*;
import java.util.*;
import org.apache.http.*;
import org.apache.http.message.*;
import org.json.*;

public class ver extends Activity {

TextView tvnome;
TextView tvgenero;
TextView tvautonomia;
TextView tvmedicamentos;
TextView txtCreatedAt;
CheckBox chkfemenino;
CheckBox chkmasculino;
CheckBox chkautonomo;
CheckBox chkdependente;
CheckBox chkacamado;
CheckBox chktipo1;
CheckBox chktipo2;
CheckBox chkparkinson;
CheckBox chkalzeimer;
CheckBox chkcoracao;
CheckBox chkavc;
CheckBox chkoutra;
TextView tvoutra;
Button btnEditar;
Button btnVoltar;

String pid;
String id;

// Progress Dialog
private ProgressDialog pDialog;

// JSON parser class
JSONParser jsonParser = new JSONParser();

// single product url
private static final String url_idoso_detalhes = "http://robilaks.byethost11.com/psi/htdocs/get_product_details.php";

// JSON Node names
private static final String TAG_SUCCESS = "success";
private static final String TAG_IDOSO = "product";
private static final String TAG_PID = "pid";
private static final String TAG_NOME = "nome";
private static final String TAG_GENERO = "genero";
private static final String TAG_AUTONOMIA = "autonomia";
private static final String TAG_DIABETES = "diabetes";
private static final String TAG_PARKINSON = "parkinson";
private static final String TAG_ALZEIMER = "alzeimer";
private static final String TAG_AVC = "avc";
private static final String TAG_OUTRAO = "outrao";
private static final String TAG_OUTRA = "outra";
private static final String TAG_MEDICAMENTOS = "medicamentos";

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.ver);
    new GetProductDetails().execute();
    // save button
    btnEditar = (Button) findViewById(R.id.btnEditar);
    btnVoltar = (Button) findViewById(R.id.btnVoltar);

    // getting product details from intent
    Intent i = getIntent();
    tvnome = (TextView) findViewById(R.id.tvnome);
    tvmedicamentos = (TextView) findViewById(R.id.tvmedicamentos);
    chkfemenino = (CheckBox) findViewById(R.id.chkfemenino);
    chkmasculino = (CheckBox) findViewById(R.id.chkmasculino);
    chkautonomo = (CheckBox) findViewById(R.id.chkautonomo);
    chkdependente = (CheckBox) findViewById(R.id.chkdependente);
    chkacamado = (CheckBox) findViewById(R.id.chkacamado);

    chktipo1 = (CheckBox) findViewById(R.id.chktipo1);
    chktipo2 = (CheckBox) findViewById(R.id.chktipo2);

    chkparkinson = (CheckBox) findViewById(R.id.chkparkinson);
    chkalzeimer = (CheckBox) findViewById(R.id.chkalzeimer);
    chkcoracao = (CheckBox) findViewById(R.id.chkcoracao);
    chkavc = (CheckBox) findViewById(R.id.chkavc);
    chkoutra = (CheckBox) findViewById(R.id.chkoutra);
    tvoutra = (TextView) findViewById(R.id.tvoutra);

    // getting product id (pid) from intent
    pid = i.getStringExtra(TAG_PID);
    id = i.getStringExtra(TAG_PID);
    //new GetProductDetails().execute();

    // save button click event
    btnEditar.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                // Launching create new product activity
                Intent i = new Intent(getApplicationContext(), editar.class);

            /*  pDialog = new ProgressDialog(ver.this);
                pDialog.setMessage("Um Momento...");
                pDialog.setIndeterminate(false);
                pDialog.setCancelable(true);
                pDialog.show();*/
                i.putExtra(TAG_PID, id);
                startActivity(i);
            }

        });

    btnVoltar.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                // Launching create new product activity
                Intent i = new Intent(getApplicationContext(), consultas.class);
                i.putExtra(TAG_PID, pid);
                startActivity(i);
            }

        });

}

/**
 * Background Async Task to Get complete product details
 * */
class GetProductDetails extends AsyncTask<String, String, String> {

    /**
     * Before starting background thread Show Progress Dialog
     * */
    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        pDialog = new ProgressDialog(ver.this);
        pDialog.setMessage("A carregar dados...");
        pDialog.setIndeterminate(false);
        pDialog.setCancelable(true);
        pDialog.show();
    }

    /**
     * Getting product details in background thread
     * */
    protected String doInBackground(String... params) {

        runOnUiThread(new Runnable() {
                public void run() {
                    // Check for success tag
                    int success;
                    try {
                        // Building Parameters
                        List<NameValuePair> params = new ArrayList<NameValuePair>();
                        params.add(new BasicNameValuePair("pid", pid));

                        // getting product details by making HTTP request
                        // Note that product details url will use GET request
                        JSONObject json = jsonParser.makeHttpRequest(
                            url_idoso_detalhes, "GET", params);

                        // check your log for json response
                        Log.d("Single Product Details", json.toString());

                        // json success tag
                        success = json.getInt(TAG_SUCCESS);
                        if (success == 1) {
                            // successfully received product details
                            JSONArray productObj = json
                                .getJSONArray(TAG_IDOSO); // JSON Array
                            Log.d("Single Product Dssseeeetails", productObj.toString());
                            // get first product object from JSON Array
                            JSONObject product = productObj.getJSONObject(0);
                            int genero = Integer.valueOf(product.getString(TAG_GENERO));
                            int autonomia = Integer.valueOf(product.getString(TAG_AUTONOMIA));
                            int diabetes =Integer.valueOf(product.getString(TAG_DIABETES));
                            int parkinson =Integer.valueOf(product.getString(TAG_PARKINSON));
                            int alzeimer =Integer.valueOf(product.getString(TAG_ALZEIMER));
                            int avc =Integer.valueOf(product.getString(TAG_AVC));
                            int outrao =Integer.valueOf(product.getString(TAG_OUTRAO));

                            int generofem = 1;
                            int generomasc = 2;
                            int aautonomo = 1;
                            int adependente = 2;
                            int aacamado = 3;
                            int tipo1 = 1;
                            int tipo2 = 2;
                            int pparkinson = 1;
                            int palzeimer = 1;
                            int pavc = 1;
                            int poutrao = 1;
                            // display product data in EditText
                            if(genero == generofem){

                                chkfemenino.setEnabled(false);
                                chkmasculino.setEnabled(false);
                                chkfemenino.setChecked(true);
                            }
                            if(genero == generomasc){
                                chkmasculino.setEnabled(false);
                                chkfemenino.setEnabled(false);
                                chkmasculino.setChecked(true);
                            }

                            if(autonomia == aautonomo){
                                chkautonomo.setEnabled(false);
                                chkdependente.setEnabled(false);
                                chkacamado.setEnabled(false);
                                chkautonomo.setChecked(true);
                            }
                            if(autonomia == adependente){
                                chkdependente.setEnabled(false);
                                chkautonomo.setEnabled(false);
                                chkacamado.setEnabled(false);
                                chkdependente.setChecked(true);
                            }

                            if(autonomia == aacamado){
                                chkacamado.setEnabled(false);
                                chkdependente.setEnabled(false);
                                chkautonomo.setEnabled(false);
                                chkacamado.setChecked(true);
                            }
                        if(diabetes == tipo1){
                                chktipo1.setEnabled(false);
                                chktipo1.setChecked(true);
                            }

                            if(diabetes == tipo2){
                                chktipo2.setEnabled(false);
                                chktipo2.setChecked(true);
                            }

                            if(parkinson == pparkinson){
                                chkparkinson.setEnabled(false);

                                chkparkinson.setChecked(true);

                            }

                            if(alzeimer == palzeimer){
                                chkalzeimer.setEnabled(false);

                                chkalzeimer.setChecked(true);

                            }
                            if(avc == pavc){
                                chkavc.setEnabled(false);
                                chkavc.setChecked(true);
                            }

                            if(outrao == poutrao){
                                chkoutra.setEnabled(false);
                                chkoutra.setChecked(true);
                                tvoutra.setText(product.getString(TAG_OUTRA));
                            }
                            tvnome.setText(product.getString(TAG_NOME));
                            tvmedicamentos.setText(product.getString(TAG_MEDICAMENTOS));

                        }else{
                            // product with pid not found
                        }
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                }
            });

        return null;
    }

    /**
     * After completing background task Dismiss the progress dialog
     * **/
    protected void onPostExecute(String file_url) {
        // dismiss the dialog once got all details
        pDialog.dismiss();
    }
}

}

A: Oi,
Provavelmente um ou mais atributos do produto estão vindo nulos (JSONObject product), com isso você terá uma exceção deste tipo em Integer.valueOf(null).
[]'s


text:
Q: Application Only for Tablets I am create application only for tablets. Now i upload that application on market.
My application support in Android 2.2 Galaxy Tab 7 and All android 3.0 version Tablets.
Issues is that application can not install in mobile. when i use Android 2.2 version device and search my application than it's found and install in my device.
To avoid that i add this code in my manifest file:-
<supports-screens android:smallScreens="false"
        android:normalScreens="false"
            android:largeScreens="true"
        android:xlargeScreens="true" />

but till that in mobile my application show.
I found some other code but this not show in my manifest file
    android:requiresSmallestWidthDp="600"
    android:compatibleWidthLimitDp="integer"
    android:largestWidthLimitDp="integer"

Thanks in Advance

A: As I just answered here: https://stackoverflow.com/a/10540882/413127 it is possible
you need a combination of what you've outlined above in your Manifest:
 <supports-screens
        android:largeScreens="true"
        android:normalScreens="false"
        android:requiresSmallestWidthDp="600"
        android:smallScreens="false"
        android:xlargeScreens="true" />

 <uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="14" />

A: MinimumAPILevel attribute in Manifest.xml is used to filter apps. Changes it accordingly.
If you want you app to be visible for only tablets then keep MinimumAPILevel greater than 9. If you want it be visible for phone also then keep MinimumAPILevel less than 9.


text:
Q: Crawling Version Control System I want to crawl some kind of project on GitHub say I want to crawl source code which are created by particular author and bla bla constraints. Is there any plugin for Nutch to crawl this information or best way to get the whole repositories crawled.
I even want to crawl version of publicly hosted version control system using Nutch. Is there any plugin available for the same.

A: Github comes with a JSON API. Use the repository API to get the list of repositories for a specific user and then clone them. Should be a matter of a few lines shell.
See the API documentation here.

A: Nutch is a search engine, made by Apache, based on a Lucene backend.
Take a look at github's robots.txt file:
https://github.com/robots.txt
Apart from specific engines, (e.g. google), it says:
User-agent: *
Disallow: /

Therefore you cannot crawl GitHub with Nutch.
Crawling github with a search engine seems like a bad idea. There will be a lot of similar pages that you would be downloading for no reason. What's wrong with GitHub's search?
Please try to generalise your question. What do you hope to achieve by crawling github with Nutch? What kind of searches are you wanting to perform?


text:
Q: Assign a negative sign to every value in a vector (in R)? I want this:
V <- c(2, 3, 4, 5, 6)
V <- as.data.frame(V)

To look like this:
[1] -2 -3 -4 -5 -6

Essentially the reverse of the abs() function. Thanks.

A: If you don't know beforehand whether all values of the vector are positive, then you should do something like the code below.
V <- c(2, 3, 4, 5, 6)
W <- c(-2, -3, -4, -5, -6)
X <- c(2, -3, 4, -5, 6)

all.neg <- function(x) -1*abs(x)

Let's try it.
all.neg(V)
#[1] -2 -3 -4 -5 -6

all.neg(W)
#[1] -2 -3 -4 -5 -6

all.neg(X)
#[1] -2 -3 -4 -5 -6

If you want to apply it to a data.frame, then do it the usual way.
dat <- data.frame(V, W, X)

dat[] <- lapply(dat, all.neg)
dat
#   V  W  X
#1 -2 -2 -2
#2 -3 -3 -3
#3 -4 -4 -4
#4 -5 -5 -5
#5 -6 -6 -6

A: You could do
 V * -1

or
-V # first mentioned in the comments by @RHertel

or anything like that. With assignment (updating the object) it looks like this:
v <- v * -1 # or -V

You can also use = for assignment but it goes against the style guides.

[1] -2 -3 -4 -5 -6


text:
Q: uiWebview call javascript function syntax I am migrating my app from android to iOS and for following line, compiler returns me an error on iOS,
webviewA.loadUrl("javascript:setVars(\"" + var1 + "\",\""  + var2 +  "\")"); //properly executed on Android
for iOS I am trying,
[webViewA stringByEvaluatingJavaScriptFromString:@"javascript:setVars(\"" + var1 + "\",\""  + var2 +  "\")"];

which would be correct syntax for iOS? Thank you.

A: As per this answer on another similar question, you need to implement the UIWebView delegate method webViewDidFinishLoad:, and in there implement [myWebView stringByEvaluatingJavaScriptFromString:@"myJavaScriptCode()"].
In order for this to work you need to set the delegate on the UIWebView instance and implement the delegate method mentioned above so that the JavaScript is executed after the page has loaded.
The documentation for - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script can be found here.
Now for the other part of your question (thanks for clarifying!).. to concatenate strings in Objective-C you can use the NSString class method stringWithFormat:.
For example, to pass two Objective-C values to a JavaScript string, you could do something like this:
// Substitute your Objective-C values into the string
NSString *javaScript = [NSString stringWithFormat:@"setVars('%@', '%@')", var1, var2, nil];

// Make the UIWebView method call
NSString *response = [webViewA stringByEvaluatingJavaScriptFromString:javaScript];


text:
Q: How does HBase mapreduce job communicate with server? (newbie question) I am new to Hadoop and HBase and even though I've read allot, I still don't understand the basic hierarchy and workflow of map reduce job API.
By what I understand, I will need to use the java API to implement certain classes and pass them to hbase which will coordinate the splitting and distribution process. Is that correct?
If so, how does the application communicate with the server to pass the relevant code for the map reduce job? I have a missing link here....
Thanks

A: When you run your HBase MapReduce job, your classpath has to contain both the HBase and MapReduce configuration files. The configuration files will contain settings such as the location of the JobTracker, the HDFS NameNode, and the HBase master node. The runtime will then automatically pick up all these settings from the configuration files so that your job knows which servers to contact.

A: I think you should just work through the basic tutorial, which should make things clear. I found the quickest way to get started was by playing with the Cloudera VM.
Also, I'm not sure about your reference to HBase; you should be passing Java classes to Hadoop, not HBase.
However, in an attempt to answer you question, Hadoop should be installed on all nodes in your cluster. The Hadoop framework will take care of farming the map and reduce tasks out to nodes.

A: The standard way to execute a M/R job using HBase is the same way you execute a non-HBase m/r job:
${HADOOP_HOME}/bin/hadoop jar .jar  [args]
This copies your jar to all of the task trackers (via HDFS) so that they can execute your code.
With HBase you also will typically use the HBase utility:
TableMapReduceUtil.initTableReducerJob
This uses built-in algorithms to split an HBase table (using the regions of the table) so that computation can be distributed over the m/r jobs.  If you want a different split, you have to modify the way splits are calculated, which means that you cannot use the built-in utility.
The other thing you can specify is conditions on the rows that are returned.  If you use a built-in scan condition, then you don't have to do anything special.  However, if you want to create a custom comparator, you have to make sure that the region servers have this code in their classpath so that they can execute it.  Before you go this route, examine the built-in comparators carefully, as they are quite powerful.


text:
Q: Multiple date picker for cordova? I am completely new for Cordova & PhoneGap and have been searching around for MultiDatePicker plugin for Cordova.
I see below plugin but its not multi date picker.
https://github.com/VitaliiBlagodir/cordova-plugin-datepicker
Below link lists all the phonegap plugins in which i don't see multidatepicker.
http://phonegap-plugins.com/
Any idea how to get this plugin?
Thanks in advance.

A: As Of My Knowledge there is no Plugin for multipledatepicker in cordova. If you are using jQuery in your Project Probably You can use MultiDatesPicker for JqueryUi.
Example code
var today = new Date();
var y = today.getFullYear();
$('#full-year').multiDatesPicker({
    addDates: ['10/14/'+y, '02/19/'+y, '01/14/'+y, '11/16/'+y],
    numberOfMonths: [3,4],
    defaultDate: '1/1/'+y
});

Reference Link here.


text:
Q: Drawing an object to a Form from outside I'm a newbie at C# and I tried to make a separate DBService class, and I wanted to draw my DataGridView from this class.
But it doesn't appear.
 public static void initializeDataDisplay()
    {
        try
        {
            string selectAll = @"SELECT * FROM Products;";
            MySqlDataAdapter dataAdapter = new MySqlDataAdapter(selectAll, DBService.conn);
            DataSet ds = new DataSet();
            dataAdapter.Fill(ds);
            DataGridView dgvAdmin = new DataGridView();
            dgvAdmin.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            dgvAdmin.Location = new System.Drawing.Point(29, 12);
            dgvAdmin.Size = new System.Drawing.Size(552, 245);
            dgvAdmin.TabIndex = 0;
            dgvAdmin.DataSource = ds.Tables[0];

        }
        catch (Exception exc)
        {
            MessageBox.Show(exc.Message);
        }
    }

The connection works, and everything worked before i wanted to separate the Database services. I don't get any exceptions.

A: When you create a new control it will not be displayed until it has been added to a displayed Form or other container that is showing inside a Form.
I would recommend that you add a DataGridView instance to your application using the Form designer. Then when you call your initializeDataDisplay routine you pass in a reference to this designer generated instance and update inside the routine.


text:
Q: Java input not being accepted by readline I'm trying to store a bunch of variables through bufferedreader. I'm brand new to Java and frankly don't really understand completely what it even does, but I know that it accepts input from the user and am trying to get it to store a bunch of variables for me. Here is the code:
// import required packages for the program, importing all classes from packages to be on the safe side
import java.io.*;
import java.util.*;
import java.text.*;

public class Example
{
// need to use throws IO Exception because we are dealing with input and output, simple main method will not suffice
public static void main(String[] args) throws IOException
{
    // declare department names as strings
    String department1;
    String department2;
    String department3;
    String department4;

    // declare number of employees in each department as ints
    int employees1;
    int employees2;
    int employees3;
    int employees4;

    // declare cost per employee in each department as doubles
    double cpe1;
    double cpe2;
    double cpe3;
    double cpe4;

    //declare sales in each department as doubles
    double sales1;
    double sales2;
    double sales3;
    double sales4;

    // declare in as a BufferedReader- used to gain input from the user
    BufferedReader in;
    in = new BufferedReader(new InputStreamReader(System.in));

    //get input from the user to define department names
    System.out.println("What is the name of department 1?");
    department1 = in.readLine();
    System.out.println("What is the name of department 2?");
    department2 = in.readLine();
    System.out.println("What is the name of department 3?");
    department3 = in.readLine();
    System.out.println("What is the name of department 4?");
    department4 = in.readLine();
    System.out.println("\n");

    //get input fromm the user to define number of employees
    System.out.println("How many employees are in department 1?");
    employees1 = in.readLine();
    System.out.println("How many employees are in department 2?");
    employees2 = in.readLine();
    System.out.println("How many employees are in department 3?");
    employees3 = in.readLine();
    System.out.println("How many employees are in department 4?");
    employees4 = in.readLine();
    System.out.printlin("\n");

    // get input from user to define cost per employee in each department
    System.out.println("What is the cost per employee in department 1?");
    cpe1 = in.readLine();
    System.out.println("What is the cost per employee in department 2?");
    cpe2 = in.readLine();
    System.out.println("What is the cost per employee in department 3?");
    cpe3 = in.readLine();
    System.out.println("What is the cost per employee in department 4?");
    cpe4 = in.readLine();

    // get input from user to define sales in each department
    System.out.println("What are the sales in department 1?");
    sales1 = in.readLine();
    System.out.println("What are the sales in department 2?");
    sales2 = in.readLine();
    System.out.println("What are the sales in department 3?");
    sales3 = in.readLine();
    System.out.println("What are the sales in department 4?");
    sales4 = in.readLine();

I keep getting an error saying that incompatible types are occurring when I try and run the program. Again, very new to this so a any simple explanations would be very much appreciated. Thank you!

A: The readLine method returns String.
This code will not even compile.
If you want to get an int value, you need to call for example Integer.parseInt(ln),
where ln is the line you read from the input. Analogically, if you want to get a double value, you need to call for example Double.parseDouble(ln),
where ln is the line you read from the input.

A: The issue is one of type; you have several different data-types present, but you only read Strings. I would use a java.util.Scanner like so -
java.util.Scanner in = new java.util.Scanner(System.in);
System.out.println("What is the name of department 1?");
if (in.hasNextLine()) {
  department1 = in.nextLine();
}
// ...
System.out.println("How many employees are in department 1?");
if (in.hasNextInt()) {
    employees1 = in.nextInt();
}
// ...
System.out.println("What is the cost per employee in department 1?");
if (in.hasNextDouble()) {
  cpe1 = in.nextDouble();
}

A: Take a look at the Scanner Class This should do a lot of what you need. It allows you to read in inputs as Integers/Strings/Doubles, without having to do any manual conversion

A: in.readLine() yields a String - not automatically convertible to int or double. Consider Integer.parseInt(string).

A: The readLine() method returns a String. You're trying to store that String in int and double variables. There are methods in the wrapper classes (like Integer and Double) for converting from a String to a number.
You might also consider using the Scanner class instead.


text:
Q: What is the cleanest way to perform nested conversion of numpy types to python (JSON friendly) types? What is the cleanest way to perform nested conversion of a "deep" object that contains mixed python / numpy types to an object containing only python types?
The question is motivated by the need to send the data as JSON, but here I do not have control over json.dumps() because that is the province of a different application. In other words, I cannot specify the JSON encoder.
One possible solution involves adopting the JSON encoder solution anyway, followed by a conversion back to JSON with json.loads(). This would mean every message has two round trips to JSON rather than one which might not be the end of the way. But is there a "better" alternative?
Note that I need to apply recursively so that fact that tolist() or item() sometimes works isn't a complete solution here.


text:
Q: extract user name and password from url using regex and sql in order to implement a custom sql function named getUserName and getPassword from an input url, im trying to find a way to extract the user name and password from a given url using regex.
the code will be executing on snowflake sql flavor language so my coding tools are limited to sql functions and regex supported by snowflake.
i can find the url scheme and the domain/host, get their indexes and length, and extract as substring every thing in between to get the user name and password, the problem is that it wont work with many edge cases, can you suggest better methods/code execution?
this is an example url:
http://UserName123:P@$$:\/\/0rd@domain.co.uk:34567/3.0.1/file_name.txt?pn1:pv1&pn2:pv2#ref

this is the current regex used to identify the url scheme and domain:
(^[a-z0-9.-]+:\/\/)|((?:@)([a-z0-9.-]+))

this is an sql example of getting the scheme:
SPLIT_PART(REGEXP_SUBSTR(A, '^[a-z0-9.-]+://', 1, 1, 'c'), ':', 0) as split

A: Username and password in a URL are bad practice. URLs, along with the query string (and thus the passwords) will show up in server log files or it can leak/get stolen another way.
So, redesign is needed and not a solution to this problem.
I hope you find it good to know now instead of after solving the problem.


text:
Q: Let I, J ideals. Are they equal? Let
$$I= \langle 11x^5y+7xy^6+9,8xy^4+6xy+9 \rangle$$
$$J= \langle 7x^5y^2+17x^2y^5+29,13xy^4+62xy^3+19 \rangle$$
ideals. Examine whether those two ideals are equal.
By seeing their 3D plots I think they are not equal, but I dont know how to show it...
Any help appreciated!

A: You can use Buchberger's algorithm to prove that those ideals are not equal. Pick any monomial order on $k[x,y]$ and construct the reduced Groebner basis for each of those ideals. Since reduced Groebner basis is unique for every ideal fixed, this approach will give a straightforward answer.
For, example, for grlex ($x \succ y$) ordering:
$$I = \langle 7y^5+11x^4-8y^3-6, \; 8xy^4+6xy+9, \; 88x^5-64xy^3-42xy^2-48x-63y \rangle,$$
while:
$$J = \langle 133x^4+323xy^3-377y^2-1798y, \;13xy^4+62xy^3+19, \;4901y^6+46748y^5+111476y^4+2527x^3+6137y^3 \rangle.$$
So $I \neq J$.
By the way, I think that this question should be tagged as a homework.


text:
Q: Windows virus removed .exe while allowed Windows 10 virus & threat removed a .exe file it thought was malware even though it was previously allowed.
When windows security found the .exe file it said it was a threat. I hit "allow" then, all of a sudden, it removed the file and it disappeared. I had allowed this file in the past and it was there for a long time. I even opened the folder containing it a bunch of times and when the same message popped up, I allowed it but today it removed it.
I can't find it anywhere. Is there a way to get it back?

A:
Windows virus removed .exe while allowed.

According to your question, it does not appear to be in your WD quarantine.  Do check that of course.
My guess is that the file was not properly whitelisted and things then change with Windows Defender Updates. Possibly Windows Defender Updates may require whitelisting again, depending on the file.
Once removed, you need to get the file from a backup or from the original source. Otherwise it is gone.
Backups are always essential all the time.


text:
Q: Is there a standard way to serve latest version of static files from a git repository with Node.js? Is there any standard/conventional way (package/library, pattern, etc.) to serve the latest version of some static files from a given git repository in Node.js?
My idea so far is to clone the repository at npm start and take the files that I need from there, and to provide a webhook to be called when the repository receives a commit, to then pull the changes so that the files get updated even when the app is running.
This seems like it could work, but I do not want to reinvent the wheel, if it already exists. If there is a method that is already relatively well known, a conventional pattern or a package that already does this, it would be wise to use it and not bother with implementing the details, fixing security vulnerabilities and keeping it up to date.
Also, while we are on it, are there reasons why I should not do this in the first place?
Edit:
I should probably give an explanation on why I would want to do this.
I basically have a web app (nothing too complex, a few routes here and there), let's call it example.com, and a few "self contained sites" (i.e. collections of static files that for all intents and purposes could live independently of the main website and each other).
I could put them each on their sub-domain, but that would probably mean using more app instances and time for just serving some static files, so I want to serve these "sub-websites" on their own paths on that app, like example.com/sub-site1, example.com/sub-site2, etc., from the same app instance as the main example.com, as to not incur higher hosting cost.
I could also modify those static websites to wrap them in Node.js packages and install the packages in the main app, but I want to keep them clean, simple, static files, agnostic of the platform they are being served from.
That leaves me with the option of moving a bunch of files to the main app, but I do not want to manually restart the app each time any one of those sites gets updated, or even worse, manually update the repository of the main app with the new versions of the static files.

A:
Is there any standard/conventional way (package/library, pattern, etc.) to serve the latest version of some static files from a given git repository in Node.js?

There is no standard for this kind of task. The best way is to use the official Github SDK since there is a getContent method for this purpose.

Also, while we are on it, are there reasons why I should not do this in the first place?

A Github repository can be deleted, but an npm package cannot (there is a unpublish policy for this reason).
I don't know your use cases, but those files are critical for your application?
If so, it is risky to depends like this on an ephemeral repository: you could just fork and keep the fork up-to-date with a Github action


text:
Q: Writing to a JSON file and uploading to a server I am pulling a JSON file from a server within my app. When my app deals with this data, I need to write some changes to this JSON file and upload back to the original source.
So if I wanted to edit and write the data in Category in the data below to "Full Stack", how could this be done? I then need to upload to the server to update at their end.
https://gist.githubusercontent.com/planetoftheweb/4069235/raw/0ca9457d10f9ff0be578a699954910d7d6626726/sampledata.json


text:
Q: Сохранение изображения в mysql. php Не могу понять почему не сохраняется изображение, вроде все верно.
Я знаю что можно хранить изображение в папке, а в бд только путь, но мне интересно почему не могу в бд сохранить.
html

    <meta charset="UTF-8">

На главную
<form enctype="multipart/form-data" method="post" action="registry.php">

Ваше Имя:

<input type="text" name="name" size="40">

Ваша Фамилию:

<input type="text" name="surname" size="40">

Ваше Отчество:

<input type="text" name="midlename" size="40">

Ваш email:

<input type="text" name="email" size="40">

Ваш телефон:

<input type="text" name="phone" size="40">

Ваш город:

<input type="text" name="sity" size="40">

Ваша страна:

<input type="text" name="country" size="40">

Ваш фотография:

    <input type="file" name="file"  accept=".JPG, .PNG, .JPEG, .PNG">
    <input type="submit" value="Отправить">
</form>

php
<?php
$hostname = "localhost";
$username = "root";
$password = "xxx";
$database = "web_4";
$usertable = "user";

$conn = mysqli_connect($hostname, $username, $password, $database) or die('Oops');
$name = $_POST['name'];
$surname = $_POST['surname'];
$midlename = $_POST['midlename'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$city = $_POST['sity'];
$country = $_POST['country'];
$file =  $_POST['file'];

$sql = "INSERT INTO $usertable (name, surname, midlename, email, phone, sity, country, photo) VALUE ('$name','$surname','$midlename','$email','$phone','$city','$country','$file') ";
if (mysqli_query($conn, $sql)) {
    echo "Новый пользователь добавлен
";
} else {
    echo "Error: " . $sql . "
" . mysqli_error($conn);
}
mysqli_close($conn);
?>


text:
Q: Use one users for multiple Rolebindings in Kubernetes I have an application that is going to monitor and if necessary scale other resources. At the moment I am using the cluster-admin tokens for it to access the k8s api but I want to limit its access to just monitor and scale.
I know that I need to use Role and Rolebinding for this but I have two questions:

*

*Can I use just one user and bind it to a role in different namespaces? I need to run multiple instances of my application in different namespaces on a cluster

*Is there a way to create a new k8s user via yaml file and use that to bind the role?
At the end if I am using a wrong approach please let me know because I am somehow newbie in RBAC.

A: You seem to have the right approach.
Have a look at the documentation: https://kubernetes.io/docs/reference/access-authn-authz/rbac/
From experience always leave resources that are linked inside the same namespace, one user with one clusterrole and rolebinding.
Still in the case of rolebinding, they are not namespaced so you should be able to bind one user by namespace to a single clusterrole. Never tested it myself so you will have to do some testing.
There is still the question of why not just create a single app, with a serviceaccount having access to all namespaces and so one app deployed in a namespace will be able to access all the resources it needs to managed in all the cluster?


text:
Q: Initializing an infinite list of BigIntegers Ok,
So I need a list of all the positive integers.
What first comes to mind is:
let numbers:Seq<bigint>=Seq.initInfinite n...

but initInfite isn't actually infitint: http://msdn.microsoft.com/en-us/library/ee370429.aspx
(unlike bigint) its only: Int32.MaxValue = 2,147,483,647 which is nowhere near big enough.
Currently my plan is to replace the sequence with some kind of handmade class (possibly implimenting IEnumerable). It would be simple (and possibly more effiecint for my use) but i want to know how to do this

A: let numbers:bigint seq =
    let rec loop n = seq { yield n; yield! loop (n+1I) }
    loop 0I

A: I keep the following statically constrained function around since it is very flexible (you can specify the start value and the skip interval) and works with all numeric types:
let inline infiniteRange start skip =
    seq {
        let n = ref start
        while true do
            yield n.contents
            n.contents <- n.contents + skip
    }

Type signature given by FSI:
val inline infiniteRange :
   ^a ->  ^b -> seq< ^a>
    when ( ^a or  ^b) : (static member ( + ) :  ^a *  ^b ->  ^a)

Here is how you generate all positive integers (BigInts, that is -- shown in FSI):
> infiniteRange 1I 1I;;
val it : seq<System.Numerics.BigInteger> =
  seq [1 {IsEven = false;
          IsOne = true;
          IsPowerOfTwo = true;
          IsZero = false;
          Sign = 1;}; 2 {IsEven = true;
                         IsOne = false;
                         IsPowerOfTwo = true;
                         IsZero = false;
                         Sign = 1;}; 3 {IsEven = false;
                                        IsOne = false;
                                        IsPowerOfTwo = false;
                                        IsZero = false;
                                        Sign = 1;}; 4 {IsEven = true;
                                                       IsOne = false;
                                                       IsPowerOfTwo = true;
                                                       IsZero = false;
                                                       Sign = 1;}; ...]

Update: and as Daniel showed, you can use generic language primitives to easily write another statically constrained function in terms infiniteRange with skip 1 built-in:
let inline infiniteRangeSkip1 start =
    infiniteRange start LanguagePrimitives.GenericOne

Here's the type signature:
val inline infiniteRangeSkip1 :
   ^a -> seq< ^a>
    when ( ^a or  ^b) : (static member ( + ) :  ^a *  ^b ->  ^a) and
          ^b : (static member get_One : ->  ^b)

A: You might even consider extending the Seq module if this is something you frequently need.
module Seq =
  let initInfiniteBig =
    seq {
      let i = ref 0I
      while true do
        yield !i
        i := !i + 1I
    }

let ten = Seq.initInfiniteBig |> Seq.take 10

Update
I benchmarked a few variations:
let initInfiniteBig =
  seq {
    let i = ref 0I
    while true do
      yield !i
      i := !i + 1I
  }

let initInfiniteBig2 =
  seq {
    let i = ref 0I
    while true do
      yield i.contents
      i.contents <- i.contents + 1I
  }

let initInfiniteBig3 =
  let rec loop i =
    seq {
      yield i
      yield! loop (i + 1I)
    }
  loop 0I

let initInfiniteBig4 = Seq.unfold (fun n -> Some(n, n + 1I)) 0I

let range s = s |> Seq.take 100000000 |> Seq.length |> ignore

range initInfiniteBig  //Real: 00:00:29.913, CPU: 00:00:29.905, GC gen0: 0, gen1: 0, gen2: 0
range initInfiniteBig2 //Real: 00:00:30.045, CPU: 00:00:30.045, GC gen0: 0, gen1: 0, gen2: 0
range initInfiniteBig3 //Real: 00:00:40.345, CPU: 00:00:40.310, GC gen0: 2289, gen1: 5, gen2: 0
range initInfiniteBig4 //Real: 00:00:30.731, CPU: 00:00:30.716, GC gen0: 1146, gen1: 4, gen2: 1

Update 2
Here's a generic range function, like Stephen's, but without start and skip.
let inline infiniteRange() : seq<'a> =
  let zero : 'a = LanguagePrimitives.GenericZero
  let one : 'a = LanguagePrimitives.GenericOne
  seq {
      let n = ref zero
      while true do
          yield !n
          n := !n + one
  }

Here's the signature:
unit -> seq< ^a>
    when  ^a : (static member get_Zero : ->  ^a) and
          ^a : (static member get_One : ->  ^a) and
          ^a : (static member ( + ) :  ^a *  ^a ->  ^a)

And the benchmark:
range (infiniteRange() : seq<bigint>) //Real: 00:00:30.042, CPU: 00:00:29.952, GC gen0: 0, gen1: 0, gen2: 0

A: Seq.unfold (fun n -> Some(n, n + 1I)) 0I


text:
Q: How to get post info, when user visits a post page in WordPress? When a user visits a particular post or page ( except home page ) how to get the post info ( atleast ID of the post ) in php? which action or filter best suits for this ?
I want to detect when a user visits a page or post and make an html log like this:
a user visited the page  Post Title
i currently have the_post action but it runs in home page also.

A: You can use is_home() to check if it's home page or not. And you can use get_permalink and get_the_title to get link and post title
Try this:
if (!is_home()) {
    echo 'a user visited the page ' . get_the_title() . '';
}


text:
Q: How does this serial input DAC work? This is the datasheet for 6379A:
datasheet
I looked at the timing charts, but I'm still having trouble figuring out how the IC treats the serial input.
Apparently, SI is sampled at positive clock edge, but what indicates the start of the input? I mean where are MSB and LSB? Also, I don't get what LRCK does either.
Can someone please explain to me, in simple words, how this IC is used?

A: The converter needs one 16 bit word for both channels, L first and then R. LRCK shows to the converter is there coming in data for L or R. Both words come in MSB first, LSB last.
The output of the converter is made from the last fully inputted L+R word pair. The output changes when the input of the next L+R word pair is started. Both channel outputs change at the same time, because people generally do not want any time delay between L and R signals, the timing must be "sample accurate".


text:
Q: Club two payloads with DataWeave I am new to MuleSoft and struggling with a scenario for DataWeave. Can someone please help me with an optimized way to merge two payloads to get the desired output; payload1 has fields and payload2 has Rule Set for those fields;
we need to club every field with their corresponding rules; for example 'name' field needs to be clubbed with 'name' rules, similarly 'roll' field needs to be clubbed with 'roll' rules(their might be multiple rules for single field); and so on:
Data:
payload1 =
    [
        {
            "ID" : "1",
            "Name" : "ABC",
            "Roll" : 123,
            "Address" : "PQR-234",
            "Standard" : "5"
        },
        {
            "ID" : "2",
            "Name" : "PQR",
            "Roll" : 456,
            "Address" : "REC-678",
            "Standard" : "7"
        },.
        .
        .
    ]

payload2 =
    [
        {
            "field" : "Name",
            "field-Type": "String",
            "operator": "Not-In-List" ,
            "condition-Operand-Type": "",
            "error-Message": "Name - Invalid Value: Name not found in the list."
        },
        {
            "field" : "Name",
            "field-Type": "String",
            "operator": "invalid" ,
            "condition-Operand-Type": "",
            "error-Message": "Name - Invalid Value: There cannot be special char in a name."
        },
        {
            "field" : "Roll",
            "field-Type": "String",
            "operator": "Not-In-List" ,
            "condition-Operand-Type": "",
            "error-Message": "Roll - Invalid Value: Roll not found in the list."
        },
        {
            "field" : "Address",
            "field-Type": "String",
            "operator": "Not-In-List" ,
            "condition-Operand-Type": "",
            "error-Message": "Address - Invalid Value: Address not found in the list."
        },
        .
        .
        .
    ]

Desired Output:
    [
        {
            "ID" : "1",
            "Name" : "ABC",
            "data-Quality-Rule" :
            {
                "field" : "ABC",
                "field-Type": "String",
                "operator": "Not-In-List" ,
                "condition-Operand-Type": "",
                "error-Message": "Name - Invalid Value: Name not found in the list."
            }
        },
        {
            "ID" : "1",
            "Name" : "ABC",
            "data-Quality-Rule" :
            {
                "field" : "ABC",
                "field-Type": "String",
                "operator": "invalid" ,
                "condition-Operand-Type": "",
                "error-Message": "Name - Invalid Value: There cannot be special char in a name."
            }
        },
        {
            "ID" : "1",
            "Roll" : "123",
            "data-Quality-Rule" :
            {
                "field" : "123",
                "field-Type": "String",
                "operator": "Not-In-List" ,
                "condition-Operand-Type": "",
                "error-Message": "Roll - Invalid Value: Roll not found in the list."
            }
        },
        .
        .
        .

    ]

A: First use the keys to filter the list of rules that applies to each element on the payload. I used namesOf() but can be done with pluck() also. Then use the list of rules on each item of the list to map the output, instead of trying to do it on the original payload. And use flatMap() instead of map() to remove the inconvenient nesting of lists on each step.
Script:
%dw 2.0
output application/json
fun applyRules(p, r)=
    namesOf(p) flatMap ((keyName, order) -> rules filter ($.field == keyName as String))
---
payload flatMap ((item, order) ->
    applyRules(item, vars.rules)
    map {
            ID: item.ID,
            Name: item.Name,
            "data-quality-rules": $
        }
    )

Payload:
[
    {
        "ID" : "1",
        "Name" : "ABC",
        "Roll" : 123,
        "Address" : "PQR-234",
        "Standard" : "5"
    },
    {
        "ID" : "2",
        "Name" : "PQR",
        "Roll" : 456,
        "Address" : "REC-678",
        "Standard" : "7"
    }
]

Variable vars.rules:
[
    {
        "field" : "Name",
        "field-Type": "String",
        "operator": "Not-In-List" ,
        "condition-Operand-Type": "",
        "error-Message": "Name - Invalid Value: Name not found in the list."
    },
    {
        "field" : "Name",
        "field-Type": "String",
        "operator": "invalid" ,
        "condition-Operand-Type": "",
        "error-Message": "Name - Invalid Value: There cannot be special char in a name."
    },
    {
        "field" : "Roll",
        "field-Type": "String",
        "operator": "Not-In-List" ,
        "condition-Operand-Type": "",
        "error-Message": "Roll - Invalid Value: Roll not found in the list."
    },
    {
        "field" : "Address",
        "field-Type": "String",
        "operator": "Not-In-List" ,
        "condition-Operand-Type": "",
        "error-Message": "Address - Invalid Value: Address not found in the list."
    }
]

Output:
[
  {
    "ID": "1",
    "Name": "ABC",
    "data-quality-rules": {
      "field": "Name",
      "field-Type": "String",
      "operator": "Not-In-List",
      "condition-Operand-Type": "",
      "error-Message": "Name - Invalid Value: Name not found in the list."
    }
  },
  {
    "ID": "1",
    "Name": "ABC",
    "data-quality-rules": {
      "field": "Name",
      "field-Type": "String",
      "operator": "invalid",
      "condition-Operand-Type": "",
      "error-Message": "Name - Invalid Value: There cannot be special char in a name."
    }
  },
  {
    "ID": "1",
    "Name": "ABC",
    "data-quality-rules": {
      "field": "Roll",
      "field-Type": "String",
      "operator": "Not-In-List",
      "condition-Operand-Type": "",
      "error-Message": "Roll - Invalid Value: Roll not found in the list."
    }
  },
  {
    "ID": "1",
    "Name": "ABC",
    "data-quality-rules": {
      "field": "Address",
      "field-Type": "String",
      "operator": "Not-In-List",
      "condition-Operand-Type": "",
      "error-Message": "Address - Invalid Value: Address not found in the list."
    }
  },
  {
    "ID": "2",
    "Name": "PQR",
    "data-quality-rules": {
      "field": "Name",
      "field-Type": "String",
      "operator": "Not-In-List",
      "condition-Operand-Type": "",
      "error-Message": "Name - Invalid Value: Name not found in the list."
    }
  },
  {
    "ID": "2",
    "Name": "PQR",
    "data-quality-rules": {
      "field": "Name",
      "field-Type": "String",
      "operator": "invalid",
      "condition-Operand-Type": "",
      "error-Message": "Name - Invalid Value: There cannot be special char in a name."
    }
  },
  {
    "ID": "2",
    "Name": "PQR",
    "data-quality-rules": {
      "field": "Roll",
      "field-Type": "String",
      "operator": "Not-In-List",
      "condition-Operand-Type": "",
      "error-Message": "Roll - Invalid Value: Roll not found in the list."
    }
  },
  {
    "ID": "2",
    "Name": "PQR",
    "data-quality-rules": {
      "field": "Address",
      "field-Type": "String",
      "operator": "Not-In-List",
      "condition-Operand-Type": "",
      "error-Message": "Address - Invalid Value: Address not found in the list."
    }
  }
]


text:
Q: Slot content of template into my inline component I have this template:
<template>
 <my-body-component inline-component>
    <slot/>
 </my-body-component>
</template>

and I want  my-body-component to be an inline component which contains whatever is in the slot, however when I render the body this way:
const my-body-component= {
  render(h) {
    return this.$slots.default;
  }
};

I can't seem to access this.$slots.default.
What would be a good way to get the slot content inside my own inline component?
I also get: "'render' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." this error.

A: Use Vue.extend({}) to have types inference.
Returning this.$slots.default is fine as long as the slot contains a single element (because Vue 2 can't render multiple fragments).
const myBodyComponent = Vue.extend({
  render(h) {
    return this.$slots.default
      ? this.$slots.default.find(vnode => vnode.tag)!
      : h('span')
  }
})

If it can happen the slot contains multiple elements, instead:
return h('div', this.$slots.default)


text:
Q: Can I customize the To Email address on Contact Form 7? I want the email to be sent to different email addresses based on a drop-down Subject value. Can I do this with Contact Form 7?

A: Use Pipes. See the FAQ: http://contactform7.com/selectable-recipient-with-pipes/
I.e.:
[select your-recipient "CEO|ceo@example.com"
                    "Sales|sales@example.com"
                    "Support|support@example.com"]

A: Yes. You can create the drop down menu and populate it with the various e-mail addresses you want the user to choose, and in the e-mail section of the form, just put the drop down code into the mail field.