text:
Q: How to find exact seasons and days from a given date range? I need this for rent a car price calculation. Cars prices are different according to seasons.
I have a season_dates table like this
id    slug    start                  end
1     low     2011-01-01 00:00:00    2011-04-30 00:00:00
2     mid     2011-05-01 00:00:00    2011-06-30 00:00:00
3     high    2011-07-01 00:00:00    2011-08-31 00:00:00
4     mid     2011-09-01 00:00:00    2011-10-31 00:00:00
5     low     2011-11-01 00:00:00    2011-12-31 00:00:00

Users selecting days, for example:
start_day   08/20   end_day  08/25

My query like that:
SELECT * from arac_donemler
where DATE_FORMAT(start, '%m/%d') <= '08/20'
  and DATE_FORMAT(end, '%m/%d') >= '08/25'

This gives me high season that's correct.
But what I couldn't handle is: what if user selects a date range between 2 seasons?
For example from 20 August to 05 September.
This time I have to find that date ranges belongs to which seasons?
And I have to calculate how many days per each seasons?
For the example above,
high season ending at 31 August. So 31-20 = 11 days for high season, 5 days for mid season.
How can I provide this separation?
I hope I could explain it.
I tried so many things like join table inside but couldn't succeed it.

A: I'll let others chime in with the right way to do date comparisons in SQL (yours almost certainly kills indexing for the table), but for a start, you can get exactly the seasons that are relevant by
select * from arac_donemler
 where end >= [arrival-date]
   and start <= [departure-date]

Then you should do the rest of your processing (figure out how many days in each season and so forth) in the business logic instead of in the database query.

A: I would store all single days within a table.
This is a simple example.
create table dates (
id int not null auto_increment primary key,
pday date,
slug tinyint,
price int);

insert into dates (pday,slug,price)
values
('2011-01-01',1,10),
('2011-01-02',1,10),
('2011-01-03',2,20),
('2011-01-04',2,20),
('2011-01-05',2,20),
('2011-01-06',3,30),
('2011-01-07',3,30),
('2011-01-08',3,30);

select
concat(min(pday),'/',max(pday)) as period,
count(*) as days,
sum(price) as price_per_period
from dates
where pday between '2011-01-02' and '2011-01-07'
group by slug

+-----------------------+------+------------------+
| period                | days | price_per_period |
+-----------------------+------+------------------+
| 2011-01-02/2011-01-02 |    1 |               10 |
| 2011-01-03/2011-01-05 |    3 |               60 |
| 2011-01-06/2011-01-07 |    2 |               60 |
+-----------------------+------+------------------+
3 rows in set (0.00 sec)

EDIT. Version with grandtotal
select
case
when slug is null then 'Total' else concat(min(pday),'/',max(pday)) end as period,
count(*) as days,
sum(price) as price_per_period
from dates
where pday between '2011-01-02' and '2011-01-07'
group by slug
with rollup;

+-----------------------+------+------------------+
| period                | days | price_per_period |
+-----------------------+------+------------------+
| 2011-01-02/2011-01-02 |    1 |               10 |
| 2011-01-03/2011-01-05 |    3 |               60 |
| 2011-01-06/2011-01-07 |    2 |               60 |
| Total                 |    6 |              130 |
+-----------------------+------+------------------+
4 rows in set (0.00 sec)

edit. Stored procedure to populate table
delimiter $$
create procedure calendario(in anno int)
begin
  declare i,ultimo int;
  declare miadata date;
  set i = 0;
  select dayofyear(concat(anno,'-12-31')) into ultimo;
  while i < ultimo do
    select concat(anno,'-01-01') + interval i day into miadata;
    insert into dates (pday) values (miadata);
    set i = i + 1;
  end while;
end $$
delimiter ;

call calendario(2011);

A: If you have a table RENTAL too (the real version would need a lot of other details in it):
CREATE TABLE Rental
(
    start   DATE NOT NULL,
    end     DATE NOT NULL
);

and you populate it with:
INSERT INTO rental VALUES('2011-08-20', '2011-09-05');
INSERT INTO rental VALUES('2011-08-20', '2011-08-25');

then this query produces a plausible result:
SELECT  r.start AS r_start, r.end AS r_end,
        s.start AS s_start, s.end AS s_end,
        GREATEST(r.start, s.start) AS p_start,
        LEAST(r.end, s.end)        AS p_end,
        DATEDIFF(LEAST(r.end, s.end), GREATEST(r.start, s.start)) + 1 AS days,
        s.id, s.slug
  FROM rental AS r
  JOIN season_dates AS s ON r.start <= s.end AND r.end >= s.start;

It yields:
r_start     r_end       s_start     s_end       p_start     p_end       days id slug
2011-08-20  2011-09-05  2011-07-01  2011-08-31  2011-08-20  2011-08-31  12   3  high
2011-08-20  2011-09-05  2011-09-01  2011-10-31  2011-09-01  2011-09-05   5   4  mid
2011-08-20  2011-08-25  2011-07-01  2011-08-31  2011-08-20  2011-08-25   6   3  high

Note that I'm counting 12 days instead of 11; that's the +1 in the days expression.  It gets tricky; you have to decide whether if the car is returned on the same day as it is rented, is that one day's rental?  What if it is returned the next day?  Maybe the time matters?  But that gets into detailed business rules rather than general principles.  Maybe the duration is the larger of the raw DATEDIFF() and 1?  Also note that there is only the rental start and end dates in this schema to identify the rental; a real schema would have some sort of Rental Agreement Number in the rental table.
(Confession: simulated using IBM Informix 11.70.FC2 on MacOS X 10.7.1, but MySQL is documented as supporting LEAST, GREATEST, and DATEDIFF and I simulated those in Informix.  The most noticeable difference might be that Informix has a DATE type without any time component, so there are no times needed or displayed.)

But [...] seasons period always same every year. So I thought to compare only days and months. 2011 isn't important. Next years just 2011 will be used. This time problem occurs. For example low season includes November, December and then go to January, February, March, April. If a user selects a date range 01.05.2011 to ...2011 There is no problem. I just compare month and day with DATE_FORMAT(end, '%m/%d'). But if he chooses a range from December to next year January, how am I gonna calculate days?

Notice that 5 entries per year in the Season_Dates table is not going to make an 8" floppy disk break sweat over storage capacity for a good few years, let alone a 500 GiB monster disk.  So, by far the simplest thing is to define the entries for 2012 in 5 new rows in the Season_Dates table.  That also allows you to handle the fact that in December, the powers-that-be decide the rules will be different (20th December to 4th January will be 'mid', not 'low' season, for example).


text:
Q: Updating a point in Chart JS dynamically only updates the y value I have a line chart with a point that I am attempted to animate over the line.  When I update the chart by directly changing the data points' x and y values, only the y value updates on the canvas.  If I inspect the chart instance however in the console, the data point's x and y values do indeed update to the new values.  If I inspect the data point on the canvas with the tooltip, you can see that only the y value is updating.  Any ideas?
// Data.
const dataset1 = [{ 'x': 29.0, 'y': 0.2686622628222965 },
{ 'x': 30.0, 'y': 1.6875564015713724 },
{ 'x': 31.0, 'y': 3.927335271321925 },
{ 'x': 32.0, 'y': 6.116677743682844 },
{ 'x': 33.0, 'y': 8.305688276805473 },
{ 'x': 34.0, 'y': 10.494369219774036 },
{ 'x': 35.0, 'y': 12.68059810657068 },
{ 'x': 36.0, 'y': 14.8711001192293 },
{ 'x': 37.0, 'y': 17.059239571115175 },
{ 'x': 38.0, 'y': 19.247118637561453 },
{ 'x': 39.0, 'y': 21.434670568612262 },
{ 'x': 40.0, 'y': 23.619730722191015 }];

// Options.
const getTsOptions = (tMin, tMax, tStep) => {
  return {
    scaleShowVerticalLines: false,
    animation: false,
    legend: { display: false },
    maintainAspectRatio: false,
    responsive: true,
    scales: {
      xAxes: [{
        display: false,
        gridLines: {
          color: "rgba(0,0,0,0)",
          display: true
        },
        tickOptions: { showGridline: true }
      }
      ],
      yAxes: [
        {
          display: true,
          gridLines: {
            color: 'white',
            display: true,
            borderDash: [2],
            lineWidth: 0.5,
            drawBorder: false,
            zeroLineColor: 'white'
          },
          ticks: {
            min: tMin,
            max: tMax,
            stepSize: tStep,
            fontColor: "white"
          }
        }
      ]
    },
    tooltips: { enabled: true }
  };
};

// TS chart 1.
var myTSChart1 = new Chart(tsNode1, {
  type: "line",
  data: {
    labels: dataset1.map(datapoint => datapoint.x),
    datasets: [{
      backgroundColor: "rgba(0,0,0,0)",
      borderColor: "rgb(204, 204, 204)", // Line color
      borderWidth: 3,
      pointRadius: 0.0,
      data: dataset1,
    },
    {
      backgroundColor: "rgba(0,0,0,0)",
      borderColor: "rgb(204, 204, 204)", // Line color
      borderWidth: 3,
      pointRadius: 5.0,
      data: [{ x: 0, y: 0 }],
    }]
  },
  options: getTsOptions(0, 25, 5)
});

and in a loop, the updater:
myTSChart1.data.datasets[1].data[0].x =  newTime;
myTSChart1.data.datasets[1].data[0].y =  newVelocity;
myTSChart1.update();

EDIT
I did some more debugging- it appears that if I round the x value to a value that is in the labels, it will update.  I am still confused why I could not plot a value at say, an x value of 35.345345...

A: alright i guess chart.js doesn't like when you update a datapoint to a label that isn't in the original instance, that is unless you use the new chart.js time scale.  so what i did is make sure that all the values i anticipate the datapoint taking have their x values in the labels.  theres probably more elegant way to do this but this is my hack for now.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Drools: Recommended way to include multiple drl files, for breaking up business logic I have an application I am trying to experiment with. The business rules I am trying to create are all related but it makes sense for me to group the logic by drl file. For example, I want to put information about customers in the customer.drl file. I want to put logic about the categories of product in the productCategory.drl file and purchases.drl. Finally, I'd like to have a fourth file summarizing my findings for a report.drl
I don't want to create entirely separate modules. I just want to split out the logic so that I can easily maintain the logic in the code. In effect, I'd like something like this:
 src/main/resources/rules
                    customers.drl
                    purchases.drl
                    productCategory.drl
                    reports.drl

I want to be able to share the logic between the facts in a single KieSession, utilizing all the drl files. First, I want to insert customer facts, group them by demographics, then insert their purchase information and products purchased and categorize them. Finally, I want to aggegrate that data in a report by inserting the previously gathered facts to generate data from the reports.drl
Is the configuration, I'm showing a feasible way of doing it.  I'm of course assuming that the KiesSession will pick all the drl files in the rules package if I use a classpath container.
Is this the right way?

A: Looking at the documentation, I can group related rules under the same package. It is one of the options available. So for my use case this works. According to the documentation, I can create a kmodule.xml, and indicate the package, use a classpath container and load the KieSession. If I use a default kmodule definition with no KieBase defined, it will use a default KieBase and load all the resources in the src/main/resources and its other subfolders and this works!


text:
Q: How to connect and deploy React app with Node js backend? I have completed my first project in MERN stack but now I am struggling to deploy it on hiroku.
Till now I was running both react and node code on different ports.
This are the files

client folder is frontend(React).
App.js in Node is
const express = require("express");
const app = express();

const userRouter = require("./routes/userRoutes");
const cookieParser = require("cookie-parser");
const cors = require("cors");
const compression = require("compression");

app.use(cors());

app.use(cookieParser());

app.use(express.urlencoded({ extended: true, limit: "10kb" }));
app.use(compression());

app.use("/api/v1/users", userRouter);
module.exports = app;

App.js in React is
import React from "react";
import "./App.css";
import Home from "./mainPages/home";
import Register from "./components/authentication/register";

import { Route, Switch } from "react-router-dom";

function App() {
  return (
    <div className="app">

      <Switch>
        <Route
          exact
          path="/"
          component={() => (<Home/>)} />
        <Route
          exact
          path="/register"
          component={() => (<Register/>)} />

      </Switch>
    </div>
  );
}

export default App;

Registeration data from client side is send like this
axios({ method: "POST", url: "http://localhost:3000/api/v1/user/register", data: data, headers: header });

How to connect client and server to deploy on hiroku?

A: It is ideal to keep client folder outside server folder.
Step 1: Build your React App and take out the contents in the output folder (dist folder)
Step 2: Deploy your front end in any static hosting services eg(AWS S3 or in any hosting providers)
Step 3: Deploy your back end API in Heroku or any node hosting provider
Step 4: Update the AJAX end points in front end.
Step 5: Thoroughly test and release


text:
Q: Mimic iOS 13 fullscreen dialog I noticed that in iOS 13 full screen dialog has changed, introducing a new slide from bottom animation.
Here is an example

Is it possible to mimic this behaviour with flutter? iOS animation it's not a simple slide from bottom but involves also the background page.
Looking throught flutter documentation I found this class but, without any example I can't understand how to use it or if it's what I'm searching.
Thanks

A: You can always build your own widgets, however in this case you can use an existing package: Modal bottom sheet
you can also check some more existing flutter issues here: enter link description here

A: Update: Based on another answer by @VadimKo, I now understand that the stacking effect might also be desired. The answer linked to a package modal_bottom_sheet based on which I have updated my example
If I'm understanding your question right, you want to show a full screen dialog that slides up from the bottom and has UI similar to the one showed in your picture.
CupertinoFullscreenDialogTransition is really just two SlideTransitions stacked up so it's nothing special.
You could achieve something close to the posted images by using showGeneralDialog
In that, you could show anything using the combination of pageBuilder and transitionBuilder. It's very flexible and can even be used to show full routes on top of current route.
If you use CupertinoFullscreenDialogTransition as the pageBuilder it should achieve your goal. It's not required to provide a transitionBuilder since it's being performed by the pageBuilder implicitly.
The following example tries to mimic requested UI by using CupertinoApp, CustomScrollView and CupertinoSliverNavigationBar for the content of the dialog
Update: A transitionBuilder similar to the one provided by modal_bottom_sheet can be used to add the stacking effect.
Important code from the DartPad example:
showGeneralDialog(
  barrierDismissible: true,
  barrierLabel: 'Settings',
  barrierColor: Colors.black,
  context: context,
  /// This would be slow but good to understand how transitions are working
  transitionDuration: const Duration(seconds: 1),
  /// Optionally provide the [transitionBuilder] to get the stacking effect
  /// as of iOS 13
  transitionBuilder: (context, animation, secondaryAnimation, child) {
    /// The following transition widget was inspired from `modal_bottom_sheet` package
    /// Some modifications have been made to remove certain limitations,
    /// See the full DartPad example or take a look at `modal_bottom_sheet`
    return _CupertinoModalTransition(
      animation: animation,
      child: child,
      /// This renders the current widget behind the modal
      /// Notice the use of [this], it is to make sure correct context is used
      behindChild: this.build(this.context),
    );
  },
  pageBuilder: (context, animation, secondaryAnimation) {
    /// This is the simplest use case for [CupertinoFullscreenDialogTransition]
    /// This provides the slide up and slide down transition effects
    return CupertinoFullscreenDialogTransition(
      primaryRouteAnimation: animation,
      secondaryRouteAnimation: secondaryAnimation,
      /// Content of your dialog
      child: Container(),
      linearTransition: true,
    );
  },
);

DartPad Full example : https://dartpad.dev/57de88ce8d64dff9d3e6fe0627a8b654
Update: The DartPad example works just like modal_bottom_sheet but without any need to make changes to existing code such as the requirement to use MaterialWithModalsPageRoute or to wrap current/preview routes in CupertinoScaffold both of which are provided by the same package.
Preview:

See the GIF preview: https://i.imgur.com/mZ77M62.gifv
Note: There is already showCupertinoDialog provided by the flutter team but it doesn't provide as much flexibility. It can however be used for normal small dialog popups that don't usually take full screen space.

A: You can use this package cupertino_fullscreen_modal
CupertinoFullscreenModal.of(context).showModal(Widget child, onClose (popValue) {});

A: You can also try another already existing package Cupertino Stackview
CupertinoStackView(
  true,             //_isPrimary
  "Page I",         //_navigation
  Scaffold(...),    //_child
  Colors.black,     //_backgroundColor
 {Key key,
  isDismissible : true,
  radius        : Radius.circular(10.0)})


text:
Q: Why isn't an intersection of two different literals equal to never? type T = 1 & '2';
const a: T = ???

There is no value that could possibly be assigned to a, yet T is 1 & "2", not never, even in strict mode. Why?

A: I happened to recently file an issue asking about this.  The answer was that an error that something isn't assignable to 1 & '2' tends to be more helpful than an error that something isn't assignable to never:

The inconsistency here is because intersections are only reduced when used in a union. so "foo" & "bar" will stay that type unless it is part of a union. that is why x is not assignable to u.
We have found that keeping the intersections longer gives better error messages to users, since never can does not tell you where the type originated from. more over, there is something to say about user typing a type as such, what the intent is..


text:
Q: Using cuModuleLoad to get current Module from ELF binary (from argv[0]) Situation:
I am trying to use cuModuleLoad to load the current binary's (ELF) embedded cubin (and PTX), but it keep erroring out with error code 200. My question is, if the cubin is embedded into the final binary, why can't I use cuModuleLoad to dynamically load ones self? It works when the I compile a separate fatbinary, but not when I load a separate PTX module, and of course when I try to load the final binary (a.out). I have a few reasons why I want to load the current executable that I will forgo to not go off topic. I am also looking for a workaround that maintains a single file without using utility tools (or system calls).
In Linux:
#include "cuda.h"
#include <cstdio>
#include <iostream>

using clock_value_t = long long;

__device__ void test(  )
{
  printf("Testing... : \n");
}

__device__ void sleep(clock_value_t sleep_cycles)
{
    clock_value_t start = clock64();
    clock_value_t cycles_elapsed;
    do { cycles_elapsed = clock64() - start; }
    while (cycles_elapsed < sleep_cycles);
}

extern "C" __global__ void hello_world(  )
{
  printf("Hello World from Device\n");
  sleep( 1e9 );
  test();
}

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

  std::cout << argv[0] << std::endl;

  // Initialize input vectors    ...
  //Initialize
  cuInit(0);
  // Get number of devices supporting CUDA
  int deviceCount = 0;
  cuDeviceGetCount(&deviceCount);

  if (deviceCount == 0)
  {
    printf("There is no device supporting CUDA.\n");
    exit (0);
  }
  else std::cout << "Number of device is "<< deviceCount << std::endl;

  // Get handle for device 0
  CUdevice cuDevice;
  cuDeviceGet(&cuDevice, 0);
  // Create context
  CUcontext cuContext;
  int ret = cuCtxCreate(&cuContext, 0, cuDevice);

  if( ret != CUDA_SUCCESS )
          std::cout << "Could not create context on device 0" << std::endl;

  // Create module from binary file
  CUmodule cuModule;

  ret = cuModuleLoad(&cuModule, argv[0]); // <---errors HERE

  if( ret != CUDA_SUCCESS )
  {
    std::cout << "Failed to load self fatbin : " << argv[0] << " : " << ret<< std::endl;
    return -1;
  }
}

I would be bummed if If I have to use a separate file, or a utility to extract the cubins or PTXs dynamically. Anyways- thank you guys for your insight ahead of time.

A: Found a solution. In a nutshell :

*

*fopen( argv[0] )

*mmap ( file )

*Read the ELF headers and find the ".nv_fatbin" section

*Parse the ".nv_fatbin" aligning to byte sequence "50 ed 55 ba 01 00 10 00"

*Find the cubin related to the global method you want to cuModuleGetFunction

*Call cuModuleLoadFatBinary with a base address of the .nv_fatbin + specific cubin offset.

*Get the function using cuModuleGetFunction

*Finally call cuLaunchKernel

See sloppy code below for reference:
int main(int argc, char * argv[])
{
  std::cout << "Hello World from Host" << std::endl;
  std::cout << argv[0] << std::endl;
  void * start_ptr =NULL;
  struct stat sb;
  size_t sz =0;

  //read_elf_header( argv[0] );
  // Either Elf64_Ehdr or Elf32_Ehdr depending on architecture.
  ElfW(Ehdr) elf_header;
  ElfW(Shdr) header;

  std::cout << "opening elf file" << std::endl;
  FILE* file = fopen(argv[0], "rb");

  int fd = fileno( file );

  if (fd < 0)
  {
    printf("Could not open file for memory mapping, fd = %i\n", errno);
    exit(1);
  }

  std::cout << "getting file size" << std::endl;
  if (fstat(fd, &sb) == -1)          // To obtain file size
    printf("Could not find fstat");
  sz = sb.st_size;

  std::cout << "Mapping file to memory : " << sz << std::endl;
  start_ptr = mmap(NULL, sz, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);

  //check if valid elf
  bool b = elf_is_elf64( file );
  fseek( file, 0, SEEK_SET );
  std::cout << "is ELF file : " << b << std::endl;
  if( b)
  {
    std::cout << "Found valid ELF file" << std::endl;
    //get ELF_Header
    b = elf64_get_elf_header(file, &elf_header);
    fseek( file, 0, SEEK_SET );

    if( b )
    {
      std::cout << "-Found valid ELF Header" << std::endl;
      b = elf64_get_section_header_by_name(file, (const Elf64_Ehdr *) &elf_header, ".nv_fatbin", &header);
      fseek( file, 0, SEEK_SET );

      if( b )
      {
        std::cout << "Found fatbin section" << std::endl;
        cuInit(0);
        // Get number of devices supporting CUDA
        int deviceCount = 0;
        cuDeviceGetCount(&deviceCount);

        if (deviceCount == 0)
        {
          printf("There is no device supporting CUDA.\n");
          exit (0);
        }
        else std::cout << "Number of device is "<< deviceCount << std::endl;

        // Get handle for device 0
        CUdevice cuDevice;
        cuDeviceGet(&cuDevice, 0);
        // Create context
        CUcontext cuContext;
        int ret = cuCtxCreate(&cuContext, 0, cuDevice);
        if( ret != CUDA_SUCCESS )
          std::cout << "Could not create context on device 0" << std::endl;
        // Create module from binary file
        CUmodule cuModule;
        std::cout << "sh_addr = " <<  header.sh_addr << std::endl;
        unsigned long long offset = header.sh_addr;

        unsigned long long cuOffset = _find_cubin_offset( header, start_ptr, offset, "_Z11hello_worldv");

        const void * fatbin = &((unsigned char *) start_ptr)[cuOffset];

        std:: cout << "fat bin = " << fatbin << std::endl;

        ret = cuModuleLoadFatBinary(&cuModule, fatbin );

        if( ret != CUDA_SUCCESS )
        {
          std::cout << "Failed to load self fatbin : " << argv[0] << " : " << ret<< std::endl;
        }

        CUfunction khw;
        //ret = cuModuleGetFunction(&khw, cuModule, "hello_world");
        ret = cuModuleGetFunction(&khw, cuModule, "_Z11hello_worldv");
        if( ret != CUDA_SUCCESS )
        {
          std::cout << "Failed to get hello_world from " << argv[0] << " : " << ret <<  std::endl;
        }
        else ret = cuLaunchKernel(khw, 1, 1, 1, 1, 1, 1, 0, 0, NULL, 0);

        if( ret != CUDA_SUCCESS )
        {
          std::cout << "Failed to launch : hello_world "  << std::endl;
        }

        ret = cuModuleUnload(cuModule);

        if( ret != CUDA_SUCCESS )
        {
          std::cout << "Failed to unload self fatbin : " << argv[0] << std::endl;
          return -1;
        }

        if (cudaDeviceSynchronize() != cudaSuccess)
        {
          printf ("Cuda call failed\n");
        }

        //unmap sutff
        munmap(start_ptr, sz);
        return 0;
      }
    }

  }

  fclose(file);

  return 0;


text:
Q: Do I need the .cue file to play ps1 games on epsxe I have been emulating ps1 for a while now so I don't ruin my cds, but I have always kept both the .bin and the .cue. Do I need the .cue or can I just use the .bin?

A: Most, if not all, PSX games discs only have a single data track, which makes .cue files totally pointless for PSX game images. If your .cue files contain only the following, then you are free to delete them; if they contain more than a single track record, or the index is not 00:00:00, then you should keep them.
FILE "whatever.bin" BINARY
  TRACK 01 MODE2/2352
    INDEX 01 00:00:00


text:
Q: Local basis of neighbourhoods Show that the closed intervals $[−2^{ − n}, 2^{− n}], n \in \mathbb{N}$,  form a local basis of
neighbourhoods around $0$ in the Euclidean topology on $\mathbb{R}$
I have to prove:
If $\mathcal{B}(0)$is a base of neighborhoods of zero then, given any neighborhood of zero $V$, there is $U\in \mathcal{B}(0)$ such that $U\subset V$.
I do not know how to start
Thanks

A: If $O$ is open and contains $0$ then for some open interval $0 \in  (a,b) \subseteq O$. Pick $n$ so large that $\frac{1}{2^n} < \min(|a|, b)$ and then $[-2^{-n}, 2^{-n}] \subseteq (a,b)$ and we're done.


text:
Q: iPhone image generated locally using jQuery plugin in UIWebView, need to convert to UIImage I generate an image locally in a UIWebView and I would like to save this image in my main bundle after generation so I don't have to perform this operation more than once.  I use a jquery .js source and loadHtmlString command using the following string, with the jquery barcode generator scripts given included:

The image generates fine and I can show it in  a webview, but because the file is generated locally, I am not able to generate a UIImage with a URL in the usual fashion.  I am not very html, js, or jquery saavy; so I am at a loss for what to do here.  Any help is greatly appreciated.  Thanks!

A: You could use something like this to generate a UIImage from your UIWebView (where view is your UIWebView):
UIGraphicsBeginImageContextWithOptions(view.layer.frame.size, view.opaque, [[UIScreen mainScreen] scale]);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

Then this to store the image in your bundle:
NSString *fileName = @"somefilename";
NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent: fileName];
if([UIImagePNGRepresentation(img) writeToFile: filePath atomically:YES])
        NSLog(@"image stored !");


text:
Q: NetSuite SuiteTalk API - Get Inventory Details I'm using the SuiteTalk (API) service for NetSuite to retrieve a list of Assemblies. I need to load the InventoryDetails fields on the results to view the serial/lot numbers assigned to the items. This is the current code that I'm using, but the results still show those fields to come back as NULL, although I can see the other fields for the AssemblyBuild object. How do I get the inventory details (serials/lot#'s) to return on a transaction search?
public static List<AssemblyBuildResult> Get()
{
     var listAssemblyBuilds = new List<AssemblyBuildResult>();

     var service = Service.Context();

     var ts = new TransactionSearch();
     var tsb = new TransactionSearchBasic();

     var sfType = new SearchEnumMultiSelectField
     {
         @operator = SearchEnumMultiSelectFieldOperator.anyOf,
         operatorSpecified = true,
         searchValue = new string[] { "_assemblyBuild" }
     };

     tsb.type = sfType;
     ts.basic = tsb;
     ts.inventoryDetailJoin = new InventoryDetailSearchBasic();

     // perform the search
     var response = service.search(ts);
     response.pageSizeSpecified = true;

     // Process response
     if (response.status.isSuccess)
     {
         // Process the records returned in the response
                // Get more records with pagination
                if (response.totalRecords > 0)
                {
                    for (var x = 1; x <= response.totalPages; x++)
                    {
                        var records = response.recordList;

                        foreach (var t in records)
                        {
                            var ab = (AssemblyBuild) t;
                            listAssemblyBuilds.Add(GetAssemblyBuildsResult(ab));
                        }

                        if (response.pageIndex < response.totalPages)
                        {
                            response = service.searchMoreWithId(response.searchId, x + 1);
                        }
                    }
                }
            }

            // Parse and return NetSuite WorkOrder into assembly WorkOrderResult list
            return listAssemblyBuilds;
        }

A: After much pain and suffering, I was able to solve this problem with the following code:
    /// <summary>
    /// Returns List of AssemblyBuilds from NetSuite
    /// </summary>
    /// <returns></returns>
    public static List<AssemblyBuildResult> Get(string id = "", bool getDetails = false)
    {
        // Object to populate and return results
        var listAssemblyBuilds = new List<AssemblyBuildResult>();

        // Initiate Service and SavedSearch (TransactionSearchAdvanced)
        var service = Service.Context();
        var tsa = new TransactionSearchAdvanced
        {
            savedSearchScriptId = "customsearch_web_assemblysearchmainlist"
        };

        // Filter by ID if specified
        if (id != "")
        {
            tsa.criteria = new TransactionSearch()
            {
                basic = new TransactionSearchBasic()
                {
                    internalId = new SearchMultiSelectField
                    {
                        @operator = SearchMultiSelectFieldOperator.anyOf,
                        operatorSpecified = true,
                        searchValue = new[] {
                        new RecordRef() {
                            type = RecordType.assemblyBuild,
                            typeSpecified = true,
                            internalId = id
                        }
                    }
                    }
                }
            };

        }

        // Construct custom columns to return
        var tsr = new TransactionSearchRow();
        var tsrb = new TransactionSearchRowBasic();

        var orderIdCols = new SearchColumnSelectField[1];
        var orderIdCol = new SearchColumnSelectField();
        orderIdCols[0] = orderIdCol;
        tsrb.internalId = orderIdCols;

        var tranDateCols = new SearchColumnDateField[1];
        var tranDateCol = new SearchColumnDateField();
        tranDateCols[0] = tranDateCol;
        tsrb.tranDate = tranDateCols;

        var serialNumberCols = new SearchColumnStringField[1];
        var serialNumberCol = new SearchColumnStringField();
        serialNumberCols[0] = serialNumberCol;
        tsrb.serialNumbers = serialNumberCols;

        // Perform the Search
        tsr.basic = tsrb;
        tsa.columns = tsr;
        var response = service.search(tsa);

        // Process response
        if (response.status.isSuccess)
        {
            var searchRows = response.searchRowList;
            if (searchRows != null && searchRows.Length >= 1)
            {
                foreach (SearchRow t in searchRows)
                {
                    var transactionRow = (TransactionSearchRow)t;
                    listAssemblyBuilds.Add(GetAssemblyBuildsResult(transactionRow, getDetails));
                }
            }
        }

        // Parse and return NetSuite WorkOrder into assembly WorkOrderResult list
         return listAssemblyBuilds;
    }

    private static string GetAssemblyBuildLotNumbers(string id)
    {
        var service = Service.Context();
        var serialNumbers = "";

        var tsa = new TransactionSearchAdvanced
        {
            savedSearchScriptId = "customsearch_web_assemblysearchlineitems"
        };

        service.searchPreferences = new SearchPreferences { bodyFieldsOnly = false };
        tsa.criteria = new TransactionSearch()
        {
            basic = new TransactionSearchBasic()
            {
                internalId = new SearchMultiSelectField
                {
                    @operator = SearchMultiSelectFieldOperator.anyOf,
                    operatorSpecified = true,
                    searchValue = new[] {
                        new RecordRef() {
                            type = RecordType.assemblyBuild,
                            typeSpecified = true,
                            internalId = id
                        }
                    }
                }
            }
        };

        // Construct custom columns to return
        var tsr = new TransactionSearchRow();
        var tsrb = new TransactionSearchRowBasic();

        var orderIdCols = new SearchColumnSelectField[1];
        var orderIdCol = new SearchColumnSelectField();
        orderIdCols[0] = orderIdCol;
        tsrb.internalId = orderIdCols;

        var serialNumberCols = new SearchColumnStringField[1];
        var serialNumberCol = new SearchColumnStringField();
        serialNumberCols[0] = serialNumberCol;
        tsrb.serialNumbers = serialNumberCols;

        tsr.basic = tsrb;
        tsa.columns = tsr;

        var response = service.search(tsa);

        if (response.status.isSuccess)
        {
            var searchRows = response.searchRowList;
            if (searchRows != null && searchRows.Length >= 1)
            {
                foreach (SearchRow t in searchRows)
                {
                    var transactionRow = (TransactionSearchRow)t;
                    if (transactionRow.basic.serialNumbers != null)
                    {
                        return transactionRow.basic.serialNumbers[0].searchValue;
                    }
                }
            }
        }

        return serialNumbers;
    }

    private static AssemblyBuildResult GetAssemblyBuildsResult(TransactionSearchRow tsr, bool getDetails)
    {
        if (tsr != null)
        {
            var assemblyInfo = new AssemblyBuildResult
            {
                NetSuiteId = tsr.basic.internalId[0].searchValue.internalId,
                ManufacturedDate = tsr.basic.tranDate[0].searchValue,
                SerialNumbers = tsr.basic.serialNumbers[0].searchValue

            };

            // If selected, this will do additional NetSuite queries to get detailed data (slower)
            if (getDetails)
            {
                // Look up Lot Number
                assemblyInfo.LotNumber = GetAssemblyBuildLotNumbers(tsr.basic.internalId[0].searchValue.internalId);
            }

            return assemblyInfo;
        }

        return null;

    }

What I learned about pulling data from NetSuite:

*

*Using SavedSearches is the best method to pull data that doesn't automatically come through in the API objects

*It is barely supported

*Don't specify an ID on the SavedSearch, specify a criteria in the TransactionSearch to get one record

*You will need to specify which columns to actually pull down. NetSuite doesn't just send you the data from a SavedSearch automatically

*You cannot view data in a SavedSearch that contains a Grouping

*In the Saved Search, use the Criteria Main Line = true/false to read data from the main record (top of UI screen), and line items (bottom of screen)


text:
Q: How to append to an array using a variadic macro? I'm trying to eliminate a bunch of boilerplate code by using macros.
Here's what works.  I can replace:
int do_register_script(struct context *L)
{
    method_type const _instance_methods[] = {
        {"new", __new},
        {"delete", __delete}
        {NULL, NULL}
    };
    register_type(L, script, _instance_methods, 0);
    return 1;
}

with a macro
#define do_register_type(name) \
    int do_register_ ## name(struct context *L) \
    { \
        method_type const _instance_methods[] = { \
            {"new", __new}, \
            {"delete", __delete}, \
            {NULL, NULL} \
        }; \
        register_type(L, name, _instance_methods, 0); \
        return 1; \
    }

like so:
do_register_type(script);

which is perfect!
But I also have some that look like this:
int do_register_rectangle(struct context *L)
{
    method_type const _instance_methods[] = {
        {"new", __new},
        {"delete", __delete},
        {"area", area},
        {"perimeter", perimeter}
        {NULL, NULL}
    };
    register_type(L, rectangle, _instance_methods, 0);
    return 1;
}

And now the above macro doesn't work.
How can I add another parameter to the macro to support this?
I'm using C, not C++, so no templates.
UPDATE: Also sometimes the code this is going in uses aliases for the names
        {"area", area},
        {"Area", area},
        {"perimeter", perimeter}
        {"Perimeter", perimeter}

A: Looping over lists in preprocessor normally requires generating boilerplate macros, but you can avoid that by using a somewhat weird syntax for lists:
do_register_type(script, (area)(perimeter))

Here's how you loop over such lists:
#define REG_LOOP(seq) REG_END(REG_LOOP_A seq)

#define REG_END(...) REG_END_(__VA_ARGS__)
#define REG_END_(...) __VA_ARGS__##_END

#define REG_LOOP_A(func) REG_LOOP_BODY(func) REG_LOOP_B
#define REG_LOOP_B(func) REG_LOOP_BODY(func) REG_LOOP_A
#define REG_LOOP_A_END
#define REG_LOOP_B_END

#define REG_LOOP_BODY(func) {#func, func},

REG_LOOP((foo)(bar)) will expand to {"foo", foo}, {"bar", bar},.
Then you add this macro to do_register_type:
#define do_register_type(name, seq) \
    int do_register_ ## name(struct context *L) \
    { \
        method_type const _instance_methods[] = { \
            {"new", __new}, \
            {"delete", __delete}, \
            REG_LOOP(seq) \
            {NULL, NULL} \
        }; \
        register_type(L, name, _instance_methods, 0); \
        return 1; \
    }

A: do you want that :
#define do_register_type(name, ...) \
    int do_register_ ## name(struct context *L) \
    { \
        method_type const _instance_methods[] = { \
            {"new", __new}, \
            {"delete", __delete}, \
            __VA_ARGS__ __VA_OPT__(,) \
            {NULL, NULL} \
        }; \
        register_type(L, name, _instance_methods, 0); \
        return 1; \
    }

do_register_type(script);

do_register_type(script, {"area", area}, {"perimeter", perimeter});

previous code being in m.c:
pi@raspberrypi:~ $ gcc -E m.c
# 1 "m.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<command-line>" 2
# 1 "m.c"
# 14 "m.c"
int do_register_script(struct context *L) { method_type const _instance_methods[] = { {"new", __new}, {"delete", __delete}, {NULL, NULL} }; register_type(L, script, _instance_methods, 0); return 1; };

int do_register_script(struct context *L) { method_type const _instance_methods[] = { {"new", __new}, {"delete", __delete}, {"area", area}, {"perimeter", perimeter} , {NULL, NULL} }; register_type(L, script, _instance_methods, 0); return 1; };
pi@raspberrypi:~ $

I noticed you do not want the prefix '__' for area and perimeter, contrarily to new and delete but may be you want it for some other cases, because of that it is not possible to expand automatically and the only way I see is to give explicitly the code to add


text:
Q: Google Tag Manager Link Click Event Listener Triggering on Page Load I am having an issue that all of my Link Click Event Listeners are being triggered every time the page is loaded rather than when a user click the links.
Here is the setup for the listener:

This is the code of the link that I am trying to track.  There are a number of these generated in a Wordpress query loop:
Book Now

I moved the ID on to a span wrapping the text rather than on the link trying to see if that would change the issue.  No difference between having it on the  tag or the  tag.  Both still fire every time the page is loaded rather than when the user clicks.

A: The gtm.linkClick listener should be configured in a tag of its own to load on every page so that it listens to every and all clicks to any links. Your event should then be configured to fire when the event is gtm.linkCLick. This resource is helpful: http://www.simoahava.com/analytics/auto-event-tracking-google-tag-manager/.


text:
Q: DataVisualization - empty function bodies in ILSpy I'm doing some astrophysics research and I'm analysing data using Win-Form Chart component. On X-Axis is date and on Y-Axis is value, and I'm applying MovingAverage using member method DataManipulator.FinancialFormula of Chart on values.
I and my advisor are concerned how this function handles missing dates. So I tried to look with ILSpy into System.Windows.Forms.DataVisualization.dll to see how it's implemented but I found all function bodies empty but when I examined TcpClient Dispose and Close methods, I was able to see full function bodies. I have tried ILDasm and JustDecompile with same results as ILSpy.
Why are method bodies from System.Windows.Forms.DataVisualization.dll empty?
So where the real code of DataManipulator.FinancialFormula is located?
Or how this function handles gaps in dates?

A: The difference between my and @Junaith output from ILSpy lead me to tought that I'm looking at wrong file -C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.Windows.Forms.DataVisualization.dll. This path I obtained from comment at top of metadata of  System.Windows.Forms.DataVisualization.Charting.DataFormula viewed by using "Go to Definition" VS function on member method DataManipulator.FinancialFormula of Chart.
So I ran my program and with Process Explorer I looked on loaded .NET Assemblies in properties of my program process. For my surprise the dll mentioned before wasn't even there, instead I found there C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Wind0de890be#\a4711c664a774896b35428b1a3bf9470\System.Windows.Forms.DataVisualization.ni.dll.
I loaded that dll into ILSpy and methods have full implementation including their bodies.


text:
Q: How to send empty message in telegram bot? I have this keyboard in my telegram bot:

When i click the right arrow i get this new keyboard:

the code is this:
    $url = $GLOBALS["website"]."/sendMessage?chat_id=".$chatID."&text=''&parse_mode=html&reply_markup=".json_encode($keyboard3);
    file_get_contents($url);

I know that text is required in sendmessage method, but i'm searching a way or workaround to send an empty message.
I've tried with space or similar html entity, but i did not suceed.
There is a way to do this?
Thank you.

A: You can try Alt + 0173 in the Numpad.
Press and hold the Alt key and click on 0 then 1 then 7 then 3.

A: You can't send empty message now, it was a bug for zero-width space  and RTL (Right-to-Left) control character, but it can't send along now.

A: I don't think there is a way to do what you want.
Consider this:
https://api.telegram.org/botYOURTOKEN/sendMessage?chat_id=ID&text=

Since even space is not accepted, there are no other characters that can be encoded to represent "nothingness".

A: Here is the current working empty symbol for Telegram, which works as a blank bubble message with sendMessage.


text:
Q: Find strings that belong together based on their label Suppose I have a nested list which looks like this:
my_list = [['Germany', 'B-LOC'], ['Angela', 'B-PER'], ['Merkel', 'I-PER']]

So each element contains two strings, the first representing a word from text data and the second string represents the label from a machine learning model.
Here, B-LOC refers to Begin Location, B-PER to Begin Person and I-PER to Inside Person.
What I am interested in is a smart way to find strings that belong together, based on their label.
In this case I would like to output something like
print(....)
>>> Germany Location
>>> Angela Merkel Person

Any suggestion/hint how I could start?

A: This is one approach. using collections.defaultdict
Ex:
from collections import defaultdict
my_list = [['Germany', 'B-LOC'], ['Angela', 'B-PER'], ['Merkel', 'I-PER']]
d = defaultdict(list)

check_val = {"PER": "Person", "LOC": "Location"}

for i in my_list:
    d[check_val.get(i[1][-3:], "N\A")].append(i[0])

for k, v in d.items():
    print( " ".join(v) + " " + k )

Output:
Angela Merkel Person
Germany Location

A: Try list comprehension:
data_location = [x[0] for x in my_list if 'LOC' in x[1]]
data_person = [x[0] for x in my_list if 'PER' in x[1]]
print( ' '.join(data_location), 'Location')
print(' '.join(data_person), 'Person')

Output:
Germany Location
Angela Merkel Person


text:
Q: What does '--data' mean in the dbt test command? A few of our automated pipelines have been using the below dbt test command for a long time.

dbt test --target target_name --data --m test_file_name --vars "{'branch':'branch_name','execdate':'2020/01/01'}"  --no-version-check

It worked without trouble until the dbt version was upgraded from 0.17.0 to 1.0.0.
Now, getting an error as,

dbt: error: unrecognized arguments: --data

I can remove the --data from the dbt command now but I am curious to know why the people have added --data in the dbt command during the pipeline development long back and what it is doing in the dbt command?
Any help, please?

A: This part is described: Test selection examples:

Through the combination of direct and indirect selection, there are many ways to accomplish the same outcome. Let's say we have a data test named assert_total_payment_amount_is_positive that depends on a model named payments. All of the following would manage to select and execute that test specifically:
$ dbt test --select assert_total_payment_amount_is_positive # directly select the test by name
$ dbt test --select payments,test_type:data # indirect selection, v0.18.0
$ dbt test --select payments --data  # indirect selection, earlier versions

Syntax --data was supported in version lower than v.0.18.0.


text:
Q: how to add CSS style by javascript I am new to javascript. try on changing the CSS style by javascript.
I would like to add the style for the a tag under the specific p tag(.font_8), and the a tag already has some style.
the style I try to do is this, but I would like to add the style by javascript.

text text text text

        link link link(text)

A: I don't think this is necessarily what you are going for. But I got the event listener adding the red line under the p tag and it adds the constant styles as well. I didn't know if you were trying to add it to the font_8 or the a tag since you were getting both of them before each loop.
I also added an mouseout event to get rid of the solid line.

const styles = {
  textDecoration: 'none',
  color: 'red',
  borderBottom: '2px dotted currentColor',
}

function getElements() {
  var elements = document.getElementsByClassName('font_8');
  var len = elements.length;
  for (let i = 0; i < len; i++) {
      Object.keys(styles).forEach((key)=>{
        elements[i].style[key]=styles[key]
      })
  }
  for (let i = 0; i < len; i++){
      elements[i].addEventListener('mouseover', function() {
        elements[i].style.borderBottom= '2px solid currentColor';
      })
      elements[i].addEventListener('mouseout', function() {
        Object.keys(styles).forEach((key)=>{
          elements[i].style[key]=styles[key]
        })
      })
  }
}

getElements()

text text text text

    link link link

  (text)

I didn't know if you wanted to bring back the dotted or not, however. If you dont want to bring back the dotted line, you can just use the Object.keys method and put it in the mouseout function like:
elements[i].addEventListener('mouseout', function() {
  elements[i].style.borderBottom= '';
})

A: You should replace all your len[i] with elements[i] (the len variable stores a number, the elements variable stores a list).
On line 14, the , should be an  = I think (if you want to update the style of element[i]) :
      for (var i = 0; i < len; i++) {
        elements[i].style = {
          textDecoration: 'none',
          color: 'red',
          borderBottom: '2px dotted currentColor',
        }
      }

And missing a closing bracket on line 27-28 (to close the for loop).


text:
Q: Asp.net membership table access from mvc5 entity framework context I have a new app lets call it mvc5Identity app. I login to that app using asp.net identity user. In this app I have another EF Context that connects me to a web forms app database. Let's call it webformsMembershipapp now my question is
Can I specify something on EF Context to tell it that webformsMembershipapp contains membership tables so I can use something similar to userManager or Membership.getAll users to access Membership tables from mvc5Identity app.


text:
Q: How to use g:render in g:select for optionValue? I have a g:select statement that looks like the following:
<g:select id="gearbox" name="gearbox.id" from="${com.nppc.mes.energyusage.Gearbox.list()}" optionKey="id" optionValue="${ {"${it.gearboxType} - (${it.gearboxRatio})"} }" required="" value="${gearboxVoltageInstance?.gearbox?.id}" class="many-to-one"/>

I have added an optionValue attribute: optionValue="${ {"${it.gearboxType} - (${it.gearboxRatio})"} }"
This works as I want.
However, I want to show my domain object, Gearboxes the same everywhere.  I have created a template, and am able to use the g:render tag on my show.gsp.
What I can't figure out is how to get something like this to work:
optionValue="<g:render template="/shared/gearbox" model:="[gearbox:it]"/>"
Is it possible to use templates to generate the content that goes into an optionValue?

A: You could hack around it, but it feels like bad design to me.
The right way to do something like is seems to be to add a helper method to your Gearbox domain class
static transients = [ 'renderedValue' ]

def getRenderedValue(){
   "$gearboxType - $gearboxRatio"
}

Then, you can just call optionValue="${ it.renderedValue }".
Also, if you specify a toString() in your domain class, this would be used to generate the default rendered value.

A: Tags can be used as regular functions in Groovy code. Like:
optionValue="${g.render(template: '/shared/gearbox', model: [gearbox: it])}"


text:
Q: Hide SamlMessageSignature output from gulp nunit run results When using gulp-nunit-runner to run NUnit tests for SAMLMessageSignature message that is being signed is shown in console output. Options like noresult = true, verbose = false, trace = 'Off' have no effect. I can redirect the output to a file but I'd prefer to not do it.
When using nunit3-console.exe with --trace=Off --noresult options there is no output, just Test Run Summary.
Is there a way to prevent SAMLMessage from being printed to console output without redirecting whole output to a file?
Example test:
[Test]
public void SamlMessageSignatureGenerate_SamlDocumentAndValidCert_ProducesSignedSamlMessage(
    [ValueSource(nameof(MessagesToSign))] string samlMessage,
    [ValueSource(nameof(Certs))] X509Certificate2 cert,
    [ValueSource(nameof(SupportedSignatureMethods))] string signatureMethod,
    [ValueSource(nameof(SupportedDigestMethods))] string digestMethod)
{
    XmlElement samlDoc = SamlLoader.LoadXmlFromString(samlMessage).DocumentElement;
    string inclusiveNamespacesPrefixList = null;
    SAMLMessageSignature.Generate(samlDoc, cert.PrivateKey, cert, inclusiveNamespacesPrefixList, digestMethod, signatureMethod);
    SAMLMessageSignature.IsSigned(samlDoc).Should().BeTrue();
}

For some reason samlMessage ends up in console output.

A: The options --result, --noresult, --trace have nothing whatsoever to do with console output but serve other purposes.
The option --verbose can be used to provide additional details for some (only some) messages generated by NUnit.
Console output can be redirected to a file using the --out option, which impacts all output sent to the console by a test. Most likely, your SAML output appears to NUnit as if it is generated by a test.
In this case, where you wish to suppress the output generated by a particular test, there are two options:

*

*Use some settings, if they exist, so that the output is never generated. I don't know if this is possible in your case.

*Redirect the console output for your test, capturing it yourself and then restore it at the end of the test.
If you want to do (2) then you have to remember that the console is shared by the entire process. Therefore, your test must never run in parallel with other tests. If you are running some tests in parallel, then mark that one as [NonParallelizable].
To redirect the console, create a StringWriter and set Console.Out to it for the duration of the test. If you wish, you can examine what is written as a part of your test.
If all the tests in a particular fixture require suppressing console output, then you can do it in either a [SetUp] or a [OneTimeSetUp] method. Otherwise, do it in  each individual test, possibly through a using statement.


text:
Q: Graphql upsert (create new if not exist, update if exist) I have been trying to wrap my head around this, but haven't been able to.
Short intro
I have a Serverless Next.js app using Drupal graphql (through apollo) as datastore
What I can do successfully so far
I can GET_DRUPAL_USER and I can UPDATE_USER just fine separately.
Problem
I'm trying to see if there is a way to combine GET_DRUPAL_USER and UPDATE_USER conditionally.
In other words:if a user doesnt exist: create it (CREATE_USER). If it exists: update it with the new data. (UPDATE_USER)
Code Snippet
For simplicity I only show the relevant parts as to show how I structured my code. I can clean GET a user from Drupal just fine, but what I'm struggling with is the concept of waiting for the result of the GET_DRUPAL_USER and conditionally do another GraphQl CREATE_USER or UPDATE_USER.
Current layout of my component
export default function rsvpGigProcess ({ id, user,loading }) {
...
 const GET_DRUPAL_USER = gql`
 query($my_email:[String]){
    userQuery(filter: {conditions: [{field: "mail", value: $my_email, operator: EQUAL}]}) {
        entities {
          ... on User {
            uid
          }
        }
   }
 }
`
 ...

 const [getDrupalUser, { error, loading, data }] = useLazyQuery(GET_DRUPAL_USER);

  const _getOrCreateUser = () => {
     getDrupalUser({
        variables: {
          my_email:"emailaddress@gmail.com"
        }
     })
  }

  ...

  return (
  <button onClick={() => _getOrCreateUser()}>
         Get or Create user
  </button>
  )


text:
Q: Classical solution of one dimensional Parabolic equation and a priori estimates I am researching a system of pdes and it leads me to study the classical solution of one dimensional linear parabolic equation: $u_t+Lu=f,\, t\in[0,T],x\in \Omega=[0,1]$, where $L$ is non-divergence elliptic operator $L=-a(x,t)u_{xx}+b(x,t)u_x+c(x,t)u$.
The initial condition is $u(x,0)=0$, the mixed boundary condition is $u(0,t)=0, \, u_x(1,t)=0$. Suppose that $a(x,t)>0$ on $[0,T]\times \Omega$ and $a(x,t), b(x,t), c(x,t), f(x,t)$ are smooth enough.
My question is that, is there any work claiming the well-posedness in classical sense (that is $u\in C^{1,2}([0,T]\times \Omega)$) of this problem and giving a priori estimate for u in (probably) some Holder space frame work? If there is no such research on that kind of mixed boundary condition, then the results on Neumann or Dirichlet could also be helpful for the first step of reading.
I have found some works from DuChateau and Muzylev but they work only for specific $L$.
I am a quite new learner at the solution in classical sense, can you please help me, from where should I read about it? Thank you!

A: You can see this famous book :
O. A. Ladyzenskaja, V. A. Solonnikov, N. N. Ural'tseva, Linear and Quasilinear
Equations of Parabolic Type, AMS Transl. Monogr. 23, Providence,
R.I. (1968).


text:
Q: Burninate the "highscores" tag? There are currently 49 questions with the highscores tag, which seem to be exclusively on the topic of implementing assorted high score tables for games. To my mind, this tag isn't a great fit for SO as it's describing a feature of an end product rather than the technology or the programming concepts required to implement it.
Should we burninate it?
EDIT: There are also 17 questions tagged highscore (singular), which I also propose that we include.

A: It's done: @Robert Harvey has merged the tags highscore and highscores into game-development and also set up tag synonyms.


text:
Q: Rotate non-square image in lwuit I'm trying to rotate a lwuit image.  The problem is that the image size is 400x300, so when I rotate it, it gets cut.  Lwuit documentation says that the rotate method  assumes a square image, and that's the problem.  Is there some other way to rotate the image?.

A: I found the solution:
javax.microedition.lcdui.Image lcduiImage=(javax.microedition.lcdui.Image) imagen.getImage();
javax.microedition.lcdui.Image lcduiImageRotada=javax.microedition.lcdui.Image.createImage(lcduiImage, 0, 0, lcduiImage.getWidth(), lcduiImage.getHeight(), Sprite.TRANS_ROT90);
imagen=Image.createImage(lcduiImageRotada);


text:
Q: IBM Websphere Commerce is running in RAD internal browser not in firefox I am new to IBM Websphere commerce.i am learning IBM WCS using info center using this link .i successfully completed it's working in RAD internal browser not in external browser like firefox and ie. when i opened it in rad the log (console) is like
    [8/21/14 18:48:11:411 IST] 0000001c servlet       I com.ibm.ws.webcontainer.servlet.ServletWrapper doDestroy SRVE0253I: [WC] [/webapp/wcs/stores] [/Madisons/MyNewJSPTemplate.jsp]: Destroy successful.
    [8/21/14 18:48:11:432 IST] 0000001c servlet       I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: [WC] [/webapp/wcs/stores] [/Madisons/MyNewJSPTemplate.jsp]: Initialization successful.
[8/21/14 18:48:11:438 IST] 0000001c CommerceSrvr  E LikeMindsFilter doFilter CMN3101E The system is unavailable due to "null".java.lang.NullPointerException
at java.util.Hashtable.get(Unknown Source)
at com.ibm.commerce.likeminds.filter.LikeMindsFilter.doFilter(LikeMindsFilter.java:190)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
at com.ibm.commerce.campaigns.filter.CampaignsFilter.doFilter(CampaignsFilter.java:148)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:852)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:785)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:443)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:175)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:859)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1557)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:173)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:272)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:202)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:766)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:896)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1527)

when i accessed it form external browser it the log is like
[8/22/14 8:57:24:847 IST] 00000026 CommerceSrvr  A StrutsViewExecUnit StrutsViewExecUnit CMN0203E: Command not found: "MyNewView".
[8/22/14 8:57:25:077 IST] 00000026 servlet       I com.ibm.ws.webcontainer.servlet.ServletWrapper doDestroy SRVE0253I: [WC] [/webapp/wcs/stores] [/GenericApplicationError.jsp]: Destroy successful.
[8/22/14 8:57:25:093 IST] 00000026 servlet       I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: [WC] [/webapp/wcs/stores] [/GenericApplicationError.jsp]: Initialization successful.
[8/22/14 8:57:25:112 IST] 00000026 SystemOut     O ErrorDataBean:
Originating command:
Message Type: 0
Message Key: _ERR_CMD_CMD_NOT_FOUND
Message: CMN3101E The system is unavailable due to "MyNewView".

[8/22/14 8:57:25:113 IST] 00000026 CommerceSrvr  E LikeMindsFilter doFilter CMN3101E The system is unavailable due to "null".java.lang.NullPointerException
at java.util.Hashtable.get(Unknown Source)
at com.ibm.commerce.likeminds.filter.LikeMindsFilter.doFilter(LikeMindsFilter.java:190)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
at com.ibm.commerce.campaigns.filter.CampaignsFilter.doFilter(CampaignsFilter.java:148)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:852)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:785)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:443)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:175)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:859)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1557)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:173)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:272)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:202)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:766)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:896)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1527)

So any one please tell how to fix this?
Thanks in advnace


text:
Q: Need help to parse a complex JSON I´m trying to parse a complex json (using the Json framework), the problem is that the json has a lot of nested objects. Took too much time programming and i can´t find the solution, my code smells and i have a lot of crashes.
Any idea? (i don´t have any problem on using another json framework, like jsonkit or another)
Here is a simplified version of the json.
[
{
    "category": {
        "id": 451,
        "description": "Product description",
        "quantity": "3149",
        "category": [
            {
                "category": {
                    "id": 115,
                    "description": "Product description",
                    "quantity": "465",
                    "category": [
                        {
                            "category": {
                                "id": 125,
                                "description": "Product description",
                                "quantity": "6"
                            }
                        },
                        {
                            "category": {
                                "id": 120,
                                "description": "Product description",
                                "quantity": "57",
                                "category": [
                                    {
                                        "category": {
                                            "id": 193,
                                            "description": "Product description",
                                            "quantity": "27"
                                        }
                                    },
                                    {
                                        "category": {
                                            "id": 194,
                                            "description": "Product description",
                                            "quantity": "14"
                                        }
                                    }
                                ]
                            }
                        },
                        {
                            "category": {
                                "id": 446,
                                "description": "Product description",
                                "quantity": "7"
                            }
                        },
                        {
                            "category": {
                                "id": 132,
                                "description": "Product description",
                                "quantity": "28",
                                "category": [
                                    {
                                        "category": {
                                            "id": 224,
                                            "description": "Product description",
                                            "quantity": "3"
                                        }
                                    },
                                    {
                                        "category": {
                                            "id": 137,
                                            "description": "Product description",
                                            "quantity": "4"
                                        }
                                    }
                                ]
                            }
                        },
                        {
                            "category": {
                                "id": 128,
                                "description": "Product description",
                                "quantity": "21"
                            }
                        }
                    ]
                }
            },
            {
                "category": {
                    "id": 21,
                    "description": "Product description",
                    "quantity": "225",
                    "category": [
                        {
                            "category": {
                                "id": 170,
                                "description": "Product description",
                                "quantity": "1"
                            }
                        },
                        {
                            "category": {
                                "id": 68,
                                "description": "Product description",
                                "quantity": "45",
                                "category": [
                                    {
                                        "category": {
                                            "id": 81,
                                            "description": "Product description",
                                            "quantity": "2"
                                        }
                                    },
                                    {
                                        "category": {
                                            "id": 69,
                                            "description": "Product description",
                                            "quantity": "2"
                                        }
                                    }
                                ]
                            }
                        }
                    ]
                }
            }
        ]
    }
},
{
    "category": {
        "id": 390,
        "description": "Product description",
        "quantity": "251",
        "category": [
            {
                "category": {
                    "id": 714,
                    "description": "Product description",
                    "quantity": "0"
                }
            },
            {
                "category": {
                    "id": 622,
                    "description": "Product description",
                    "quantity": "22",
                    "category": [
                        {
                            "category": {
                                "id": 192,
                                "description": "Product description",
                                "quantity": "16"
                            }
                        },
                        {
                            "category": {
                                "id": 391,
                                "description": "Product description",
                                "quantity": "6"
                            }
                        }
                    ]
                }
            },
            {
                "category": {
                    "id": 612,
                    "description": "Product description",
                    "quantity": "5"
                }
            },
            {
                "category": {
                    "id": 621,
                    "description": "Product description",
                    "quantity": "123",
                    "category": [
                        {
                            "category": {
                                "id": 628,
                                "description": "Product description",
                                "quantity": "25"
                            }
                        },
                        {
                            "category": {
                                "id": 457,
                                "description": "Product description",
                                "quantity": "3"
                            }
                        }
                    ]
                }
            },
            {
                "category": {
                    "id": 720,
                    "description": "Product description",
                    "quantity": "1"
                }
            },
            {
                "category": {
                    "id": 188,
                    "description": "Product description",
                    "quantity": "52",
                    "category": [
                        {
                            "category": {
                                "id": 437,
                                "description": "Product description",
                                "quantity": "10"
                            }
                        },
                        {
                            "category": {
                                "id": 639,
                                "description": "Product description",
                                "quantity": "7"
                            }
                        },
                        {
                            "category": {
                                "id": 152,
                                "description": "Product description",
                                "quantity": "4",
                                "category": [
                                    {
                                        "category": {
                                            "id": 34,
                                            "description": "Product description",
                                            "quantity": "3"
                                        }
                                    },
                                    {
                                        "category": {
                                            "id": 31,
                                            "description": "Product description",
                                            "quantity": "1"
                                        }
                                    }
                                ]
                            }
                        }
                    ]
                }
            },
            {
                "category": {
                    "id": 548,
                    "description": "Product description",
                    "quantity": "3"
                }
            }
        ]
    }
}]

My intention is create an array of objects to populate the database, the table looks like this:
idfather (the father category)
idproduct
description
quantity
timestamp
The last thing i tried:
- (void)moreCategories:(NSString *)myString {
    NSLog(@"%@",myString);
    NSDictionary *mydict =[myString valueForKeyPath:@"category"] ;
    NSMutableArray *myArray = [[NSMutableArray alloc] init];

    myArray = [mydict valueForKey:@"category"] ;
    NSLog(@"count %d",[myArray count]);
    for (int i = 0; i < [myArray count]; i++)
    {
        NSDictionary *dict = [myArray objectAtIndex:i];
//sometime crashes here
        if (dict ){
            //NSLog(@"dict: %d",[dict count]);
            //NSLog(@"id %d",[[dict objectForKey:@"id"] intValue]);
            //NSLog(@"description %@",[dict objectForKey:@"description"] );
            //NSLog(@"quantity %d",[[dict objectForKey:@"quantity"] intValue]);
            if ([dict valueForKeyPath:@"category"]) {
                [self moreCategories:[dict valueForKeyPath:@"category"] ];

            }
        }
    }

}

- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
    [connection release];

    NSString *responseString = [[[NSString alloc] initWithData:responseData encoding:NSISOLatin1StringEncoding]autorelease];
    [responseData release];

    NSDictionary *results = [responseString JSONValue];
    self.allData = [results valueForKey:@"category"] ;
    NSLog(@"count %d",[self.allData count]);

    for (int i = 0; i < [self.allData count]; i++)
    {
        NSDictionary *dict = [self.allData objectAtIndex:i];
        //NSLog(@"id %d",[[dict objectForKey:@"id"] intValue]);
        NSLog(@"description %@",[dict objectForKey:@"description"] );
        //NSLog(@"quantity %d",[[dict objectForKey:@"quantity"] intValue]);
        if ([dict objectForKey:@"category"]) {
            //NSLog(@"%@",[dict valueForKeyPath:@"category"]);
            //NSLog(@"%@",[self.allData objectAtIndex:i]);
            [self moreCategories:[dict objectForKey:@"category"] ];
            //NSLog(@"%@",[self.allData objectAtIndex:i]);
        }
    //  NSLog(@"%@",[self.allData objectAtIndex:i]);
    }

}

A: You can use TouchJSON, it's really simple and have good performances. It takes your json as data and can return you a NSArray or an NSDictionnary in one line.
If your JSON have a list structure:
NSArray *array = [[CJSONDeserializer deserializer] deserializeAsArray:yourData error:nil];

Else:
NSDictionary *dict = [[CJSONDeserializer deserializer] deserializeAsDictionary:yourData error:nil;

You just have to include TouchJSON in your project ans import #import "CJSONDeserializer.h" in the classes you want to use it. https://github.com/TouchCode/TouchJSON

A: Looks like your problem might be the list in the JSON data structure. When I used the JSON framework, I was not able to access array values with keypaths.
I solved the problem on the server side, not allowing arrays in the data structure - only key/value pairs. Then I could access every value in the structure with a keypath from the root node. (I just used numbers up from 0 for the keys when I wanted to transform a list to JSON.)
And are you sure the syntax of the data structure is correct? Maybe your framework can't handle it - although it should be able to. I used this one: https://github.com/stig/json-framework/


text:
Q: what happens when I try to insert data into mysql while table is locked? Simple question but somehow impossible to find a clear answer:
What happens when I try to insert data into mysql while the table is locked?
1) INSERT query fails
2) INSERT query waits until lock is released
3) something else

A: The "normal" result is the INSERT query waiting until the lock is released. But there are some limits and special cases (you wrote about locking TABLES so MyISAM or explicit LOCK TABLES statement)

*

*the waiting can timeout (lock_wait_timeout)

*Concurrent Inserts are possible when you just append to the end of the table, in that case no waiting happens and INSERTs run in parallel. That needs the locking to originate implicitly from other INSERT/SELECT etc or explicitly from READ LOCAL table lock. If you explicitly lock the table without the LOCAL modifier, this feature cannot be used according to the manual.

But nowadays you should mostly use the InnoDB engine and transaction. In that case there are usually no explicit table locks used. There still can be metadata locks. But according to the manual InnoDB will not escalate row locks to table locks, instead using Multiple granularity locking according to https://www.percona.com/blog/2010/06/08/table-locks-in-show-innodb-status/ .
With row locks many operations can run in parallel and inserts should only wait if there is a gap lock on the gap into which the insert should put the inserted row.


text:
Q: Mongodb date range fetching data is not working in aggregation Below is my one of sample document in mongodb
{
"_id" : ObjectId("59c5fcedc817c3da1b8b456a"),
"zoneid" : "20",
"accountid" : "34",
"sitename" : "aaa",
"requestid" : "2efa1052-7255-41cd-9d39-8628dac5ed3e",
"winbid" : NumberLong("1"),
"bidder" : "innity",
"cpm" : NumberLong("1"),
"responsetime" : NumberLong("207"),
"slotid" : "20x300x250x34x9206",
"viewerid" : "_87cd184234b181d1c601144adc0c3621",
"uniquecount" : NumberLong("0"),
"datetime" : "2017-09-23 06:19:25"
}

and below is my code to fetch data in mongodb in php,
$ops = array(
    array(
        '$group' => array(
            "_id" => array(
                "slotid" => '$slotid',
                "bidder" => '$bidder',
                "viewerid" => '$viewerid',
                "datetime" => '$datetime'
            ) ,
            "total" => array(
                '$sum' => 1
            ) ,
            "sitename" => array(
                '$addToSet' => '$sitename'
            ) ,
            "aid" => array(
                '$addToSet' => '$accountid'
            )
        )
    ) ,
    array(
        '$match' => array(
            "datetime" => array(
                '$gt' => '2017-09-23 06:00:00'
            )
        )
    )
);
$reqbids = $db->requestbids->aggregate($ops);

Its return empty result but if I remove either '$group' array or '$match' array means result will shown,but both will used means empty result shown,like below query its shown result
    $ops = array(
    array(
        '$group' => array(
            "_id" => array(
                "slotid" => '$slotid',
                "bidder" => '$bidder',
                "viewerid" => '$viewerid',
                "datetime" => '$datetime'
            ) ,
            "total" => array(
                '$sum' => 1
            ) ,
            "sitename" => array(
                '$addToSet' => '$sitename'
            ) ,
            "aid" => array(
                '$addToSet' => '$accountid'
            )
        )
    )
);
$reqbids = $db->requestbids->aggregate($ops);

In above query I removed '$match' array , then its shown result.whats the issue in the code,Anyone help to solve my problem,Any help appreciated...


text:
Q: Sending ClientCertificates from HttpWebRequest via Fiddler I am trying to send out a WebRequest request like https://identityserver.github.io/Documentation/docsv2/advanced/clientCerts.html specifies with a handler containing the Client Certificate.
I've gotten to the point that i have determined that the ClientCertificate is just not being sent through fiddler, so it is not read in the ServerVariables["CERT_FLAGS"] when the Owin LoadCertificate is called.
So i have removed all the steps from the process except (IdentityServer3.Samples/source/Clients/ClientCertificateConsoleClient/Program.cs)
async Task<TokenResponse> RequestTokenAsync()
{
    var cert = new X509Certificate2("Client.pfx");

    var handler = new WebRequestHandler();
    handler.ClientCertificates.Add(cert);

    var client = new TokenClient(
        Constants.TokenEndpoint,
        "certclient",
        handler);

    return await client.RequestClientCredentialsAsync("read write");
}

but I am still not seeing in fiddler in the raw request the certificate. I have looked at the source code for HttpWebRequest and only see it handles the ClientCertificate in the GetConnectionGroupLine, and then its a hash code which i also don't see in fiddler. I'm working with Windows 7 and i have turned on the iis client certificate mapping authentication and enabled the setting in iis express applicationhost in the 2015 .vs subfolder and the primary one in my docuemnts. What am I missing here?
reference: https://social.msdn.microsoft.com/Forums/en-US/f88a23f2-3dbe-4202-baf2-a5b05b027fe6/httpwebrequest-not-sending-client-certificate-to-server?forum=netfxnetcom
https://github.com/IdentityServer/IdentityServer3/issues/3220 - can't really find this on stackoverflow..

A: TLDR: Your problem (at this point) is Fiddler not HttpWebRequest/dotnet. (Edited to clarify.)

*

*Fiddler doesn't display TLS info including certs. Fiddler works on, and displays in numerous formats, the HTTP-level data (requests and responses, including application data). When HTTPS transports this HTTP data over SSL/TLS, Fiddler does not display the SSL/TLS-specific data, which in addition to server and optional client certificates (currently) includes version, suite, possibly compression, curve, format and next-protocol negotiation, nonces, ephemeral keys, renegotiation control, signature algorithm control, server name indication, ticket, and other crypto options like encrypt-then-mac and extended-master-secret. The "raw" tab displays all the HTTP data without interpretation, but not the SSL/TLS data.

*Fiddler doesn't request client auth. An SSL/TLS session uses a client certificate to perform client authentication only when requested by the server, and when your client connects to the real IdentityServer it presumably requests this. But when Fiddler is used, there is one SSL/TLS session from the client to Fiddler, and an entirely separate SSL/TLS session from Fiddler to the server. On the session from your client to Fiddler, Fiddler does not request client authentication, so your client doesn't and can't send or use its certificate.

*Client auth can't be relayed anyway. If Fiddler did request client auth on the session from your client, it couldn't use that information to authenticate the session to the real server. Client auth doesn't just send the client cert, it also uses the private key to sign the concatenation (called a transcript) of the handshake messages. Since the handshake between your client and Fiddler and between Fiddler and the server are quite different, this signature is invalid for the server-side handshake and sending it would (correctly) be rejected as invalid by the server.

*Instead Fiddler can do the client auth. If you want to route HTTPS traffic using client auth through Fiddler, you need to instead configure Fiddler to do the client auth on the session with the server; for a fixed setting you can just drop the identifying certificate in Fiddler's config directory, for per-session settings you need to write some FiddlerScript. The private key (and chain) needs to be in the Windows cert store, not (just) in a file. See:
http://docs.telerik.com/fiddler/Configure-Fiddler/Tasks/RespondWithClientCert
https://www.fiddlerbook.com/fiddler/help/httpsclientcerts.asp
Fiddler: Respond to Requests Requiring a Client Certificate (on SO)
https://security.stackexchange.com/questions/72916/can-fiddler-decrypt-https-traffic-when-using-elliptic-curves-client-cert-authe
If your actual problem is getting the client to support client auth when NOT using Fiddler, you need to take Fiddler out of the situation and use other debugging tools like a network trace.