text:
Q: Docker command/option to display or list the build context Is there a command/option to display or list the context which is sent to the Docker daemon for building an image?
$ docker build -t "image-name"
Sending build context to Docker daemon 8.499 MB
...

Files and directories can be excluded from the build context by specifying patterns in a .dockerignore file. I guess what I'm looking for amounts to testing the .dockerignore in addition to any other niche rules Docker uses when determined the context.

A: Answers above are great, but there is a low-tech solution for most cases - ncdu. This utility will show pretty and interactive tree structure with sizes. It has an option that will take patterns from a file and exclude them from scan. So you can just do ncdu -X .dockerignore. You will get something like this:

This is pretty close to what you will get in your docker image. One caveat is thou if you add a dot directory (like .yarn) into an image, it will not show in ncdu output.

A: The only way would be to add the current directory to an specific directory and list it.
Try building with this Dockerfile:
FROM busybox

RUN mkdir /tmp/build/
# Add context to /tmp/build/
COPY . /tmp/build/

Build it with:
docker build -t test .

List all the files and directories in /tmp/build:
docker run --rm -it test find /tmp/build

A: Starting with version 18.09, Docker has an option to export context data using BuildKit backend.
It's not enabled by default, so you need to set an environment variable DOCKER_BUILDKIT=1 before invoking docker build command.
The following command can work also if you don't have any Dockerfile in current directory.
printf 'FROM scratch\nCOPY . /' | DOCKER_BUILDKIT=1 docker build -f- -o context .

When you run multiple times remember to delete previous export with rm -r context.
You can also get context data as archive and then mount with archivemount command:
printf 'FROM scratch\nCOPY . /' | DOCKER_BUILDKIT=1 docker build -f- -o- . > context.tar
mkdir context
archivemount context.tar context

With both methods, then you can explore the result with ncdu context.

A: Updated answer: Since 2017, Docker has recommended to use COPY instead of ADD and with the comment from @tlrobinson, the simpler Dockerfile looks like so:
# debug and list the docker build context so that you can minimmize it
#
# usage:
#  docker build -f docker/context.Dockerfile -t test/buildcontext .
#
######################
FROM busybox

RUN mkdir /tmp/build/
# Add context to /tmp/build/
COPY . /tmp/build

# this last command outputs the list of files added to the build context:
RUN find /tmp/build/

A: What worked for me is to do the following (based on this article).

*

*Tell Docker to use the old build kit. In PowerShell that is:
$ENV:DOCKER_BUILDKIT=0

*Run Docker build so that it reports ALL the progress it's making:
docker build --progress=plain BLAH
Given those two things you can then do something as simple as this in your Docker file:
RUN ls /app

And that will give you a list out of everything in the /app folder.

A: Here is a script that outputs the context tarball sent by docker build to the Docker daemon. You can examine it like /path/to/script_below | tar -tv for example.
#!/usr/bin/python3

from http.server import BaseHTTPRequestHandler
from re import match
from socketserver import UnixStreamServer
from subprocess import Popen, DEVNULL
from sys import exit, stdout
from tempfile import TemporaryDirectory

class ContextDumper(BaseHTTPRequestHandler):
    def __init__(self, request, client_address, server):
        # provide dummy client address for error reporting
        super().__init__(request, ('docker_context', 0), server)

    def do_HEAD(self):
        if self.path != '/_ping':
            self.send_error(404, '/_ping only')

    do_GET = do_HEAD

    def do_POST(self):
        if match(r'/v1\.\d+/build\?', self.path) is None:
            self.send_error(404, '/v1.X/build only')
            exit(1)
        total = 0
        while True:
            chunk_length = int(self.rfile.readline().strip(), 16)
            total += chunk_length
            chunk = self.rfile.read(chunk_length)
            stdout.buffer.write(chunk)
            self.rfile.readline()
            if chunk_length == 0:
                break
        padding = (512 - (total % 512)) % 512
        stdout.buffer.write(bytes(padding))
        exit(0)

with TemporaryDirectory() as tmpdir:
    socket_path = tmpdir + '/docker_context.sock'
    fake_dockerd = UnixStreamServer(socket_path, ContextDumper)
    with Popen(['docker', f'--host=unix://{socket_path}', 'build', '--file=/dev/null', '.'],
               stdout=DEVNULL, stderr=DEVNULL) as builder:
        fake_dockerd.serve_forever()


text:
Q: Use of an if statement with open workbook variable I am trying to simplify some code, and wondered whether I would be able to use an If statement to set a different open workbook variable, depending on a few conditions of a defined range.
basically something like
dim ws as worksheet: set ws = Thisworkbook.worksheet("worksheet name")
dim r as range: set range = ws.range("A cell which has an if statement in it to display a number based on another cells contents")
dim wb as workbook

this is where I want to vary the actual workbook set as wb
if r.value = 1 then
set wb = Open a workbook
elseif r.value = 2 then
set wb = Open another workbook

Ideally I would then do the same for ws2 which would be the specific worksheet variable for the specified workbook above
Not sure if this method will work and wondered if I was on the right track.  I have code which opens a workbook, finds values in various rows, inserts rows, copies cell contents., between two ws variables, etc.  And it works, but I need ot add more workbook options and Id rather not have multiple macros with the only difference being the variable for the second workbook to open and work with.

A: Its OK - tried the above and it seems to work fine - just lacked a bit of confidence I suppose.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to make a moving/sliding element in Three.js? I discovered three.js which I love to use now, but I built a rotating car animation with keyboard arrows to control it, but I can't find out how to make a sliding animation (e.g.,
-> -> ->

) Instead of a rotation animation. I tried searching but I don't even know how to explain it other than a sliding animation. Does someone know how / if you can do this?
Here is my code:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>ThreeJS Animation</title>
        <style>
            body {
              margin: 0;
              font-weight: 100;
              float: none;
              overflow: hidden;
            }
            canvas {
              width: 100%;
              height: 100%;
              margin: 0;
              padding: 0;
            }
        </style>
    </head>
    <body>
        <script src="https://threejs.org/build/three.js"></script>
        <script>
let carBottomColor = "#999";
let carTopColor = "#FFF";
let carWindowColor = "#666";
const scene = new THREE.Scene();
scene.background = new THREE.Color("#f1f1f1");
const car = createCar();
scene.add(car);

const ambientLight = new THREE.AmbientLight(0xffffff, 0.6);
scene.add(ambientLight);

const dirLight = new THREE.DirectionalLight(0xffffff, 0.8);
dirLight.position.set(200, 500, 300);
scene.add(dirLight);

const aspectRatio = window.innerWidth / window.innerHeight;
const cameraWidth = 300;
const cameraHeight = cameraWidth / aspectRatio;
const camera = new THREE.OrthographicCamera(
  cameraWidth / -2, // left
  cameraWidth / 2, // right
  cameraHeight / 2, // top
  cameraHeight / -2, // bottom
  200, // near plane
  800 // far plane
);
camera.position.set(200, 200, 200);
camera.lookAt(0, 10, 0);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.render(scene, camera);

let x = 0;
let y = 0;
let keydown = '';
document.body.addEventListener('keydown', e => {
  keydown = e.key;
});
document.body.addEventListener('keyup', e => {
  keydown = '';
});
const update = () => {
    switch (keydown) {
    case 'ArrowUp':
      x -= 0.1;
      car.rotation.x = x;
      break;
    case 'ArrowDown':
      x += 0.1;
      car.rotation.x = x;
      break;
    case 'ArrowLeft':
      y -= 0.1;
      car.rotation.y = y;
      break;
    case 'ArrowRight':
      y += 0.1;
      car.rotation.y = y;
      break;
  }
  window.requestAnimationFrame(update);
}
window.requestAnimationFrame(update);

renderer.setAnimationLoop(() => {
  renderer.render(scene, camera);
});

document.body.appendChild(renderer.domElement);

function createCar() {
  const car = new THREE.Group();
  const backWheel = createWheels();
  backWheel.position.y = 6;
  backWheel.position.x = -18;
  car.add(backWheel);

  const frontWheel = createWheels();
  frontWheel.position.y = 6;
  frontWheel.position.x = 18;
  car.add(frontWheel);

  const main = new THREE.Mesh(
    new THREE.BoxGeometry(60, 15, 30),
    new THREE.MeshLambertMaterial({ color: carBottomColor })
  );
  main.position.y = 12;
  car.add(main);

  const carFrontTexture = getCarFrontTexture();

  const carBackTexture = getCarFrontTexture();

  const carRightSideTexture = getCarSideTexture();

  const carLeftSideTexture = getCarSideTexture();
  carLeftSideTexture.center = new THREE.Vector2(0.5, 0.5);
  carLeftSideTexture.rotation = Math.PI;
  carLeftSideTexture.flipY = false;

  const cabin = new THREE.Mesh(new THREE.BoxGeometry(33, 12, 24), [
    new THREE.MeshLambertMaterial({ map: carFrontTexture }),
    new THREE.MeshLambertMaterial({ map: carBackTexture }),
    new THREE.MeshLambertMaterial({ color: carTopColor }), // top
    new THREE.MeshLambertMaterial({ color: carTopColor }), // bottom
    new THREE.MeshLambertMaterial({ map: carRightSideTexture }),
    new THREE.MeshLambertMaterial({ map: carLeftSideTexture })
  ]);
  cabin.position.x = -6;
  cabin.position.y = 25.5;
  car.add(cabin);
  return car;
}

function createWheels() {
  const geometry = new THREE.BoxGeometry(12, 12, 33);
  const material = new THREE.MeshLambertMaterial({ color: "#333" });
  const wheel = new THREE.Mesh(geometry, material);
  return wheel;
}

function getCarFrontTexture() {
  const canvas = document.createElement("canvas");
  canvas.width = 64;
  canvas.height = 32;
  const context = canvas.getContext("2d");

  context.fillStyle = "#ffffff";
  context.fillRect(0, 0, 64, 32);

  context.fillStyle = carWindowColor || carBaseColor; // Wheel color
  context.fillRect(8, 8, 48, 24);

  return new THREE.CanvasTexture(canvas);
}

function getCarSideTexture() {
  const canvas = document.createElement("canvas");
  canvas.width = 128;
  canvas.height = 32;
  const context = canvas.getContext("2d");

  context.fillStyle = "#ffffff";
  context.fillRect(0, 0, 128, 32);

  context.fillStyle = carWindowColor || carBaseColor; // Wheel color
  context.fillRect(10, 8, 38, 24);
  context.fillRect(58, 8, 60, 24);

  return new THREE.CanvasTexture(canvas);
}
        </script>
    </body>
</html>

A: I made some assumptions, but I think what you're trying to do is rotate the car along the y-axis when pressing left/right arrows, and you're trying to move the card forward when pressing up/down arrows. If that's the case, then you can do car.translateX() to create that forward/backward motion, and car.rotation.y to make the car turn.
Here's the modified example:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>ThreeJS Animation</title>
        <style>
            body {
              margin: 0;
              font-weight: 100;
              float: none;
              overflow: hidden;
            }
            canvas {
              width: 100%;
              height: 100%;
              margin: 0;
              padding: 0;
            }
        </style>
    </head>
    <body>
        <script src="https://threejs.org/build/three.js"></script>
        <script>
let carBottomColor = "#999";
let carTopColor = "#FFF";
let carWindowColor = "#666";
const scene = new THREE.Scene();
scene.background = new THREE.Color("#f1f1f1");
const car = createCar();
scene.add(car);

const ambientLight = new THREE.AmbientLight(0xffffff, 0.6);
scene.add(ambientLight);

const dirLight = new THREE.DirectionalLight(0xffffff, 0.8);
dirLight.position.set(200, 500, 300);
scene.add(dirLight);

const aspectRatio = window.innerWidth / window.innerHeight;
const cameraWidth = 300;
const cameraHeight = cameraWidth / aspectRatio;
const camera = new THREE.OrthographicCamera(
  cameraWidth / -2, // left
  cameraWidth / 2, // right
  cameraHeight / 2, // top
  cameraHeight / -2, // bottom
  200, // near plane
  800 // far plane
);
camera.position.set(200, 200, 200);
camera.lookAt(0, 10, 0);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.render(scene, camera);

let x = 0;
let y = 0;
let keydown = '';
document.body.addEventListener('keydown', e => {
  e.preventDefault();
  keydown = e.key;
});
document.body.addEventListener('keyup', e => {
  keydown = '';
});
const update = () => {
    switch (keydown) {
    case 'ArrowUp':
      car.translateX(1.0);
      break;
    case 'ArrowDown':
      car.translateX(-1.0);
      break;
    case 'ArrowLeft':
      y += 0.1;
      car.rotation.y = y;
      break;
    case 'ArrowRight':
      y -= 0.1;
      car.rotation.y = y;
      break;
  }
  window.requestAnimationFrame(update);
}
window.requestAnimationFrame(update);

renderer.setAnimationLoop(() => {
  renderer.render(scene, camera);
});

document.body.appendChild(renderer.domElement);

function createCar() {
  const car = new THREE.Group();
  const backWheel = createWheels();
  backWheel.position.y = 6;
  backWheel.position.x = -18;
  car.add(backWheel);

  const frontWheel = createWheels();
  frontWheel.position.y = 6;
  frontWheel.position.x = 18;
  car.add(frontWheel);

  const main = new THREE.Mesh(
    new THREE.BoxGeometry(60, 15, 30),
    new THREE.MeshLambertMaterial({ color: carBottomColor })
  );
  main.position.y = 12;
  car.add(main);

  const carFrontTexture = getCarFrontTexture();

  const carBackTexture = getCarFrontTexture();

  const carRightSideTexture = getCarSideTexture();

  const carLeftSideTexture = getCarSideTexture();
  carLeftSideTexture.center = new THREE.Vector2(0.5, 0.5);
  carLeftSideTexture.rotation = Math.PI;
  carLeftSideTexture.flipY = false;

  const cabin = new THREE.Mesh(new THREE.BoxGeometry(33, 12, 24), [
    new THREE.MeshLambertMaterial({ map: carFrontTexture }),
    new THREE.MeshLambertMaterial({ map: carBackTexture }),
    new THREE.MeshLambertMaterial({ color: carTopColor }), // top
    new THREE.MeshLambertMaterial({ color: carTopColor }), // bottom
    new THREE.MeshLambertMaterial({ map: carRightSideTexture }),
    new THREE.MeshLambertMaterial({ map: carLeftSideTexture })
  ]);
  cabin.position.x = -6;
  cabin.position.y = 25.5;
  car.add(cabin);
  return car;
}

function createWheels() {
  const geometry = new THREE.BoxGeometry(12, 12, 33);
  const material = new THREE.MeshLambertMaterial({ color: "#333" });
  const wheel = new THREE.Mesh(geometry, material);
  return wheel;
}

function getCarFrontTexture() {
  const canvas = document.createElement("canvas");
  canvas.width = 64;
  canvas.height = 32;
  const context = canvas.getContext("2d");

  context.fillStyle = "#ffffff";
  context.fillRect(0, 0, 64, 32);

  context.fillStyle = carWindowColor || carBaseColor; // Wheel color
  context.fillRect(8, 8, 48, 24);

  return new THREE.CanvasTexture(canvas);
}

function getCarSideTexture() {
  const canvas = document.createElement("canvas");
  canvas.width = 128;
  canvas.height = 32;
  const context = canvas.getContext("2d");

  context.fillStyle = "#ffffff";
  context.fillRect(0, 0, 128, 32);

  context.fillStyle = carWindowColor || carBaseColor; // Wheel color
  context.fillRect(10, 8, 38, 24);
  context.fillRect(58, 8, 60, 24);

  return new THREE.CanvasTexture(canvas);
}
        </script>
    </body>
</html>


text:
Q: How can I replace the method Click on Selenium C#? In my web page
<button class="btn btn-small dropdown-toggle" data-toggle="dropdown">
                       Name Button

</button>

<input id="---" type="hidden" value="---"/>

Tranche A

 .....

Manuallly when I click on the button "Name Button" a popup menu appears but When I use the method Click() of selenium the popup menu apperas then it will be closed and in this case i can't detect the text on the popup .
IWebElement element = null;
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
element = wait.Until(ExpectedConditions.ElementToBeClickable(locator));
element.Click();

How can i replace this code, and the popup menu stay opened until i select a value from the popup.
I have tried also:
 Actions builder = new Actions(driver);
 IWebElement element = null;
 WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
 element = wait.Until(ExpectedConditions.ElementToBeClickable(locator));
 builder.MoveToElement(element).Release();


text:
Q: .NET 5 vNext Resolving dependencies with parameters I have been able to resolve dependencies with parameterless constructors using vNext DI.
But when I tried to specify a parameter for one of my dependencies, it gives runtime error:

System.InvalidOperationException Unable to resolve service for type
  'System.String' while attempting to activate 'Namespace.MyService'

Constructor:
public MyService(string name)
{
    // initialize
}

Usage:
private readonly IMyService _myService;
public Consumer(IMyService myService)
{
        // initialize
        _myService = myService;
}

I updated this dependency registration by adding:
services.AddInstance(new MyService("Hello"));

It only works if I update the Consumer class constructor parameter to use type MyService
My initial registration was:
services.AddTransient<IMyService, MyService>(); // Todo: configure constructor injection

I really want to use the interfaces not the concrete classes for this process. How can I get this to work?

A: It's as simple as explicitly specifying the type of the service:
services.AddInstance<IMyService>(new MyService("Hello"));

The compiler would normally infer the generic parameter type, but you can always explicitly specify generic type arguments.

A: another thing to consider though there is not much documentation on it yet, is instead of taking a string in your constructor take an IOptions class and put the string as a property of the options
http://shazwazza.com/post/using-aspnet5-optionsmodel/
then later if needed you can add properties to pass in without changing the constructor

A: There is another approach, you can add config class:
public class MyServiceConfig
{
    public MyServiceConfig(string name)
    {
        // initialize
    }
}

public class MyService
{
    public MyService(MyServiceConfig myServiceConfig)
    {
        // initialize
    }
}

services.AddInstance(new MyServiceConfig("Hello"));
services.AddTransient<IMyService, MyService>();


text:
Q: Installation of TensorClus Via Pip I would like to install the TensorClus library. To do so, I do
pip install TensorClus

When I do this, however, Python complains, saying

tensorclus depends on numpy 1.18.3, and pandas 1.0.3.

However, when I check to see which versions of these I have via pip show numpy and pip show pandas, I'm told that I have 1.22.1 numpy and pandas 1.2.4. I have Python 3.9, and my libraries seem to be up to date. What might the problem be?
EDIT: My coworker found the answer. Apparently the solution was difficult. When he shares it with me tomorrow, I will post the exact solution since it would presumably benefit others.

A: The problem with the library is that it specifies the exact versions up to the last component instead of providing reasonable ranges. To install it you need to install these exact versions. The simplest way to do that is to allow pip to upgrade/downgrade already installed versions:
pip install --upgrade TensorClus

Can be shortened to just
pip install -U TensorClus

PS. And my advice is to always use virtual environments — virtualenv, venv, virtualenvwrapper, pyenv-virtualenv, whatever.

A: Have you tried to downgrade "NumPy" and "Pandas" to the required versions?
pip3 install numpy==1.18.3
pip3 install pandas==1.0.3


text:
Q: gsdll32.dll stays locked after API delete/exit I built a converter using GhostScriptSharp to generate full-page images of PDF files via a website, and gsdll32.dll seems to remain locked (as well as the files it generated/worked from) whenever I call GenerateOutput().
My code snippet:
GhostscriptSharp.GhostscriptWrapper.GenerateOutput(pdfFile, outputFile, settings);

Immediately after calling this, I save the resulting bytes to a blob on Azure. Once that's done I try to call:
try {
    File.Delete(outputFile); // clean up if we can
}
catch { }

Which throws an exception because the file is still locked.
Then when I try to build again (either via F5 or even in live situations) I get an error saying it can't copy gsdll32.dll to my bin folder because it's locked.
I checked GhostScriptSharp against the Ghostscript API, and it seems everything is being called in the correct order. I can't explain why IIS is retaining a lock on gsdll32.dll, though.
Anyone run into this before? I can't seem to find anyone with a similar problem.
Update: I tried calling ExitAPI/DeleteAPI a second time in the catch above in case it just didn't take the first time for some reason, and it threw an AccessViolationException. So it looks like the API is exiting properly, just IIS isn't releasing locks properly I guess?

A: After more research, this appears to actually be behavior between IIS and native dll imports. For most purposes this problem can be avoided by unloading the AppDomain (i.e. cycling the app pool) before publishing. This is doable in a normal publishing scenario using app_offline.htm, but in an Azure continuous integration environment this is not an option (which is sad because I've had to disable CI and resort to manual publishing on my master branch).
Any further input on how I could work around this to get builds automated would be incredibly helpful. The only workaround I have in right now involves offloading the Ghostscript dependency to a separate machine and setting up a message queue to process things (ugh).


text:
Q: IBM Worklight 6.1 - How to open links? I have tried using this WL.App.openURL('link','_blank').
In my app, I have some hyperlinks. Upon clicking a link, it has to load respective pages in the app itself.
How do I accomplish this?

A: You are mis-using the API...
You have 2 options:

*

*Use Cordova's InAppBrowser API
This way you can display a browser window ontop of the app; when done you tap a button to close it and return to the app. This code snippet works:

visit Apache.org;

*Read the Integrating server-generated pages in hybrid applications training module and inspect the sample project
This way you can load an external URL within the application's WebView.

For your case option 1 seems the solution to use.


text:
Q: NetLogo foreach list I am trying to create a code that will allow me to get the who numbers of 10 turtles and store them in a list. However, the "who" number can only be added to the list if it has not been added to the list before.
I have to use the "foreach" command to check if the number has already been added to the list.
Any suggestions on how to do so?
My code:
turtles-own [contact-list]

to setup
  clear-all

  create-turtles 10 [
    set contact-list []
    print who
  ]

  reset-ticks
end

to go
  ask turtles [
    set contact-list lput [who] of one-of other turtles-here contact-list
    foreach contact-list[
      ; this is where the command goes
    ]
    print contact-list
  ]
end

A: Might it be easier to add all the who numbers to the list and then use the remove-duplicates primitive to remove the duplicate numbers?  I assume that you have a reason for putting who numbers into the list rather than having a list of the agents themselves, or an agentset.  In general, who numbers are to be avoided.


text:
Q: Как добавить свой пункт в меню "Surround with" в Intellij Idea?
Изучаю программирование и бывает, что проверяешь правильно ли работает метод, который просто возвращает значение, а не выводит его в консоль. Я написал его вызов и приходится переписывать эту строку c System.out.println(вызов_метода()), чтобы увидеть значение.
Можно ли сделать так, чтобы процесс переписывания строчки кода заменился на нажатие нескольких клавиш?


text:
Q: How to get the the sequential number on duplicates? I'm not sure how to word this correctly, but I need to get the sequential number on duplicates in google sheets. For example, column Count is what I'm looking for:
+-------+-------+
| Name  | Count |
+-------+-------+
| Joe   |     1 |
| Lisa  |     1 |
| Jenny |     1 |
| Lisa  |     2 |
| Lisa  |     3 |
| Joe   |     2 |
| Jenny |     2 |

Sample sheet: https://docs.google.com/spreadsheets/d/1BB4bzzR3TTAfW5SwvNG_W3AsIYqlSEaSOad5wB4sdko/edit#gid=0
Any help is appreciated, thanks!

A: For an array-enabled solution, you could try in C1
={"Count"; ArrayFormula(iferror(SORT(ROW(A2:A),SORT(ROW(A2:A),A2:A,1),1)-MATCH(A2:A,SORT(A2:A),0)-ROW()+1))}

For more background, also see this thread.

A: Got it, it's: =COUNTIF($A$2:A2,A2)


text:
Q: Search Bars and Buttons in HTML I'm currently making a website using PHP, HTML and a classless CSS (Water.css) Right now, I have a problem aligning my search bars and buttons into a row

    <form action="search.php" method="GET">
        <input type="text" name="query" placeholder="Search Equipment">
        <input type="submit" value="Go">
    </form>

    <form action="searchprice.php" method="post">
        Minimum price:
        <input type="text" name="min_price" id="min_price">
        Maximum price:
        <input type="text" name="max_price" id="max_price">
        <input type="submit" name="submit" value="Search">
    </form>

    <button onclick="window.location='add_equipment.php'">Add Equipment</button>

The search bars and the button work perfectly fine, however I have no clue why it stacks up like a column instead of being in a row.
It would be nice if someone could help me with this, I am a newbie to HTML

A: Not sure if this is what you are looking for:
Like Amir said lots of information on using divs,flex,grid in css. I feel like the classless link is making your inputs do that everytime I link to it, it puts everything in columns.
    <!DOCTYPE html>

    <title>Equipments</title>
    <meta charset="utf-8">
    <link rel="stylesheet" a href="./css/main.css">

List Of Equipments

            <form action="search.php" method="GET">
                Search Equipment
                <input type="text" name="query" placeholder="Search Equipment">

                <input id="Sbutton" type="submit" value="Go">

            </form>

            <form action="searchprice.php" method="post">
                Minimum price:
                <input type="text" name="min_price" id="min_price">

                Maximum price:
                <input type="text" name="max_price" id="max_price">

                <input id="Sbutton2" type="submit" name="submit" value="Search">
                <button id="Sbutton3" onclick="window.location='add_equipment.php'">Add Equipment</button>
            </form>

Here is the CSS when I am styling I like to change background of each div class so I can get a visual of what is happening as I change code.
.nav{
  display: flex;
  flex-direction: column;
  margin: 10px;
  margin-left: 15%;
  margin-right: 15%;
  padding-bottom: 20px;
  background-color: rgb(77, 76, 76);
}
h2{
  text-align: center;
  font-size: 24px;
  font-weight:bolder;
}
.navs {
    width: 50%;
    background-color: rgb(108, 109, 109);
    height: 150px;
    text-align: center;
    margin-left: 25%;
    margin-top: 20px;
    padding-top:  10px;
   }

  #Sbutton{
    font-size: 16px;
    height: 150%;
    width: 15%;
    margin-left:  15%;
    margin-top: 10px;

  }
  #Sbutton2{
    font-size: 16px;
    height: 150%;
    width: 15%;
    margin-left:  15%;
    margin-top: 10px;

  }
  #Sbutton3{
    font-size: 16px;
    height: 150%;
    width: 25%;
    margin-top: 10px;

  }

  table{
    border:3px solid gray;
    border-collapse: collapse;
}
th{
    border: 2px solid gray;
    padding: 6px;
}
td{
    border: 2px solid gray;
    text-align: center;
}

Hope this helps.


text:
Q: Recomposition in jetpack compose vs recycle in old ui? LazyColumn and LazyRow are replacing for RecyclerView in the old UI but when scrolling the item in RecyclerView and back to it disappear then recycle to optimization UI.
LazyColumn and LazyRow are doing the same thing?

A: I found it from Jetpack Compose basics Codelab

Note: LazyColumn doesn't recycle its children like RecyclerView. It
emits new Composables as you scroll through it and is still
performant, as emitting Composables is relatively cheap compared to
instantiating Android Views

After testing, I see that LazyColumn just compose visible items. And, by scrolling the invisible items will recompose when it visible again.

A: LazyColumn uses LazyList which uses LazyLayout and it uses aSubComposeLayout to recompose children Composable when required unlike having a Column with Modifier.verticalScroll() which composes all of its children Composables.

Subcomposable has a subocompose function that can be called multiple
times in the layout block. This is, for example, what happens in
LazyRow. The slotId allows SubcomposeLayout to track and manage the
compositions created by calling subcompose. For example, if you are
generating the content from an array you might want use the index of
the array as its slotId allowing SubcomposeLayout to determine which
subcompose generated last time should be used to during recomposition.
Also, if a slotid is not used any more, SubcomposeLayout will dispose
its corresponding composition.

You can read full answer about SubcomposeLayout by Google developer here.


text:
Q: Python Decision Tree Regressor Pruning I'm using scikit-learn to construct regression trees, using tree.DecisionTreeRegression().
I'm giving 56 data samples and it constructs me a Tree with 56 nodes (pruning=0).
How can I implement some pruning to the tree? Any help is appreciated!

A: By default, sklearn trees will grow until each leaf is pure (and the model is completely overfit). If you want to fine-tune the complexity, you can set a number of different parameters that will limit tree growth in different ways. The parameters listed are: max_depth, min_samples_split, min_samples_leaf, min_weight_fraction_leaf, max_leaf_nodes, min_impurity_decrease
For usage see the docs.

A: You can't; use matlab.  Struggling with this at the moment.  Using a python based home-cooked decision tree is also an option.  However, there is no guarantee it will work properly (lots of places you can screw up). And you need to implement with numpy if you want any kind of reasonable run-time (also struggling with this now).
If you still have this problem, I do have a decision tree working with node knowledge and am implementing pruning this weekend...
If I get it to run fast and the code isn't too embarrassingly complicated, I will post a GitHub up here if you are still interested, in exchange for endorsements of ML'ing and Python/Numpy expertise on my LinkedIn.


text:
Q: How to get all IDBIndex key values (instead of object store primary keys)? I have an IndexedDB object store with a primary key and an additional index (with a unique key constraint).
Now I want to retrieve all key values of this index.
Previously, I used IDBIndex.getAllKeys(), but appearently the behaviour of this method has changed to return the object store primary keys instead of the index keys.
(I cannot, however, find any documentation, or reference in browser release notes to that effect...)
So my question is:
What is the recommended, most performant way to retrieve all index key values?

A: IDBIndex.getAll will work, but it will read all the values into memory which may be slow.
And you are correct that IDBIndex.getAllKeys returns only the primary keys, not the index keys.
Unfortunately there is no similar single function that will return the index keys, but you can use IDBIndex.openKeyCursor and avoid reading the values into memory:
const result = [];

index.openKeyCursor().onsuccess = (event) => {
    var cursor = event.target.result;
    if (cursor) {
        // cursor.key is the index key, cursor.primaryKey is the primary key,
        // and cursor.value is undefined because we're using openKeyCursor
        // rather than openCursor.
        result.push(cursor.key);
        cursor.continue();
    } else {
        cb(result);
    }
};

I haven't benchmarked this, but in theory it could be close to as fast as getAllKeys, although probably at least somewhat slower because it requires N events to be fired and handled rather than one.
Just don't try it in MS Edge :)

Previously, I used IDBIndex.getAllKeys(), but appearently the behaviour of this method has changed to return the object store primary keys instead of the index keys. (I cannot, however, find any documentation, or reference in browser release notes to that effect...)

If you were using indexeddb-getall-shim, an earlier version did erroneously return the index keys rather than the primary keys. That was never in the spec, just a bug in the shim. Since I wrote the shim... my apologies if this is indeed the source of your confusion!

A:
Do you know why there is an IDBIndex.getAllKeys() method if it returns the same thing as IDBObjectStore.getAllKeys()

One reason for having these two separate methods is that they both accept an optional query argument, which is a key range.
In the case of IDBObjectStore.getAllKeys(query), the key range is a range of primary keys, and result is an array of primary keys
In the case of IDBIndex.getAllKeys(query), the key range is a range of index keys, and result is an array of primary keys
Example:
/* store (key = SSN) */
const users = await db.createObjectStore("users", { keyPath: "SSN" });

/* index (key = surname) */
users.createIndex("surname", "surname");

/* 1. get all SSNs from store */
const keys = await users.getAllKeys();

/* 2. get all SSNs starting between 'a' and 'f' */
const keys = await users.getAllKeys(IDBKeyRange.bound('a', 'f'));

/* 3. get all SSNs from index (same as #1) */
const keys = await users.index("surname").getAllKeys();

/* 4. get all SSNs where surname is between 'a' and 'f' (different to #2) */
const keys = await users.index("surname").getAllKeys(IDBKeyRange.bound('a', 'f'));


text:
Q: Способы правильной организовки авторизации без session в Node.js/express.js Сейчас я работаю над приложением express.js, в котором пользователь может зарегистрироваться/авторизоваться, после чего создается его профиль, он может добавлять посты, и комментировать чужие. И вот у меня появилась мысль на счёт авторизации пользователя:
(Я использую базу данных MongoDB, при регестрации, создается уникальный id пользователя, напимер: id: 5445b43d258346623c56748e)

*

*Когда пользователь авторизовался, отправляется запрос в базу данных, что бы найти пользователя.

*Если он найден, в cookies браузера записывается id найденного пользователя.

Теперь, при запросе к серверу, пользователь будет идентифицирован по id.
Я знаю что существуют сессии, популярные способы хранения данных сеанса это: Хранение в памяти приложения, В кеш-памяти, В базе данных. Я хочу обойтись без этих способов, так как мой кажется намного проще. Если учитывать проблемы с безопасностью, то это подмена id в куках, но в моем случае с этим проблем быть не должно, так как генерируемый id мне кажется длинным, и подобрать его сложно?
Вопрос в том, корректно ли использовать данный метод? И безопастно ли? Просто везде, если речь идёт об авторизации, все говорят использовать сессии, но что если обойтись без них? Я так же не понимаю, какие минусы, в данном методе? Может нужно как-то улучшить добавляемый в куки id, например как-то хешировать, добавив к нему пароль + имя пользователя + соль?
Буду очень рад, если кто-то объяснит.)


text:
Q: Unique values with frequency count from List> I am trying to count the number of occurrences of every element in a List<List<String>>, and store the results in a Map<String,Long>.
Map<String, Long> map = new HashMap<>();
for(List<String> l : data) {
        for(int i = 0; i < l.size(); i++) {
            String myString = l.get(i);
            long count = data.stream().filter(d -> myString.equals(d)).count();
            map.put(myString, count);
        }
    }

My code returns zero as value for every key. Is there a way to fix it? Thank you.

A: Try with this:
List<List<String>> listOflists  = new ArrayList<>();
//Initialize your list here
Map<String, Long> map = listOflists.stream().flatMap(Collection::stream)
                    .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));

A: You are streaming data, which is a List<List<String>>. That means that each element of the stream has the type List<String>. Then, in the lambda of filter, you are trying to see if myString (of type String) is equal to d (of type List<String>). This will never be true, making count equal to 0 for all elements.
What you need to do is call flatMap on the stream returned by data.stream(), with the function argument being List::stream (or Collection::stream). What this done is convert a stream of List<String> to a stream of String, which you can then call the filter method on.


text:
Q: Some settings are hidden or managed by your organization I have Windows Server 2019 Standard and I can update but I can not add a PIN it is alwayes disabled and there is the red message read: "Some settings are hidden or managed by your organization"
I tried "turn on convience PIN sign-in" in group policy and I restart the server but the PIN still disabled and the red message still there. Any solution to this ?
Edit:
Admin account does not work I need to login with domain account ? I dont have domain account login

A: If you're running a Server OS then you should be using a domain account and the server should be setup properly.
That being said, you can use the gpresult /R command to output the group policies that are applied to the command line, or you can use gpresult /H results.html to output the policies to an HTML file.


text:
Q: Cannot @Autowire dependencies in custom Spring validators I'm trying to validate my Hibernate entities using custom constraints and validators, and some of these validators have dependencies on other services like a configuration class. I understand Spring provides a specific SpringConstraintValidatorFactory precisely for this purpose, and being new at Spring, I found some code to declare the corresponding bean:
The custom validator
@Service
public class MyCustomValidator implements ConstraintValidator<MyConstraint, Integer> {

    @Autowire
    private MyService myService;

    @Override
    public void initialize(MyConstraint constraint) {}

    @Override
    public boolean isValid(Integer someValueToValidate, ConstraintValidatorContext context) {
        // doStuff
    }

MyService class
@Service("MyService")
public class MyService {

    private Configuration configuration;

    @PostConstruct
    private void map() throws IOException {
        ObjectMapper objectMapper = new ObjectMapper(new YAMLFactory());
        InputStream stream = getClass().getClassLoader().getResourceAsStream("config/my_config.yml");
        configuration = objectMapper.readValue(stream, Configuration.class);
    }

    private static class Configuration {
        // some getters and setters
    }
}

Application class
    @Bean
    Validator validator(AutowireCapableBeanFactory autowireCapableBeanFactory) {
        ValidatorFactory validatorFactory = Validation.byProvider(HibernateValidator.class)
            .configure()
            .constraintValidatorFactory(new SpringConstraintValidatorFactory(autowireCapableBeanFactory))
            .buildValidatorFactory();

        return validatorFactory.getValidator();
    }

Even with this solution, I get a NPE on myService when calling the validator on my entity.

A: Hibernate uses own validator so you should override it and use spring validator in hibernate properties using HibernatePropertiesCustomizer.
Here you can find more details: Spring Boot - Hibernate custom constraint doesn't inject Service


text:
Q: How to assign values in a multiindex dataframe derived from a multiindex pivot table? I have created a df from a multiindex pivot table. The pivot table is created from a merged dataframe of 4 csv files.
Now my task is to iterate through the multiindex df to assign values in the rows. I hv 6 warehouses, 91 stores. Under each warehouse different number of stores are assigned with Ranking (ranging from 1 to 91) and Grades like 'A','B','C'.Depending on the 80% of FINAL_ORDER_QTY I have to allocate stock to the stores, by checking a predefined column "QTY" as reference (Depending on size, dept, brand and store grade,the QTY is predefined for that warehouse)
CONDITIONS:

*

*Checking Style_grade column for allocation, Allocate to ALL, TOP80, TOP70, TOP60, TOP50, TOP40, TOP30, TOP20, TOP10.

*Allocate the stock to A grade stores initially.

*Maintain the running count column for left over stock
4.Stop allocation if there is less than the predefined qty or equal to zero.

Adding a slice of the dataframe for reference as my dataframe size is 219 rows × 109 columns
Stock Allocation
TOTAL_ALLOCATED_QTY
Loctioncode                                                   71272
Store Rank                                                       7    16     31     78
Store Grade                                                      A     A      B      C
Storecode                                                       1429   1478  1398    1678
| Brand   | ITEM       | Size| 71272(final_order_qty)|QTY
| -------- | --------  | ------|--------------------------
| Code   | #10009734467 |  18  | 10                  | 3      0      0     0      0
| code   | #10009734469 |  20  | 35                  |  2     0      0     0      0

Any help would be really appreciated.!!
enter image description here
An image for reference on how to allocation should be done.
TOTAL_ALLOCATED_QTY
Loctioncode                                                                       71272
Store Rank                                                                         7    16     31     78
Store Grade                                                                        A     A      B      C
Storecode                                                                        1429   1478  1398    1678
| Brand   | ITEM       | Size| 71272(final_order_qty)|QTY |Store Grade
| -------- | --------  | ------|--------------------------
| Code   | #10009734467 |  18  | 10                  | 3   dressA              3      3     0      0
| code   | #10009734469 |  20  | 5                  |  2   DressA               2     2     0      0
| Code   | #10009734467 |  18  | 10                  | 1   dressB               3     3     1      1
| code   | #10009734469 |  20  | 5                  |  2   DressA               2      2    1      0


text:
Q: Content DB log files growing out of control when using Lists.asmx to update three fields on a library I've created a console application to migrate files from legacy SharePoint servers to a new server utilizing SharePoint Foundation 2010. I'm using Lists.asmx to get list information and update three fields on the source lists: Migrated (boolean), MigrationStatus (multi-row text), and MigrationDate (DateTime).
I am using the WCF data services to upload the file to the new platform. The process is simple: (1) get certain number of items from source list; (2) check data to see if it meets standards for new platform; (3) if passes validation, upload to new SP2010 library, otherwise, update source library on WSS or MOSS to indicate why the data does not meet standards. Everything is working well with one huge caveat.
The content database's log files for the source content database are growing at an alarming rate. It appears that the log file is growing at a rate equal to the file size that is migrated. In other words, if I migrate 20 files that are 6MB each, the log will grow approximately 120MB. For such few files that is way TOO much. I have to migrate 45000 files.
No columns are indexed for this particular library. Versioning was on, but it has been turned off. With versioning off, the log files are still growing out of control during the migration. I am migrating approximately 50GB, and space is an issue.
So, my question....
What am I missing? By updating three fields, is a new version also being created without my knowledge, or is something else occurring?
The update code is below:
    public void SetMigrationStatus(string sourceList, int itemId, bool migratedSuccessfully, string migrationMessage, DateTime migrationDate) {
        var xmlDoc = new XmlDocument();
        var updateElem = xmlDoc.CreateElement("Batch");
        var updateXmlText = new StringBuilder();

        updateXmlText.Append("<Method ID='1' Cmd='Update'>");
        updateXmlText.Append(string.Format("<Field Name='ID'>{0}</Field>", itemId));
        updateXmlText.Append(string.Format("<Field Name='Migrated'>{0}</Field>", migratedSuccessfully));
        updateXmlText.Append(string.Format("<Field Name='MigrationStatus'>{0}</Field>", migrationMessage));

        if (migratedSuccessfully) {
            updateXmlText.Append(string.Format("<Field Name='MigrationDate'>{0}</Field>",
                string.Format("{0} {1}",
                DateTime.Now.ToShortDateString(),
                DateTime.Now.ToLongTimeString())));
        }

        updateXmlText.Append("</Method>");

        updateElem.SetAttribute("OnError", "Continue");
        updateElem.SetAttribute("ListVersion", "1");
        updateElem.InnerXml = updateXmlText.ToString();

        var results = ListsServiceProxy.UpdateListItems(sourceList, updateElem);
    }

A: Are you permitted to switch the SQL logging option on your source database to "simple" for the duration of the migration?  This should resolve the immediate issue.
(I guess it will depend on your backup strategy and SLAs.)


text:
Q: JWPlayer aspect ratio keeps 4:3 for my 16:9 video I am loading an RTMP video stream in JWPlayer. The video stream should be 16:9 but is displayed as 4:3.
My embed code:
var playerInstance = jwplayer("target");
playerInstance.setup({
    file: "rtmp://mystreamhere",
    autostart: true,
    repeat: "always",
    primary: "flash",
    controlbar: "none",
    icons: false,
    width: "100%",
    aspectratio: "16:9"
});

I am also reading the metadata of the video to see if there is something weird going on. It only includes the width of the video, is that correct? Shouldn't it include height or aspect ratio?
My stream metadata:
bandwidth: "1.79769313486231e+308"
bufferfill: 0
qualitylevel: 0
screenwidth: 820
transitioning: "false"

Can I somehow force JWplayer to display the video as 16:9 ? Or is there something missing in my code?

A: Under:
file: "rtmp://mystreamhere",

Try to add:
stretching: "exactfit",


text:
Q: How to post messages to yammer private network I want to post messages to yammer in different network. For this I have wrote the below code ,
it's giving the server not found exception.
               rawtoken = Security.GetRawToken();

                //TODO
                //get list of Yammer tokens for this user
                WebClient wc = new System.Net.WebClient();
                wc.DownloadStringCompleted += wc_DownloadStringCompleted;
                wc.DownloadStringAsync(new Uri("https://www.yammer.com/api/v1/oauth/tokens.json?access_token=" + rawtoken));
 void wc_DownloadStringCompleted(object sender, System.Net.DownloadStringCompletedEventArgs e)
    {
        string tokens = e.Result;
        MessageBox.Show(tokens);
        List<Response> myDeserializedObjList = (List<Response>)Newtonsoft.Json.JsonConvert.DeserializeObject(tokens,typeof(List<Response>));
        List<Response> response = myDeserializedObjList.Where(item => item.network_id == "992371").ToList();
        accessToken = response[0].token;

        WebClient wc = new System.Net.WebClient();
       Uri uri = new Uri("https://www.yammer.com/api/v1/messages.json?access_token=" + accessToken);

        student ns = new student();
      //  wc.Headers["Authorization"] = "Bearer " + accessToken;  //use discoEN token here
        String data = "group-id=" + ns.group_id + "&body=" + ns.body;
        wc.UploadStringCompleted += new UploadStringCompletedEventHandler(wc_UploadStringCompleted);
        wc.Headers["Content-Type"] = "application/x-www-form-urlencoded";
        wc.Encoding = Encoding.UTF8;
        wc.UploadStringTaskAsync(uri, data);

    }

    private void wc_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
    {
        MessageBox.Show(e.Result);
    }

A: You should use the SDK for Windows Mobile rather than rolling your own code. It is available from the Yammer Developer site. Your code also passes the token on a URL parameter. This is no longer supported and you need to pass it on the authentication header.
A ServerNotFoundException highlights a connectivity problem. Perhaps you are not connected to the network, cannot route connections, or cannot resolve www.yammer.com via DNS.


text:
Q: Finder dragging hang / stuck Sometimes when dragging files from folder to another, or moving a folder, the items being dragged are stuck in the dragging mode and it hangs. I can see Finder use 30-35% CPU at that moment.
Anyone facing the same problem?
I'm on 10.7.2 also using FlexiGlass for Window moving/resizing.

A: *

*I would say restart you Mac if you have not done so in a while.

*Try repairing the disk and repairing permissions in Disk Utility.

*Next try deleting your Finder preferences. Your looking for a file called:
com.apple.finder.plist
Note you might want to back this file up before deleting, if you spent a lot of time configuring Finder view, etc and this turns out to not fix the issue.
This file will be located at /Users/YourUSERname/Library/Preferences/com.apple.finder.plist

*Restart and see if it happens anymore.

*Try installing Onyx and use it to reset Finder related settings.

*Try removing FlexiGlass if you suspect that is causing issues.

*Try logging in as another user and see if the issues comes up while logged in as another user.

*If all else fails, back up your stuff and reinstall Lion.

A: If this happens again, try restarting the Finder service by the following commands:
launchctl stop com.apple.Finder
launchctl start com.apple.Finder

A: TEMPORARY FIX
Ok, this is very a very odd & temporary fix but apparently put your mac to sleep and then wake it if you are having this finder hanging issue and it should resolve it. I thought I resolved the issue by deleting finder prefs but it came back a week later. Apparently there is a bug in lion that many other users are experiencing in 10.7.2 and 10.7.3. After waking from sleep I have noticed the issue is always gone, however it will not last across a reboot. Hopefully this is affecting enough users that it makes its way to apple engineers so they can correct it for the next point update.


text:
Q: inspecting a buffer through struct I am novice on the topic, I have unsinged char *buffer
I am trying to inspect it at 3 bytes at a time
I think maybe this can be solved with a 2 dimensional array.
so I tried this -
unsigned char *bytes[3] = {};
*bytes = buffer;

but I see that's a notation to create array of 3 elements of type unsigned char *
is there any way to achieve this without having to memcpy
any pointers are greatly appreciated.
this approach seems to work
typedef struct utf8 {
    unsigned char bytes[3];
};

typedef struct utf8 utf8x;

utf8x *xx = (utf8x *) buffer; //buffer is a return from fread (unsinged char *)

if (xx->bytes[0] == 0xe0) {
   printf("scratch");
}

however I am still trying to figure out how to compare all the bytes, I guess if I cast xx->bytes to return 3 bytes it should work.

A: You want to compare three bytes of a buffer at once.  You can do this using memcmp() (which a good compiler will optimize out so there is no actual function call).  For example:
utf8x *xx = (utf8x *) buff;

if (memcmp(&xx->bytes[0], "\100\50\10", 3) == 0) {
   printf("scratch");
}

That will print scratch if the first three bytes are \100 \50 \10.


text:
Q: Can I query Azure Active Directory (group membership, etc.) from Power BI? I have a service which logs API calls through AppInsights, which I've configured to log the Azure Active Directory (AAD) Service Principal GUID of the authenticated user calling the API. I'd like to use this GUID as a foreign key for lookup in AAD to see which security group the user is in, so I can break down API calls by team. I know this sort of query is possible through AAD's graph REST API, authenticated with an AAD app registration + password (with the Directory.Read.All scope). Is there any way to do this sort of query with Power BI and Power Query?
I know you can connect to on-prem Active Directory through Power BI but I'd rather not have to use a personal gateway.

A: Since you already are in power bi / query,
You could create a custom connector that connects to graph api to run your query,
I think that would directly answer your request?
see here for an example
https://learn.microsoft.com/en-us/power-query/samples/mygraph/readme
Regards,

A: I would take a step back and look at design. App Insights is not a conventional data store, the data that is collected is subject to sampling and there are retention policies associated with the telemetry data. Yes you can adjust the sampling settings and the retention policies but App Insights is not really designed for this purpose.
https://learn.microsoft.com/en-us/azure/azure-monitor/app/sampling
I would consider having your application log the principal GUID to a conventional data store like Cosmos DB.
You could then create an Azure function with a timer trigger and collect the information you need from the AAD Graph API into the same Cosmos database.
At that point all of your data is in one place and you can connect to to Cosmos DB from Power BI for reporting.


text:
Q: Change boxplot style I'm following this PGFPLOTS manual. At first I was enthusiastic with it. However I'm finding some difficulties on doing even basic things. Now I'm trying to change boxplot style.
Up to now I wrote this code:
\documentclass[11pt,a4paper,twoside,openright]{report}

\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{pgfplots.statistics}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{color}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{array}
\usepackage{verbatim}
\usepackage{epstopdf}

\usepackage{caption}
\usepackage{subcaption}
\usepackage{tcolorbox}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
ymode=log,
boxplot/draw direction=y,
xtick={1,2,3,4,5,6},
xticklabels={3, 4, 5, 6, 7, 8},
xlabel=number,
ylabel={time[s]},
boxplot/variable width,
boxplot/whisker range={1.57},
]
\addplot[boxplot,box extend=2]
table[row sep=\\,y index=0] {
data\\
0.090000 \\ 0.440000 \\ 0.120000 \\ 0.060000 \\ 0.320000 \\ 0.230000 \\ 0.440000 \\ 0.020000 \\ 0.150000 \\ 0.180000 \\ 0.000000 \\ 0.290000 \\ 0.000000 \\ 0.110000 \\ 0.260000 \\ 0.110000 \\ 0.000000 \\ 0.450000 \\ 0.040000 \\ 0.140000 \\ 0.030000 \\ 0.120000 \\ 0.140000 \\ 0.310000 \\ 0.060000 \\ 0.060000 \\ 0.110000 \\ 0.120000 \\ 0.120000 \\ 0.120000 \\ 0.130000 \\ 0.010000 \\ 0.400000 \\ 0.010000 \\ 0.030000 \\ 0.170000 \\ 0.000000 \\ 0.100000 \\ 0.150000 \\ 0.160000 \\ 0.060000 \\ 0.100000 \\ 0.010000 \\ 0.600000 \\ 0.260000 \\ 0.110000 \\ 0.150000 \\ 0.220000 \\ 0.140000 \\ 0.010000 \\
};
\addplot[boxplot,box extend=2]
table[row sep=\\,y index=0] {
data\\
0.070000 \\ 0.490000 \\ 0.340000 \\ 0.200000 \\ 0.020000 \\ 1.080000 \\ 6.830000 \\ 0.310000 \\ 0.540000 \\ 0.020000 \\ 0.290000 \\ 0.180000 \\ 0.600000 \\ 0.090000 \\ 0.610000 \\ 1.370000 \\ 0.260000 \\ 0.030000 \\ 2.300000 \\ 0.090000 \\ 3.150000 \\ 0.130000 \\ 0.290000 \\ 0.270000 \\ 1.300000 \\ 0.730000 \\ 0.630000 \\ 0.240000 \\ 10.030000 \\ 0.000000 \\ 0.260000 \\ 0.180000 \\ 3.290000 \\ 2.430000 \\ 1.940000 \\ 0.220000 \\ 0.230000 \\ 0.600000 \\ 1.690000 \\ 0.350000 \\ 3.960000 \\ 0.560000 \\ 9.900000 \\ 0.100000 \\ 0.430000 \\ 0.220000 \\ 0.260000 \\ 0.310000 \\ 0.290000 \\ 0.790000 \\
};
\addplot[boxplot,box extend=2]
table[row sep=\\,y index=0] {
data\\
12.700000 \\ 1.340000 \\ 0.680000 \\ 0.510000 \\ 1.770000 \\ 0.040000 \\ 3.790000 \\ 287.050000 \\ 1.350000 \\ 5.410000 \\ 15.560000 \\ 3.130000 \\ 0.910000 \\ 7.480000 \\ 2.400000 \\ 1.040000 \\ 3.530000 \\ 0.580000 \\ 31.710000 \\ 7.890000 \\ 4.900000 \\ 2.610000 \\ 0.890000 \\ 0.030000 \\ 3.780000 \\ 8.110000 \\ 4.820000 \\ 1.020000 \\ 5.570000 \\ 8.850000 \\ 0.150000 \\ 17.590000 \\ 0.210000 \\ 8.100000 \\ 2.150000 \\ 3.430000 \\ 6.440000 \\ 1.650000 \\ 6.830000 \\ 23.540000 \\ 0.520000 \\ 1.470000 \\ 0.750000 \\ 3.540000 \\ 3.590000 \\ 5.560000 \\ 0.330000 \\ 8.580000 \\ 1.900000 \\ 0.780000 \\
};
\addplot[boxplot,box extend=2]
table[row sep=\\,y index=0] {
data\\
55.720000 \\ 14.910000 \\ 14.950000 \\ 6.010000 \\ 6.530000 \\ 88.300000 \\ 281.500000 \\ 40.150000 \\ 13.410000 \\ 0.910000 \\ 1.650000 \\ 44.320000 \\ 13.410000 \\ 7.330000 \\ 3.510000 \\ 3.440000 \\ 70.400000 \\ 0.750000 \\ 58.200000 \\ 54.880000 \\ 26.450000 \\ 33.760000 \\ 0.700000 \\ 0.050000 \\ 0.290000 \\ 57.120000 \\ 14.300000 \\ 31.110000 \\ 18.560000 \\ 0.480000 \\ 21.330000 \\ 1.150000 \\ 2.220000 \\ 3.880000 \\ 1.780000 \\ 151.250000 \\ 7.770000 \\ 137.920000 \\ 0.500000 \\ 3.010000 \\ 1.990000 \\ 23.180000 \\ 119.590000 \\ 17.500000 \\ 15.870000 \\ 13.630000 \\ 21.850000 \\ 23.530000 \\ 68.720000 \\ 2.900000 \\
};
\addplot[boxplot,box extend=2]
table[row sep=\\,y index=0] {
data\\
1.190000 \\ 1.940000 \\ 13.400000 \\ 7.400000 \\ 267.300000 \\ 5.940000 \\ 11.050000 \\ 6.510000 \\ 2.940000 \\ 5.450000 \\ 5.240000 \\ 231.000000 \\ 4.480000 \\ 0.680000 \\ 311.290000 \\ 77.470000 \\ 621.200000 \\ 139.080000 \\ 1933.590000 \\ 2.520000 \\ 100.960000 \\ 11.020000 \\ 153.430000 \\ 26.670000 \\ 83.840000 \\ 4.310000 \\ 106.340000 \\ 15.900000 \\ 1118.590000 \\ 9.490000 \\ 131.480000 \\ 48.920000 \\ 5.850000 \\ 3.740000 \\ 1.050000 \\ 32.030000 \\ 5.690000 \\ 45.100000 \\ 12.430000 \\ 238.560000 \\ 28.750000 \\ 1.010000 \\ 119.290000 \\ 12.090000 \\ 31.180000 \\ 16.600000 \\ 29.670000 \\ 138.550000 \\ 17.420000 \\ 0.830000 \\
};
\addplot[boxplot,box extend=2]
table[row sep=\\,y index=0] {
data\\
2077.450000 \\ 762.100000 \\ 469.000000 \\ 143.600000 \\ 685.000000 \\ 3600.000000 \\ 20.200000 \\ 249.600000 \\ 269.000000 \\ 0.300000 \\ 0.200000 \\ 779.400000 \\ 1.800000 \\ 146.800000 \\ 1.300000 \\ 32.500000 \\ 137.000000 \\ 2016.400000 \\ 2.300000 \\ 33.900000 \\ 801.600000 \\ 2.200000 \\ 646.900000 \\ 3600.000000 \\ 1184.000000 \\ 627.000000 \\ 500.500000 \\ 238.300000 \\ 477.400000 \\ 3600.000000 \\ 17.800000 \\ 1726.800000 \\ 2.000000 \\ 316.700000 \\ 174.500000 \\ 2802.700000 \\ 335.300000 \\ 201.200000 \\ 1.100000 \\ 247.100000 \\ 2705.100000 \\ 156.900000 \\ 5.100000 \\ 2342.500000 \\ 3600.000000 \\ 3600.000000 \\ 72.700000 \\ 47.400000 \\ 301.200000 \\ 1.600000 \\
};
\end{axis}
\end{tikzpicture}
%\includegraphics[scale=.7]{mio.eps}
\end{document}

Now I want to change fill color, outliers' style (although for some problem they are not shown), median style and so on.
The manual writes:
Note that you should customize styles like boxplot/every box if you merely wish to change fill colors.

Being quite beginner I don't understand how to do it. For example at page 406 you can see squared outliers but I cannot see nothing in the code about it.  Could someone give me some hint or suggest some (possibly quick) tutorial about this?

A: Expanding my comment into an answer:
The OP's quoted passage from the manual tells us that the key boxplot/every box is used to change fill colors. The important thing is to recognize that this is a style and must be modified as such. I used boxplot/every box/.style={fill=gray!50} to modify the style for every box in the boxplot.
Simplified MWE:
(Extra styling/data removed for brevity.)
\documentclass{standalone}

\usepackage{pgfplots}
\usetikzlibrary{pgfplots.statistics}

\begin{document}
\begin{tikzpicture}
\begin{semilogyaxis}[
  boxplot/draw direction=y,
  boxplot/variable width,
  boxplot/every box/.style={fill=gray!50},
]
  \addplot[boxplot] table[row sep=\\,y index=0] {
    0.090000 \\
    0.440000 \\
    0.120000 \\
    0.060000 \\
    0.320000 \\
    0.230000 \\
    0.440000 \\
  };
\end{semilogyaxis}
\end{tikzpicture}
\end{document}

Output:


text:
Q: Implementing an interface in a base and derived class In C#, can you give a good example of why you would implement an interface on a base class and re-implement that interface on a derived class, rather than making the base class methods virtual.
For example:
interface IMakesNoise
{
  void Speak();
}

class Cat : IMakesNoise
{
  public void Speak()
  {
    Console.WriteLine("MEOW");
  }
}

class Lion : Cat, IMakesNoise
{
  public new void Speak()
  {
    Console.WriteLine("ROAR");
  }
}

To test the behavior:
Cat cat = new Cat();
Cat lion = new Lion();

// Non virtual calls, acts as expected
cat.Speak();
lion.Speak();

// Grabbing the interface out is 'virtual' in that it grabs the most derived interface implementation
(cat as IMakesNoise).Speak();
(lion as IMakesNoise).Speak();

This will print out:
MEOW
MEOW
MEOW
ROAR

UPDATE: For more clarification about the why, the reason is I am implementing a compiler and I want to know the reason that C# chose this implementation of interfaces.

A: I have looked at this question.
Interface inheritance in ComVisible classes in C#
and this
C# exposing to COM - interface inheritance
As I understand, if you have two objects and want them to be visible through COM, both should explicitly inherit from the required interface.

A: If Lion : Cat and Cat : IMakeNoise then by transitivity, Lion : IMakeNoise automatically - declaring it on Lion is thus redundant and unnecessary. This is because a Lion cannot be a Cat without inheriting all of Cats properties - including interfaces.
Virtual methods exist to allow you to not just override, but completely replace functionality within a derivation hierarchy. In other words, you can change the functionality of a less derived class from within a more derived class. This is different from shadowing in that shadowing overrides the functionality of a method for the given derived class only and not the entire class hierarchy.
Shadowing is accomplished by declaring the same non-virtual method which exists in the base class, while adding the new keyword to indicate that shadowing behaviour was intended.
Overriding is accomplished by declaring the same virtual method which exists in the base class, while adding the override keyword to indicate that overriding behaviour was intended.
A code sample will make these differences very clear. Let us define a base Vehicle class (as abstract so that it cannot be instantiated) and a deriving Motorcycle class. Both will output information to the Console about the number of wheels that they have:
/// <summary>
/// Represents a Vehicle.
/// </summary>
public abstract class Vehicle
{
    /// <summary>
    /// Prints the Number of Wheels to the Console.
    /// Virtual so can be changed by more derived types.
    /// </summary>
    public virtual void VirtualPrintNumberOfWheels()
    {
        Console.WriteLine("Number of Wheels: 4");
    }

    /// <summary>
    /// Prints the Number of Wheels to the Console.
    /// </summary>
    public void ShadowPrintNumberOfWheels()
    {
        Console.WriteLine("Number of Wheels: 4");
    }
}

/// <summary>
/// Represents a Motorcycle.
/// </summary>
public class Motorcycle : Vehicle
{
    /// <summary>
    /// Prints the Number of Wheels to the Console.
    /// Overrides base method.
    /// </summary>
    public override void VirtualPrintNumberOfWheels()
    {
        Console.WriteLine("Number of Wheels: 2");
    }

    /// <summary>
    /// Prints the Number of Wheels to the Console.
    /// Shadows base method.
    /// </summary>
    public new void ShadowPrintNumberOfWheels()
    {
        Console.WriteLine("Number of Wheels: 2");
    }
}

Above we've defined two classes: an abstract base Vehicle class which has a virtual and non-virtual method which both do the same thing, and a Motorcycle class which implements the Vehicle class while overriding the virtual method and shadowing the normal method. Now we will call the methods with different Type signatures to see the differences:
static void Main(string[] args)
{
    // Instantiate a Motorcycle as type Motorcycle
    Motorcycle vehicle = new Motorcycle();

    vehicle.ShadowPrintNumberOfWheels();
    vehicle.VirtualPrintNumberOfWheels();

    // Instantiate a Motorcycle as type Vehicle
    Vehicle otherVehicle = new Motorcycle();

    // Calling Shadow on Motorcycle as Type Vehicle
    otherVehicle.ShadowPrintNumberOfWheels();
    otherVehicle.VirtualPrintNumberOfWheels();

    Console.ReadKey();
}

The results:
Number of Wheels: 2
Number of Wheels: 2
Number of Wheels: 4
Number of Wheels: 2

A: There are a couple of issues I have with the code sample above, but I'll set most of them aside and focus on the most significant: It's violating the tenet of programming to an interface, not an implementation. If you change your declaration of the cat and lion instances to the following, the problem you're seeing goes away.
IMakesNoise cat = new Cat();
IMakesNoise lion = new Lion();

In that case, your output is the expected MEOW, ROAR, MEOW, ROAR. See fiddle here.
Programming to interfaces also frees you to embrace inversion of control/dependency injection much more easily.


text:
Q: If matched then print all using awk I have a file which contains many sub-sections each starting with [begin] and ending with [end]:
[begin li1_1378184738754_91]
header=7075|lime|0|0|109582|0|1|2700073||0|0|0|[355]|1|0|ssb-li1-1378184738754-90||0||LIME |0|saved=true|0.002406508312038836|0|[ser=zu1:mtu=model_other_20120806calibex.csv:mu=model_other_20120806calibex.csv:scorerClassUsed=LinearPersonalizedProductSearchScorer][ser=uzu6:mtu=model_other_20120806calibex.csv:mu=model_other_20120806calibex.csv:scorerClassUsed=LinearPersonalizedProductSearchScorer][ser=xzs5:mtu=model_other_20120806calibex.csv:mu=model_other_20120806calibex.csv:scorerClassUsed=LinearPersonalizedProductSearchScorer][ser=sv-stda-zu3:mtu=model_other_20120806calibex.csv:mu=model_other_20120806calibex.csv:scorerClassUsed=LinearPersonalizedProductSearchScorer][ser=hzu8:mtu=model_other_20120806calibex.csv:mu=model_other_20120806calibex.csv:scorerClassUsed=LinearPersonalizedProductSearchScorer][ser=lzu3:mtu=model_other_20120806calibex.csv:mu=model_other_20120806calibex.csv:scorerClassUsed=LinearPersonalizedProductSearchScorer][ser=yzu2:mtu=model_other_20120806calibex.csv:mu=model_other_20120806calibex.csv:scorerClassUsed=LinearPersonalizedProductSearchScorer][ser=xzu7:mtu=model_other_20120806calibex.csv:mu=model_other_20120806calibex.csv:scorerClassUsed=LinearPersonalizedProductSearchScorer]|0|null|false|40||false|
attrs=0|0|0||0|
ptitle=690751404|1|1|1|Rest:1998636||||||2700401|175619|900.5636134725806|0.985486|39.166666666666664|$9.99|100.0|1|||
seller=1998636|1|9.99|1|-1||0|||||true||4.7937584|10412|false|
ptitle=5543369186|2|1|1|Rest:1533891||||||2700211|19615|886.8211044369053|0.776121|34.0|$119.99|100.0|1|||
seller=1533891|1|119.99|3|-1|1.0:text,In+size+6.0%2C7.0%2C8.0%2C8.5%2C9.0%2C9.5%2C10.0%2C...,0.0,,,,0,0,|2|||||true||2.95|20|true|
ptitle=622529158|3|1|1|||||||2700408|67402|796.5289827432475|0.893899|63.0|$5.27|100.0|1|||
seller=4281413|1|5.27|1|-1||0|||||true||4.695052|1769|true|
ptitle=5507199621|4|1|1|||||||2700220|56412|706.9031281251306|0.791171|45.0|$99.99|100.0|1|||
seller=4806107|1|-1.0|1|-1|1.0:sale,$,30.000000000000014,0.0,,,,0,0,:text,In+size+6.0%2C6.5%2C7.0%2C7.5%2C8.0%2C8.5%2C9.0%2C9...,0.0,,,,0,0,|2||||$130 $30.00 off|false||5.0|1|false|
ptitle=5502728013|5|1|1|||||||900000|0|698.7772340643119|0.836740|75.0|$40.95|100.0|1|||
seller=955448|1|40.95|1|-1||0|||||false||4.142857|7|false|
ptitle=840662011|6|1|1|Rest:265238||||||300233|62718|683.2927820751431|0.995513|52.0|$22.95|100.0|1|||
seller=265238|1|22.95|1|-1||0|||||false||4.478261|23|false|
ptitle=848084980|8|1|1|||||||2700073|145653|670.4809846773688|0.880587|60.0|$24.99|100.0|1|||
seller=5267046|1|24.99|1|-1||0|||||true||0.0|0|false|
ptitle=891200492|9|1|1|Rest:1030132||||||2701003|17215|668.8437575254773|0.825491|32.0|$519.99|100.0|1|||
seller=1030132|1|519.99|1|-1||0|||||false||4.7391305|23|false|
ptitle=641974054|10|1|1|||||||900000|69433|667.6678790058678|0.752129|57.0|$4.19|100.0|1|||
seller=3365158|1|4.19|1|-1||0|||||true||4.70907|4410|true|
ptitle=517591869|12|1|1|Rest:4802895||||||2700408|127644|643.0972570735605|0.893899|17.25|$23.95|100.0|1|||
seller=4318776|1|-1.0|3|-1||0|||||false||0.0|0|false|
ptitle=541549480|13|1|1|Rest:1180414||||||2702000|105832|597.4904572011968|0.752129|24.666666666666664|$8.27|100.0|1|||
seller=4636561|1|8.27|1|-1||0|||||false||4.8283377|734|true|
ptitle=1020561900|14|1|1|||||||2700063|159813|594.4717491579845|0.934869|75.0|$5.39|100.0|1|||
seller=4722645|1|5.39|1|-1|1.0:sale,$,0.6000000000000005,0.0,,,,0,0,:text,Free+Shipping+on+All+Orders%21,0.0,201301010000/,,,0,0,|2||||$5.99 $0.60 off|true||4.3942246|1593|true|
ptitle=507792308|15|1|1|Rest:4683455||||||2702000|105832|591.7739184402442|0.768311|22.5|$9.48|100.0|1|||
seller=4910651|1|-1.0|2|-1||0|||||false||5.0|1|false|
ptitle=1090571346|16|1|1|Rest:4452919||||||2700211|20824|776.4814913363535|0.776121|35.0|$59.99|100.0|1|||
seller=1533891|1|59.99|1|-1|1.0:sale,$,49.99999999999999,0.0,,,,0,0,:text,In+size+7.5%2C8.0%2C8.5%2C9.0%2C9.5%2C10.0%2C10.5...,0.0,,,,0,0,|2||||$110 $50.00 off|true||2.95|20|true|
ptitle=573017390|17|1|1|||||||2700073|91937|679.695660577044|0.880587|33.5|$14.85|100.0|1|||
seller=4281413|1|14.85|1|-1||0|||||true||4.695052|1769|true|
ptitle=5502723300|18|1|1|||||||900000|0|639.3095640940136|0.836740|75.0|$50.95|100.0|1|||
seller=955448|1|50.95|1|-1||0|||||false||4.142857|7|false|
ptitle=940022974|20|1|1|||||||2700600|58701|569.9503499778303|0.875839|59.0|$14.40|100.0|1|||
seller=4825227|1|14.4|1|12||0|||||true||4.0289855|276|true|
ptitle=5513277553|21|1|1|||||||2700220|56412|565.2712749001105|0.776121|44.33333333333333|$129.95|100.0|1|||
seller=4825252|1|129.95|1|23||0|||||true||4.0289855|276|true|
ptitle=890329961|22|1|1|||||||2700408|133796|564.7642425785796|0.837916|34.75|$61.95|100.0|1|||
seller=4825235|1|61.95|4|19||0|||||true||4.0289855|276|true|
ptitle=753852910|24|1|1|||||||2700073|146738|557.7419123688652|0.934869|47.69230769230769|$26.99|100.0|1|||
seller=4722645|1|26.99|10|-1|1.0:sale,$,3.0,0.0,,,,0,0,:text,Free+Shipping+on+All+Orders%21,0.0,201301010000/,,,0,0,|2||||$29.99 $3.00 off|true||4.3942246|1593|true|
ptitle=654738989|26|1|1|||||||900000|84012|554.7756559595525|0.752129|57.0|$3.19|100.0|1|||
seller=3365158|1|3.19|1|-1||0|||||true||4.70907|4410|true|
ptitle=707747307|27|1|1|Rest:4736009||||||2700063|76249|552.234395428327|0.889614|19.857142857142854|$6.39|100.0|1|||
seller=4736009|1|6.39|1|-1||0|||||false||4.8071113|15356|true|
ptitle=63531001|28|1|1|||||||2700408|82712|625.0421885589608|0.893899|47.166666666666664|$7.69|100.0|1|||
seller=4281413|1|7.69|3|-1||0|||||true||4.695052|1769|true|
ptitle=5502728016|29|1|1|||||||900000|0|605.9895507237038|0.836740|75.0|$503.00|100.0|1|||
seller=955448|1|503.0|1|-1||0|||||false||4.142857|7|false|
ptitle=507792308|31|1|1|Rest:4683455||||||2702000|105832|559.6902659046442|0.752129|22.5|$8.99|100.0|1|||
seller=5105812|1|-1.0|1|-1||0|||||false||0.0|0|false|
ptitle=753852910|32|1|1|||||||2700073|146738|545.9987095658629|0.870929|47.69230769230769|$22.49|100.0|1|||
seller=4143386|1|22.49|6|-1|1.0:sale,$,7.5,0.0,,,,0,0,:text,Free+Shipping+on+Orders+Over+%24100,0.0,201109010000/201409302359,,,0,0,|2||||$29.99 $7.50 off|false||4.7316346|2355|true|
ptitle=5513277553|33|1|1|Rest:1533891||||||2700220|56412|653.3133907916089|0.825491|44.33333333333333|$149.99|100.0|1|||
seller=1533891|1|149.99|3|-1|1.0:text,In+size+5.0%2C5.5%2C6.0%2C6.5%2C7.0%2C7.5%2C8.0%2C8...,0.0,,,,0,0,|2|||||true||2.95|20|true|
ptitle=63531001|34|1|1|||||||2700408|82712|541.8233547780552|0.893899|47.166666666666664|$7.72|100.0|1|||
seller=2370155|1|7.72|4|-1||0|||||false||4.85|40|false|
ptitle=1018957017|35|1|1|||||||2700073|145653|540.6093714604533|0.860614|56.0|$25.95|100.0|1|||
seller=5036683|1|25.95|1|-1||0|||||false||4.8405056|366|false|
ptitle=743682867|36|1|1|||||||2700073|63437|539.5985846455641|0.870929|58.0|$46.99|100.0|1|||
seller=193176|1|46.99|1|-1||0|||||true||4.8511987|1418|true|
ptitle=679858288|37|1|1|||||||2700063|188669|535.1360632897284|0.902031|30.0|$12.41|100.0|1|||
seller=4143386|1|12.41|2|-1|1.0:sale,$,1.379999999999999,0.0,,,,0,0,:text,Free+Shipping+on+Orders+Over+%24100,0.0,201109010000/201409302359,,,0,0,|2||||$13.79 $1.38 off|false||4.7316346|2355|true|
ptitle=994328713|38|1|1|||||||2700073|71463|534.7715925279717|0.870929|58.0|$1.29|100.0|1|||
seller=1787388|1|1.29|1|-1||0|||||false||4.680464|3624|false|
ptitle=886915818|40|1|1|||||||2700444|201835|529.7519801432289|0.934869|65.5|$44.99|100.0|1|||
seller=4561883|1|44.99|2|-1||0|||||true||4.7913384|508|false|
seller_hidden=227502|990765963|1147436601|-1
seller_hidden=5310958|622529158|5645627277|-1
seller_hidden=4825254|5543369186|5651114316|23
seller_hidden=5289138|5548930281|5653769481|-1
[end li1_1378184738754_91]

I am trying to run the command cat /home/nextag/logs/OutpdirImpressions.log.2013-09-02 | awk -F "$begin" '{print $0}' | awk '$0 ~ "header=7075" {print $0}'
As per this command i want to split the entire file into sub-sections beginning with the word 'begin'. Now in that i want those sub-sections which contains 'header=7075'
Expected output is that it will print the entire sub-section(those which contain that string), but i am getting only this portion as output:

header=7075|lime|0|0|109582|0|1|2700073||0|0|0|[355]|1|0|ssb-li1-1378184738754-90||0||LIME
  |0|saved=true|0.002406508312038836|0|[ser=zu1:mtu=model_other_20120806calibex.csv:mu=model_other_20120806calibex.csv:scorerClassUsed=LinearPersonalizedProductSearchScorer][ser=uzu6:mtu=model_other_20120806calibex.csv:mu=model_other_20120806calibex.csv:scorerClassUsed=LinearPersonalizedProductSearchScorer][ser=xzs5:mtu=model_other_20120806calibex.csv:mu=model_other_20120806calibex.csv:scorerClassUsed=LinearPersonalizedProductSearchScorer][ser=sv-stda-zu3:mtu=model_other_20120806calibex.csv:mu=model_other_20120806calibex.csv:scorerClassUsed=LinearPersonalizedProductSearchScorer][ser=hzu8:mtu=model_other_20120806calibex.csv:mu=model_other_20120806calibex.csv:scorerClassUsed=LinearPersonalizedProductSearchScorer][ser=lzu3:mtu=model_other_20120806calibex.csv:mu=model_other_20120806calibex.csv:scorerClassUsed=LinearPersonalizedProductSearchScorer][ser=yzu2:mtu=model_other_20120806calibex.csv:mu=model_other_20120806calibex.csv:scorerClassUsed=LinearPersonalizedProductSearchScorer][ser=xzu7:mtu=model_other_20120806calibex.csv:mu=model_other_20120806calibex.csv:scorerClassUsed=LinearPersonalizedProductSearchScorer]|0|null|false|40||false|

I have tried using if in various ways, but it doesn't works. Can somebody please help me.
I tried awk -F "$begin" '{if($0 ~ "header=7075") {print $0}}' /home/nextag/logs/OutpdirImpressions.log.2013-09-02. It gave the same result
Can somebody please suggest that how do i get the complete sub-section in the result

A: Try this awk one-liner:
awk '$1=="[end"{p=0}/^header=7075/{p=1}p' file

In parts:

*

*$1=="[end"{p=0} if you reach a line, with the first word "[end", then set the flag to zero

*/^header=7075/{p=1} If you reach a line, which begins with "header=7075", set set the flag to one

*p if the flag is non-zero, print the current line (equivalent to p{print} or p{print $0} or p!=0{print $0}


text:
Q: MDX calculation with children and parents (contribution to total) I got a cube with cadastral information of some neighborhoods of a city. One of the measures is 'cadastral value': the value of the land of a neighborhood.
Now, the city is divided into districts and a district, into neighborhoods (hierarchy with two levels).
The question is: I need to calculate the percentage that the value of each neighborhood represents compared with the parent (the district) and with the total (city), and also the same about the district compared with the city.
How can I do it?
I tried:
WITH MEMBER
[Measures].[Percentage] AS
  ([Nbh].[Nbh].[Nbh],[Measures].[Cad value].CurrentMember
   /[Nbh].[Nbh].[Nbh],[Measures].[Cad value].CurrentMember.Parent)

SELECT
 {[Measures].[Percentage]} ON 0,
 [Nbh].[Nbh].[Nbh].AllMembers ON 1
FROM Cadastre

Where the dimensions are:
Nbh : Neighborhood
Cad value: Cadastral value
What I get is "error" in every result value, and the explanation is "Current member () : argument (0) type mismatch: expected:'level|hierarchy|dimension', got:'measure'"
What am I doing wrong?

A: Try the following:
WITH MEMBER [Measures].[Parent %] AS
   IIF(
    [Nbh].[Nbh].CURRENTMEMBER IS [Nbh].[Nbh].[All]
    ,1
    ,[Measures].[Cad value] /
     (
      [Measures].[Cad value],
      [Nbh].[Nbh].CurrentMember.Parent
     )
   ), FORMAT_STRING = 'Percent'
SELECT
 {[Measures].[Parent %]} ON 0,
 [Nbh].[Nbh].[Nbh].AllMembers ON 1
FROM Cadastre;

Including the IIF is a defensive measure. If you switch to showing AllMembers of the complete hierarchy then the All member will be included. Here is an example using AdvWrks:
WITH
  MEMBER [Measures].[Parent %] AS
    IIF
    (
        [Product].[Subcategory].CurrentMember
      IS
        [Product].[Subcategory].[All Products]
     ,1
     ,
        [Measures].[Internet Sales Amount]
      /
        (
          [Measures].[Internet Sales Amount]
         ,[Product].[Subcategory].CurrentMember.Parent
        )
    )
   ,FORMAT_STRING = 'Percent'
SELECT
  NON EMPTY
    {[Measures].[Parent %]} ON 0
 ,NON EMPTY
    [Product].[Subcategory].ALLMEMBERS ON 1
FROM [Adventure Works];

The above returns the following:

Without the IIF the expression is the following:
WITH
  MEMBER [Measures].[Parent %] AS
      [Measures].[Internet Sales Amount]
    /
      (
        [Measures].[Internet Sales Amount]
       ,[Product].[Subcategory].CurrentMember.Parent
      )
   ,FORMAT_STRING = 'Percent'
SELECT
  NON EMPTY
    {[Measures].[Parent %]} ON 0
 ,NON EMPTY
    [Product].[Subcategory].ALLMEMBERS ON 1
FROM [Adventure Works];

We get the following because of lack of foresight:

A:
WITH MEMBER     [Measures].[Percentage] AS
  ([Nbh].[Nbh].[Nbh],[Measures].[Cad value].CurrentMember
       /[Nbh].[Nbh].[Nbh],[Measures].[Cad value].CurrentMember.Parent)

There are two problems with this:
One, you are using a static set to compute the value of calculated member namely:
[Nbh].[Nbh].[Nbh]
This is NOT [Nbh].[Nbh].CURRENTMEMBER
Second and the bigger mistake: Using the currentmember on a measure. You can't do that. You can use Measures.CURRENTMEMBER but that's about it. It's best used on hierarchies which are used on axes.
That said, your approach is almost legit. You need to fetch the measure value for the parent.
This should work:
WITH MEMBER
[Measures].[Percentage] AS
DIVIDE
        (
        [Measures].[Cad value],
        ([Nbh].[Nbh].CURRENTMEMBER.PARENT,[Measures].[Cad value]) //Cad value for parent
        )

SELECT
 {[Measures].[Percentage]} ON 0,
 [Nbh].[Nbh].[Nbh].AllMembers ON 1
FROM Cadastre

A: The error is certainly because of this statement is incorrect:
WITH MEMBER
[Measures].[Percentage]
AS ([Nbh].[Nbh].[Nbh],[Measures].[Cad value].CurrentMember/[Nbh].[Nbh].[Nbh],[Measures].[Cad value].CurrentMember.Parent)

Try to make it like this
WITH MEMBER
[Measures].[Percentage]
AS ([Nbh].[Nbh].[Nbh],[Measures].[Cad value])/([Nbh].[Nbh].[Nbh],[Measures].[Cad value])


text:
Q: AppServ phpmyadmin #2002 - No connection could be made because the target machine actively refused it estoy teniendo problemas para acceder a mysql a través de phpmyadmin. Nunca había tenido problemas, pero de la nada cuando intento conectarme me salta el siguiente error:
#2002 - No connection could be made because the target machine actively refused it. <br />El servidor no está respondiendo (o el zócalo local al servidor MySQL no está configurado correctamente).

Foto:

Debajo me aparece esto:

Alguien tiene alguna idea de como solucionar este problema? Porque anduve buscando y las soluciones que encontré como borrar el ib_logfile0 y ib_logfile1, o cambiar el puerto 3306 por algún otro no dieron resultado.

A: Como explica en una respuesta de este foro, la manera de solucionarlo es:

*

*En la carpeta de phpmyadmin (/etc/phpmyadmin en Linux por ejemplo), si se tiene el archivo config.inc.php seguir al siguiente paso, si no, buscar el archivo config.sample.inc.php y renombralo por config.inc.php

*Abrir ese archivo y en la linea 30 que dice:

$cfg['Servers'][$i]['auth_type'] = 'cookie';
Cambiarlo por:
$cfg['Servers'][$i]['auth_type'] = 'http';
Al entrar otra vez te pide el login y password, si no lo has modificado el login es root y el password lo dejas en blanco


text:
Q: Is it possible to add a pseudo after selector to the placeholder of an input I'm trying to add a font-awesome icon to the end of a placeholder text, I know that this method works, but it lead me to wonder whether adding Font awesome content code via the css will work.
Is something like this possible:
input::-webkit-input-placeholder::after

A: input::-webkit-input-placeholder::after is not valid, because input does not have inner content - there is no :before and :after.
You can't select pseudo-element of pseudo-element. So input:placeholder:after will select :after of input


text:
Q: htaccess redirect all asset URLs except starting with specific strings Let's say the project structure is like this:
/
/public/assets/css/<css files go here>
/public/assets/js/<js files go here>
/public/assets/img/<image files go here>
/storage/assets/css/<css files go here>
/storage/assets/js/<js files go here>
/storage/assets/img/<image files go here>
/resources/assets/css/<css files go here>
/resources/assets/js/<js files go here>
/resources/assets/img/<image files go here>

I would like to redirect all css and js asset requests to /public/ except the requests which start with resources or storage
for example this request: /assets/css/style.css has to be redirected to: /public/assets/css/style.cc
But, /storage/assets/css/style.cc has to stay as it is.
What I am trying is something like this:
RewriteRule ^![storage|resources](.*\.css)$ /public/$1  [L,R=302]
RewriteRule ^![storage|resources](.*\.js)$ /public/$1  [L,R=302]

I know I am missing something in regex.
Does anyone know how to correct it?
Thank you in advance

A: You are on the right track, very close to a solution but you have to apply your condition inside a RewriteCond:
RewriteCond %{REQUEST_URI} !^/?(storage|resources|public)
RewriteRule .*\.(css|js)$ /public/$0  [L,R=302]

Otherwise you can go with a one-liner RewriteRule which uses a negative lookahead to apply redirection rule:
RewriteRule ^(?!storage|resources|public).*\.(css|js)$ /public/$0  [L,R=302]


text:
Q: Ionic 2: Beta 8 - scrollable content area cutting off button at bottom Q) Anyone know why my button is suddenly being cut off in the latest Ionic 2 Beta 8?
Note: When I comment out the ion-toolbar at the top, the button is then fully visible

You can see that the button is partially visible on iOS but not at all on Android.
Here's my straightforward template HTML:
<ion-toolbar header-bg-buildings>
  <ion-title>{{_I8nService.titles.addBuilding}}</ion-title>
  <ion-buttons start>
    <button (click)="cancel()">
      {{_I8nService.labels.cancel}}
      <ion-icon name="md-close" showWhen="android,windows"></ion-icon>
    </button>
  </ion-buttons>
</ion-toolbar>

<ion-toolbar danger *ngIf="showNoConnectionBar">
  <ion-title>{{_I8nService.titles.noConnection}}</ion-title>
</ion-toolbar>

<ion-content class="addBuilding">
  ....
  <ion-item-group>
    <ion-item-divider light>{{_I8nService.labels.signed}}:</ion-item-divider>
    <ion-row>
      <ion-card class="signed-card">
        <ion-card-content>

        </ion-card-content>
      </ion-card>
    </ion-row>
  </ion-item-group>

      <button class="submit-button" full complete (click)="createBuilding()">{{_I8nService.labels.createBuilding}}</button>

</ion-content>

A: Maybe this makes no sense, but what happens if you replace that div

    <button full complete>Submit</button>

for a
<ion-toolbar position="bottom">
    <button full complete>Submit</button>
</ion-toolbar>

After all Ionic doc says that

A Toolbar is a generic bar that is positioned above or below content

And maybe that could force the content to include the button avoiding the issue. Remember to put that new toolbar inside the ion-content. Tested on your plunker and works but honestly can not tell if it's going to work in your project.
The code would look like this:
<ion-toolbar>
  <ion-title>Page 1</ion-title>
  <ion-buttons start>
    <button>
      cancel
      <ion-icon name="md-close" showWhen="android,windows"></ion-icon>
    </button>
  </ion-buttons>
</ion-toolbar>

<ion-content>

  <ion-item-group>
    <ion-item-divider light>Some group:</ion-item-divider>
    <ion-row>
      <ion-item>
        <ion-label stacked>field 1:</ion-label>
        <ion-input></ion-input>
      </ion-item>
    </ion-row>
    <ion-row>
      <ion-item>
        <ion-label stacked>field 2:</ion-label>
        <ion-input></ion-input>
      </ion-item>
    </ion-row>
  </ion-item-group>

  <ion-item-group>
    <ion-item-divider light>Some group:</ion-item-divider>
    <ion-row>
      <ion-item>
        <ion-label stacked>field 1:</ion-label>
        <ion-input></ion-input>
      </ion-item>
    </ion-row>
    <ion-row>
      <ion-item>
        <ion-label stacked>field 2:</ion-label>
        <ion-input></ion-input>
      </ion-item>
    </ion-row>
  </ion-item-group>

  <ion-item-group>
    <ion-item-divider light>Some group:</ion-item-divider>
    <ion-row>
      <ion-item>
        <ion-label stacked>field 1:</ion-label>
        <ion-input></ion-input>
      </ion-item>
    </ion-row>
    <ion-row>
      <ion-item>
        <ion-label stacked>field 2:</ion-label>
        <ion-input></ion-input>
      </ion-item>
    </ion-row>
  </ion-item-group>

  <ion-item-group>
    <ion-item-divider light>Some group:</ion-item-divider>
    <ion-row>
      <ion-item>
        <ion-label stacked>field 1:</ion-label>
        <ion-input></ion-input>
      </ion-item>
    </ion-row>
    <ion-row>
      <ion-item>
        <ion-label stacked>field 2:</ion-label>
        <ion-input></ion-input>
      </ion-item>
    </ion-row>
  </ion-item-group>

  <ion-item-group>
    <ion-item-divider light>Some group:</ion-item-divider>
    <ion-row>
      <ion-item>
        <ion-label stacked>field 1:</ion-label>
        <ion-input></ion-input>
      </ion-item>
    </ion-row>
    <ion-row>
      <ion-item>
        <ion-label stacked>field 2:</ion-label>
        <ion-input></ion-input>
      </ion-item>
    </ion-row>
  </ion-item-group>

  <ion-toolbar position="bottom">
    <button full complete>Submit</button>
  </ion-toolbar>
</ion-content>


text:
Q: String padding for a text template I'm creating a PDF file from a txt-template with tcpdf ([Example 8][1]). The txt-template looks like this:
SALUTATION
FIRSTNAME LASTNAME
STREET                     CURRENTDATE
SOMEMOREINFORMATION                           MYWEBSITE

I replace those markers with the correct value. So that it would look like this:
Mr.
John Doe
Downingstreet 10           14th May, 2010
john@doe.com                                  www.stackoverflow.com

In this example, when I replace the values, the indention of the date is dependent on the length of the street name (which I don't want). I could solve this issue with str_pad but the problem is, I normally use three columns and there are lines which only have content in col1 and col3 as in the last line. How can I solve that problem? Is there something like the "overwrite" function in Word, that when you write, the text just gets overwritten?
Thanks in advance.

A: Count street's string length and then add/remove left padding of date.

A: You can use sprintf, e.g.
function something($street, $currentDate, $foo) {
  $s = sprintf('%-20s    %-18s    %s',
    $street,
    $currentDate,
    $foo
  );
  return $s;
}

echo something('streetA', '14th May, 2010', 'lalala'), "\n";
echo something('Downingstreet 10', '14th May, 2010', 'lalala'), "\n";
echo something('abcdefghijklmnopqrstuvwxyz 10', '14th May, 2010', 'lalala'), "\n";

prints
streetA                 14th May, 2010        lalala
Downingstreet 10        14th May, 2010        lalala
abcdefghijklmnopqrstuvwxyz 10    14th May, 2010        lalala

(as you can see from the third line the width specification is the minimum length, so you might have to use something like substr())

A: I presume you are just str_replace()'ing the placeholders with their values?
$streetPlaceHolder = 'STREET                     ';
$streetReplacement = str_pad('Downingstreet 10', strlen($streetPlaceHolder));
$template = str_replace($streetPlaceHolder, $streetReplacement, $template);

Presumably you will run into the same problem with SOMEMOREINFORMATION. This same solution can be used.
I realize you said str_pad was not an ideal solution for you. However, I do not understand why, even if you extend this to three columns. You can still get by with this method.


text:
Q: Overflow-x:hidden not working in Chrome I've applied this property to the elements: body and html and still Chrome will let me scroll on the x-axis.
I've tested it in Safari and Firefox and the x-axis scrolling is disabled...
Anyone know what I'm missing?
N.B. Using overflow: hidden works but I'd like people to be able to scroll on the y-axis.
Thanks!

A: You can use
html { overflow-x: hidden; }

A: I just encountered this issue when trying to hide some images that I /knew/ would be wider than the body on mobile.
Originally I simply had:
body { overflow-x: hidden; }
This didn't work in Chrome, but it did in IE 10.
However, if you then also added:
html { overflow-x: hidden; }
The images were correctly hidden in both browsers.

A: It appears the problem no longer exists thanks to @Nelson pointing this out.
You can see the code working correctly here: http://jsfiddle.net/H84pr


text:
Q: Reverse order of boost::dynamic_bitset Is there a clean way to return the reverse ordering of a boost::dynamic_bitset object?
For example:
01001100
becomes
00110010.
The simplest solution I can think of is to convert the bitset to a string, reverse the string and convert it back to a bitset, but this seems a rather slow method that nullifies the speed of bitstring operations.
Thank you in advance!

A: boost::dynamic_bitset doesn't have iterators, so a long range of comfy STL solutions like, off the top of my head, std::reverse or std::swap or their boost counterparts are not available, I reckon that a good way would be to make your own trivial reverse method:
#include <iostream>
#include <boost/dynamic_bitset.hpp>

void reverse(boost::dynamic_bitset<> &bs)
{
    for (size_t begin = 0, end = bs.size() - 1; begin < end; begin++, end--)
    {
        bool b = bs[end];
        bs[end] = bs[begin];
        bs[begin] = b;
    }
}

int main()
{
    size_t size = 8;
    boost::dynamic_bitset<> bs(size, 50);

    std::cout << "Normal:  " << bs << std::endl;
    reverse(bs);
    std::cout << "Reverse: " << bs << std::endl;
}

Output:
Normal:  00110010
Reverse: 01001100

Live demo

A: You can do better with the very fortunate
 #define BOOST_DYNAMIC_BITSET_DONT_USE_FRIENDS

which I noticed first because it's used in other third-party libraries (I forget the name, but it was AI/ML related).
I had a version here that wasn't very generic because it used size-specific bit twiddling hacks (to reverse e.g. byte or uint32). You might be interested in those:

*

*see http://aggregate.org/MAGIC/#Bit%20Reversal

*or https://graphics.stanford.edu/~seander/bithacks.html#ReverseParallel
You can still see the uint32-dedicated version  Live On Compiler Explorer.
Generic Version
Since then I spotted this nice answer: In C/C++ what's the simplest way to reverse the order of bits in a byte? and it gave a reasonably efficient in-place reverse algorithm for power-of-2 width integral types. So, now we have the completely generic:
// make sure it's globally defined
#define BOOST_DYNAMIC_BITSET_DONT_USE_FRIENDS
#include <boost/dynamic_bitset.hpp>
#include <iostream>

template <typename Block, typename Allocator>
void reverse(boost::dynamic_bitset<Block, Allocator>& bs) {
    auto constexpr BLOCK_BIT = sizeof(Block) * CHAR_BIT;
    auto original_size       = bs.size();

    if (auto partial_block = bs.size() % BLOCK_BIT) {
        auto pad = (BLOCK_BIT - partial_block);
        bs.resize(bs.size() + pad);
        bs <<= pad;
    }

    // see https://stackoverflow.com/a/61109975/85371
    auto inplace = [](Block& n) {
        static_assert(std::is_unsigned_v<Block>);

        short bits = sizeof(n) * 8;
        Block mask = ~Block(0); // equivalent to uint32_t mask =
                                // 0b11111111111111111111111111111111;

        while (bits >>= 1) {
            mask ^= mask << (bits); // will convert mask to
                                    // 0b00000000000000001111111111111111;
            n = (n & ~mask) >> bits | (n & mask) << bits; // divide and conquer
        }
    };

    for (auto& b : bs.m_bits) {
        inplace(b);
    }
    std::reverse(begin(bs.m_bits), end(bs.m_bits));

    bs.resize(original_size);
}

NOTE the reversal will MUCH more efficient for size() multiples of BLOCK_BIT. This might in some scenario even lead one to prefer Block = std::uint8_t.

Generic Tester/Benchmark
Let's write some randomized tests. For ease of implementation we compare the reversed string representation to the string representation of the reverse.
I added tests for varying block sizes and statistics on the sizes and times:
Live On Compiler Explorer
// For quick testing
#include <random>
#include <chrono>
#include <boost/range/algorithm/reverse.hpp>
#include <boost/lexical_cast.hpp>
static auto now = std::chrono::high_resolution_clock::now;
using namespace std::chrono_literals;
#include <boost/accumulators/accumulators.hpp>
#include <boost/accumulators/statistics.hpp>

namespace ba  = boost::accumulators;
namespace bat = ba::tag;

template <typename Block> bool run_test(unsigned n, auto& stats) {
    using BitSet = boost::dynamic_bitset<Block>;

    auto gen = std::bind(std::uniform_int_distribution<Block>{},
                         std::mt19937{std::random_device{}()});

    while (n--) {
        Block init[]{gen(), gen(), gen()};
        auto sz = std::bind(
                std::uniform_int_distribution(0ul, sizeof(init) * CHAR_BIT),
                std::mt19937{std::random_device{}()});

        BitSet bs(std::begin(init), std::end(init));
        bs.resize(sz());
        stats(bs.size());

        std::string expected = boost::lexical_cast<std::string>(bs);
        boost::reverse(expected);

        BitSet revclone = bs;
        reverse(revclone);

        auto actual = boost::lexical_cast<std::string>(revclone);
        if (expected != actual) {
            std::cout << __PRETTY_FUNCTION__ << " '" << bs << "': \n"
                      << "  expected: " << expected << "\n"
                      << "  actual: " << actual << "\n";
            return false;
        }
    }
    return true;
}

int main() {
    auto start = now();
    ba::accumulator_set<double,
                        ba::stats<bat::mean, bat::variance, bat::min, bat::max>>
        stats;

    if (run_test<unsigned char>(10'000, stats))
        std::cout << "Completed 10'000 tests with char blocks\n";
    if (run_test<uint16_t>(10'000, stats))
        std::cout << "Completed 10'000 tests with uint16_t blocks\n";
    if (run_test<uint32_t>(100'000, stats))
        std::cout << "Completed 100'000 tests with uint32_t blocks\n";
    if (run_test<uintmax_t>(1'000'000, stats))
        std::cout << "Completed 1'000'000 tests with uintmax_t blocks\n";

    auto cost = ((now() - start)/1.us) / ba::count(stats);

    std::cout
        << "Samples " << ba::count(stats)
        << " mean: " << ba::mean(stats)
        << " min: " << ba::min(stats)
        << " max: " << ba::max(stats)
        << " stddev: " << std::sqrt(ba::variance(stats))
        << "\n";

    std::cout << "Average cost " << cost << "μs\n";
}

Prints, on my machine:
Completed 10'000 tests with char blocks
Completed 10'000 tests with uint16_t blocks
Completed 100'000 tests with uint32_t blocks
Completed 1'000'000 tests with uintmax_t blocks
Samples 1120000 mean: 90.3283 min: 0 max: 192 stddev: 55.9233
Average cost 3.69335μs

real    0m4,141s
user    0m4,061s
sys     0m0,003s

So, with a mean size of 90 bits, bitsets up to 192 bits can be reversed in less than than 4μs. Not bad.
Proper Micro Benchmarks
Using Nonius, we can get reliable data from predictable tests. For sizes 31, 32, 37 bits net timings are in the 10-30ns range.
Code used:
#define NONIUS_RUNNER
#include <nonius/nonius.h++>
#include <nonius/main.h++>

template <typename Block> void run_test(nonius::chronometer& cm, size_t target_size) {
    using BitSet = boost::dynamic_bitset<Block>;

    static const std::string data{
        "0100110111010010010001100111010010010001011100100100111010100010011010"
        "01100000011000010001110111"};

    BitSet bs(data, 0, target_size);
    assert(bs.size() == target_size);

    cm.measure([&] { reverse(bs); });
}

NONIUS_BENCHMARK("Block=uchar,     sz=32", [](nonius::chronometer cm) { run_test<uint8_t>(cm,   32); })
NONIUS_BENCHMARK("Block=uint16_t,  sz=32", [](nonius::chronometer cm) { run_test<uint16_t>(cm,  32); })
NONIUS_BENCHMARK("Block=uint32_t,  sz=32", [](nonius::chronometer cm) { run_test<uint32_t>(cm,  32); })
NONIUS_BENCHMARK("Block=uintmax_t, sz=32", [](nonius::chronometer cm) { run_test<uintmax_t>(cm, 32); })

NONIUS_BENCHMARK("Block=uchar,     sz=31", [](nonius::chronometer cm) { run_test<uint8_t>(cm,   31); })
NONIUS_BENCHMARK("Block=uint16_t,  sz=31", [](nonius::chronometer cm) { run_test<uint16_t>(cm,  31); })
NONIUS_BENCHMARK("Block=uint32_t,  sz=31", [](nonius::chronometer cm) { run_test<uint32_t>(cm,  31); })
NONIUS_BENCHMARK("Block=uintmax_t, sz=31", [](nonius::chronometer cm) { run_test<uintmax_t>(cm, 31); })

NONIUS_BENCHMARK("Block=uchar,     sz=37", [](nonius::chronometer cm) { run_test<uint8_t>(cm,   37); })
NONIUS_BENCHMARK("Block=uint16_t,  sz=37", [](nonius::chronometer cm) { run_test<uint16_t>(cm,  37); })
NONIUS_BENCHMARK("Block=uint32_t,  sz=37", [](nonius::chronometer cm) { run_test<uint32_t>(cm,  37); })
NONIUS_BENCHMARK("Block=uintmax_t, sz=37", [](nonius::chronometer cm) { run_test<uintmax_t>(cm, 37); })

Full interactive chart: http://stackoverflow-sehe.s3.amazonaws.com/974d10e8-74ae-4fcf-be03-6a0d0e01b5ad/stats.html