text:
Q: Dynamic Thymeleaf fragment location Imagine a tag:
<div th:replace="pageName/page.html :: fragmentName" />

where pageName should come from model like ${page.name}, but I don't know the syntax how I can insert a variable to the beginning of the fragment location.
Any ideas?

A: According to this, you can simply use variables in fragment expressions.  (The example given is ~{${templateName} :: ${fragmentName}}.  This should work for you:
<div th:replace="~{|pageName/${page.name}.html| :: fragmentName}" />


text:
Q: permissions - PHP and FTP How to setup users/groups so both PHP/Apache and proFTPD has full access to files/dirs?
FTP user
Username: webadmin
User ID: 1001
Home dir: /var/www
Shell: /usr/sbin/nologin
Primary group: www-data

Move home dir if changed: yes
Change user ID on files: home dir
Change group ID on files: home dir
Modify user in other modules: yes

When logging in on the FTP with webadmin all files are listed but with no write rights!?

A: If you want to give multiple users access to something then you should use groups.
First make sure that all of your necessary web 'users' are members of a certain group, probably www-data.
usermod -a -G www-data webadmin

Add the user 'webadmin' to the 'www-data' group.
Next, change the group of the files to this group:
chgrp -R www-data files/dirs

Recursively set the group of files/dirs to www-data.
Finally, change the permissions of the directory in question to allow full access to all members of its group:
chmod -R g+rwx files/dirs

Recursively give group members read, write and execute permissions to files/dirs

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to find direction of velocity if there is balanced force? We know that when there is balanced force,there are two results that the system is at rest or moving with constant velocity. So how to find direction of velocity,as forces are equal and opposite .Suppose a ball in a lift is in influence of balance forces.So how we decide it moves upward or download?

A: When the resultant force on a body becomes zero, Newton's 1st Law (the Law of Inertia) applies : the body continues in the state of uniform motion that it had immediately before the resultant force became zero. It continues moving in the same direction with the same speed.


text:
Q: Making tinymce automatically open and get populated when I click on a link? I have a grid containing many records. Each record has some basic information such as an ID and status. What I would like to do is:

*

*When a user clicks an edit HTML icon on a row I would like to
make an ajax call to get data from my database. (I pretty much know
how to do this already)

*I would like to then have tinymce open in
full screen and be populated with the data.

*When the user clicks save on tinymce then I would like to call a function to save my data
and have the tinymce close up.

Has anyone done anything like this? Some pointers would be very much appreciated.


text:
Q: Format a string into regular time not military I am trying to format a string into regular time not military time. How would I do this.
if ([components hour] == 0 &&
        [components minute] == 0 &&
        [components second] == 0){

        result.detailTextLabel.text =
        [NSString stringWithFormat:
         @"%02ld/%02ld/%02ld - %02ld/%02ld/%02ld All Day",
         (long)[components month],
         (long)[components day],
         (long)[components year],
         (long)[components1 month],
         (long)[components1 day],
         (long)[components1 year]];

    } else {
        result.detailTextLabel.text =
        [NSString stringWithFormat:
         @"%02ld/%02ld/%02ld at %02ld:%02ld - %02ld:%02ld",

         (long)[components month],
         (long)[components day],
         (long)[components year],
         (long)[components hour],
         (long)[components minute],
         (long)[components1 hour],
         (long)[components1 minute]];

    }

A: This is the correct way to do it.  It will format the time according to the user's locale and preferences — so in Germany or France it will use 24 hour time, and in the US it will use AM/PM.
NSDateFormatter *fmt = [[NSDateFormatter alloc] init];
[fmt setTimeStyle:NSDateFormatterMediumStyle]; // Full time with seconds, no TZ
[fmt setDateStyle:NSDateFormatterNoStyle]; // No date
NSDate *now = [NSDate dateWithTimeIntervalSinceNow:0];
NSLog(@"%@", [fmt stringFromDate:now]);

If you try to implement date / time formatting yourself, you will only enrage the users that changed their system preferences and those who live in other countries.  Do the right thing, use a library function.

A: NSDateComponents *components = /* ... */;
NSCalendar *calendar = [[[NSCalendar alloc] initWithCalendarIdentifier: NSGregorianCalendar] autorelease];
NSDate *date = [calendar dateFromComponents: components];
NSString *string = [NSDateFormatter localizedStringFromDate: date dateStyle: NSDateFormatterNoStyle timeStyle: NSDateFormatterShortStyle];

This is a lot simpler and it auto-localizes the result string.


text:
Q: Why do objects automatically inherit values from another object initiated before or after? Here Student's class method and variable get affected and present in other object too  i.e. $obj1, why does this happen?
class Student {
    public $name;
    public $age;
    public function callme() {
        return 'called';
    }
}

$obj = new Student();
$obj1 = $obj;
$obj->name = 'David';
$obj->age = 12;
echo '<pre>';
print_r($obj);
print_r($obj1);
echo $obj1->callme();

ouput :
Student Object
(
    [name] => David
    [age] => 12
)
Student Object
(
    [name] => David
    [age] => 12
)
called

A: This behaviour is explained here, when you do the following:
$obj = new Student();
$obj1 = $obj;

$obj1 is actually a reference to $obj so any modifications will be reflected on the original object. If you need a new object, then declare one using the new keyword again (as that's what it's for) as such:
$obj = new Student();
$obj1 = new Student();

(Also, I see @Wizard posted roughly the same thing half way through me writing this but I'll leave this here for sake of examples)

A: As of PHP 5, $obj and $obj1 hold a copy of the object identifier, which points to the same object. Read http://php.net/manual/en/language.oop5.references.php


text:
Q: How to add text watermark on YouTube player iframe in fullscreen mode I'm working on an educational app (something like Udemy) that was built with Flutter. I need to add a text watermark on the YouTube player iframe.
I'm using stack widget to put the text over video player, and it's working fine in normal mode, but I don't know how to do it in fullscreen. Can I do it with stack widget or any other way?

A: You can wrap your watermark Text widget in a Positioned widget and set its position based on the dimensions of the device screen using MediaQuery.
Something like this:
Stack(
  children: [
     ....
    Positioned(
      bottom: MediaQuery.of(context).size.height * 0.1,
      right: MediaQuery.of(context).size.width * 0.1,
      child: Text(
        'Your Watermark',
      ),
    ),
  ],
)

A: try this solution : first wrap your player with stack like this :
   Stack(
                  children: [
                    YoutubePlayer(
                      controller: _controller!,
                      progressColors: const ProgressBarColors(
                        playedColor: Colors.amber,
                        handleColor: Colors.amberAccent,
                      ),
                    ),
                    const WaterMarkWidget(
                      text: "water mark text",
                    )
                  ],
                ),

and here is the WaterMarkWidget :

    import 'dart:async';
import 'dart:math';
import 'package:flutter/material.dart';

class WaterMarkWidget extends StatefulWidget {
  const WaterMarkWidget({super.key, required this.text});
  final String text;

  @override
  State<WaterMarkWidget> createState() => _WaterMarkWidgetState();
}

class _WaterMarkWidgetState extends State<WaterMarkWidget> {
  late Timer timer;
  double topPadding = 0;
  double downPadding = 0;
  int durationTime = 10000;
  @override
  void initState() {
    super.initState();
    WidgetsBinding.instance.addPostFrameCallback((_) {
      timer = Timer.periodic(Duration(milliseconds: durationTime), (__) {
        double w = MediaQuery.of(context).size.width * .3;
        double h = MediaQuery.of(context).size.height * .3;
        topPadding = Random().nextDouble() * h;
        downPadding = Random().nextDouble() * w;
        setState(() {});
      });
    });
  }

  @override
  void dispose() {
    timer.cancel();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Stack(
      children: [
        Positioned(
          top: topPadding,
          left: downPadding,
          child: AnimatedContainer(
            duration: Duration(milliseconds: durationTime),
            padding: EdgeInsets.only(top: topPadding, left: downPadding),
            child: Center(
              child: Text(
                widget.text,
                style: TextStyle(
                  fontSize: 15,
                  fontWeight: FontWeight.bold,
                  color: Colors.black12.withOpacity(.06),
                ),
              ),
            ),
          ),
        ),
      ],
    );
  }
}


text:
Q: Why is my access.log file not accessible? I have an apache installation on my dev machine.  The httpd.conf is all set up right.  By the config file I should be getting an access.log file in my logs directory, but it doesn't seem to exist in the directory.
However if I search for the file in AgentRansack it shows the file as existing and being some 400K in size.  I am running Windows 7 with Apache started manually as a process not a service.
I have:

*

*Set explorer to show system and hidden files

*Tried to open from AgentRansack directly but I get an error, or a blank file.

*Tried Shutting down apache to see if the files appear.

Why cant I access my access.log file?  Is this a know issue.

A: I would suggest that if you have Apache installed to %programfiles% the problem lies with the way Windows handles files created by programs in the %programfiles% directory. In Vista and Windows 7, virtualization is used to save files to the VirtualStore directory (%username%\AppData\Local\VirtualStore) when a program saves them to %programfiles%. This is relatively transparent to the program (Apache in this case), which means that monitoring its file access, shows that it is reading and writing from %programfiles%. (I once used SysInternals Process Monitor to try and track down my missing files - without any success - the only thing that worked was a full drive search).
Navigate to the correct path under VirtualStore (matching the path in Program Files) and you may find your missing file.
More information about VirtualStore is available on Microsoft's site.


text:
Q: Take Snapshot after componentDidMount resolve a promise
*

*A componentDidMount call a store that call the api

*api is a module with export fetchVersionsRequest function

*fetchVersionsRequest call the api endpoint using Promise

*all is updated by store after the promise resolved

*Mobx, via @observer will call component render again because all was updated

Please, check the comments

Home component
@inject('versionStore') @observer
export default class extends Component {
  componentDidMount() {
    const { fetch } = this.props.versionStore;
    fetch(); // Will call api.fetchVersionsRequest
  }

  render() {
    // all is an array updated after call api.fetchVersionsRequest resolved
    const { all } = this.props.versionStore;
    // ...
    return {all.map(it => <p>{it.name}</p>)}
  }
}

How can I test if component is rendering right?
I want to use Snapshot feature, give a list returned by api, the component should be mach the snapshot
My test Home component
it('renders versions', function() {
  const versions = [
    { id: 1, name: 'version1' },
    { id: 2, name: 'version2' },
  ];

  api.fetchVersionsRequest = jest.fn(() => {
    return Promise.resolve(versions);
  });

  const wrapper = shallow(<Home {...this.minProps} />);
  expect(toJson(wrapper)).toMatchSnapshot(); // PROBLEM Snapshot does not contain any p element
}

A: Just to show you how to work with promises in jest. You have to return the promise from your test to let jest know that it have to wait for it.
it('renders versions', function() {
  const versions = [
    { id: 1, name: 'version1' },
    { id: 2, name: 'version2' },
  ];
  const p = Promise.resolve(versions);
  api.fetchVersionsRequest = jest.fn(() => {
    return p
  });

  const wrapper = shallow(<Home {...this.minProps} />);
  return p.then(()=>{
    expect(toJson(wrapper)).toMatchSnapshot();
  })

}

or
it('renders versions', async function() {
  const versions = [
    { id: 1, name: 'version1' },
    { id: 2, name: 'version2' },
  ];
  const p = Promise.resolve(versions);
  api.fetchVersionsRequest = jest.fn(() => {
    return p
  });

  const wrapper = shallow(<Home {...this.minProps} />);
  a
  expect(toJson(wrapper)).toMatchSnapshot();

}

It is explained here in the docs

A: Instead of using jest.fn to mock the data from API. You can test your component by setting the props directly using wrapper.setProps:
const wrapper = shallow(<Home {...this.minProps} />);
wrapper.setProps({
  versionStore: {
    all: versions
  }
});
expect(toJson(wrapper)).toMatchSnapshot();


text:
Q: Getting the position of the largest value in a matrix Say that I have the following matrix in MATLAB:
I=[2 1;4 5];

How can I retrieve the position of the largest element??

A: You can do as follows:
[value, location] = max(I(:));
[row,col] = ind2sub(size(I), location);

>> [row, col]

ans =

     2     2

A: You can get index as follow:
[~, idx] = max(I(:))

and then use it
I(idx)

A: Or you could use find:
[row, col] = find(I == max(I(:)))
row =  2
col =  2


text:
Q: Javascript won't load over network using MAMP? I'm using MAMP for a local website, I have www.mywebsite.dev set up and everything works fine.
But when I try to access by 192.168.0.198 - my comp's IP, it will load the website fine, images, css and all. But it fails to load the javascript. I've checked the paths and all look fine - why would it load everything but JS??
(I need to use the IP to test over the network)
Thanks!

A: Thanks guys for the help, I managed to get it working by clearing the cache in my CMS's navigation section. Turned out one of the elements were not loading in quick enough. Cheers!


text:
Q: clGetDeviceIds returns -1 I'm running Ubuntu Lucid with ATI Radeon Mobility 4800 HD. 3D support works (i.e. OpenGL applications run at normal speed), but when I'm trying to use OpenCL it fails:
#include <CL/opencl.h>
#include <iostream>
#include <cstdlib>

#define CL_SAFE_CALL( call ) {                                                               \
    cl_int err = call; std::cerr << "EC: " << err << std::endl;                              \
    if(CL_SUCCESS != err){                                                                   \
      std::cerr << "Unsuccesful OpenCL call " << __FILE__ << " : " << __LINE__ << std::endl; \
      exit(EXIT_FAILURE);                                                    \
    } }

// OpenCL platform
cl_platform_id platform;

char* getPlatformInfo(cl_platform_id platform, cl_platform_info paramName){
  size_t infoSize = 0;
  CL_SAFE_CALL( clGetPlatformInfo(platform, paramName, 0, NULL, &infoSize) );
  char* info = (char*)malloc(infoSize);
  CL_SAFE_CALL( clGetPlatformInfo(platform, paramName, infoSize, info, NULL) );
  return info;
}

cl_platform_id createPlatform(){
  cl_platform_id platform;

  CL_SAFE_CALL( clGetPlatformIDs(1, &platform, NULL));
  std::cout << getPlatformInfo(platform, CL_PLATFORM_VERSION) << std::endl;
  return platform;
}

// OpenCL devices of the platform
cl_device_id device_id;

void* getDeviceInfo(cl_device_id device_id, cl_device_info paramName){
  size_t infoSize = 0;
  CL_SAFE_CALL( clGetDeviceInfo(device_id, paramName, 0, NULL, &infoSize) );

  char* info = (char*)malloc(infoSize);
  CL_SAFE_CALL( clGetDeviceInfo(device_id, paramName, infoSize, info, NULL) );
  return info;
}

cl_device_id createDevice(cl_platform_id platform, cl_device_type type){
  cl_device_id device_id;

  // THIS IS LINE 44:

  CL_SAFE_CALL( clGetDeviceIDs(platform, type, 1, &device_id, NULL) );

  cl_uint* max_compute_units = (cl_uint*)getDeviceInfo(device_id, CL_DEVICE_MAX_COMPUTE_UNITS);
  std::cout << "Max compute units: " << *max_compute_units << std::endl;

  return device_id;
}

int main(void){
  std::cerr << "createDevice:" << std::endl;
    platform = createPlatform();
  std::cerr << "createDevice:" << std::endl;
  device_id = createDevice(platform, CL_DEVICE_TYPE_GPU);
}

The following:
~$ g++ -o test test.cc -lOpenCL
~$ ./test
createDevice:
EC: 0
EC: 0
EC: 0
OpenCL 1.2 AMD-APP (923.1)
createDevice:
EC: -1
Unsuccesful OpenCL call test.cc : 44

I had libOpenCl from installations and I apt-get opencl-headers.  Any suggestions?

A: An error code of -1 actually means CL_DEVICE_NOT_FOUND (look in the cl.h in your include\CL folder for reference). This might mean several things:

*

*What is your GPU video driver? Check if it does not support OpenCL at all.

*Is your driver up-to-date? Check if you have the latest version.


text:
Q: how do "strip_tags" with domxpath in php I'm working with a domxpath object and want to remove tags in the same way as strip_tags. Eventually I came up with this:
function strip_node(&$node)
{
    $node_list = array();
    foreach ($node->childNodes as $child)
    {
        $node->parentNode->insertBefore($child->cloneNode(true),$node);
    }
    $node->parentNode->removeChild($node);
}

But when I ran a query and tried to remove all the nodes it failed:
$matches = $xPath->query( "//div" );
foreach ($matches as $match)
{
    strip_node($match);
}

This is obviously because $matches is a list of the original nodes, but as I strip them out, and daughter nodes are being replaced with new.
So what can I do to get the functional equivalent of strip_tags?


text:
Q: Reducing the size of a JSON object array by stripping unwanted object attributes One of our end point is returning a JSON object array. Each object in the array has 10 attributes originally. In order to keep the array in state, I'm thinking of rebuilding the JSON array with object with minimum attribute (I need only 2).

*

*Is there an elegant way to do this ES6 (Currently I'm using some loops)

*Whether the reduction in size can gain me in terms of performance (react application and I'm supposed to store the lighter JSON in state)

Thanks,
San

A: Use the array map function, following is a bare minimum (ES6) example,
const data = [
  {foo: 'foo_value_a', bar: 'bar_value_a', baz: 'baz_value_a'},
  {foo: 'foo_value_b', bar: 'bar_value_b', baz: 'baz_value_b'},
  {foo: 'foo_value_c', bar: 'bar_value_c', baz: 'baz_value_c'},
]

const compactData = data.map(({foo, bar}) => ({foo, bar}));

compactData now contains only objects with foo and bar and it reads like this, for each object of data destructure foo and bar and return a new object shaped with just these two properties.
The old school way (ES5) translates to
const compactData = data.map(function(d) {
  return {foo: d.foo, bar: d.bar };
});

Rule of thumb when you have an array of objects and you want the same amount of objects but with different shape you think of map!!!


text:
Q: how to make if there is no file it will do nothing hey so I'm trying to const some JSON
const cidc = require('./cid/cid.json')
const dc = require('./details/cid.json')
const lc = require('./lik/cid.json')
if(!cidc){
return
}else{
 fs.unlinkSync('./src/main/setting/cid/cid.json')
} if(!dc) {
return
}else {
    fs.unlinkSync('./src/main/setting/details/cid.json')
} if (!lc){
return
}else {
 fs.unlinkSync('./src/main/setting/lik/cid.json')
}

so I'm trying to delete the dc file and it error
how can I make if there is no such file named that it will do nothing (aka return nothing)
and if there is a file named that it will const it to a variable

A: Since require throws an error of Error: Cannot find module ... and you don't catch those errors, your script will fail.
You could define a new require-function where you catch the error and return undefined:
function safeRequire(path) {
 try {
   return require(path);
 } catch(err) {
   return undefined;
 }
}

Then use this function in your script:
const cidc = safeRequire('./cid/cid.json')
const dc = safeRequire('./details/cid.json')
const lc = safeRequire('./lik/cid.json')
// rest of your code

Also you can simplify your if/else conditions by inverting the condition:
if (cidc) {
  fs.unlinkSync('./src/main/setting/cid/cid.json')
}
if (dc) {
  fs.unlinkSync('./src/main/setting/details/cid.json')
}
if (lc){
  fs.unlinkSync('./src/main/setting/lik/cid.json')
}

Alternatively you don't even need to use require at all, just check if the files exist using e.g. fs.access(...).

A: You could directly use unlink with try catch without any requires
function unlink(filePath) {
  try {
    fs.unlinkSync(filePath);
  } catch (e) {
    //ignore
  }
}
unlink('./src/main/setting/cid/cid.json')
unlink('./src/main/setting/details/cid.json')
unlink('./src/main/setting/lik/cid.json')


text:
Q: Postman save and lock (prevent editing) request / collection In Postman, once you have created a request or collection and have fine tuned it, is there any way to lock it so as to make it read only so that it can't be accidentally altered?
Obviously I would need something to toggle it back to editable again!
Thanks in advance

A: I don't think there is a option to make a collection read only for admin ( the creator of the collection). Few of the way of avoiding unnecessary changes are:

*

*if you can edit rights of other users within the workspace make
it view only for  selected users inside the workspace.

*Create a fork of the collection so that you revert back

*Create a copy of the collection

*Download collection as json file

Personally i prefere downloading collection as json as this keeps the workspace clean and tidy .
else:
i prefer creating inprogress workspace and final workspace and sharing completed collection to final workspace and deleting it from ingrogress workspace everytime i finish something.
If changes is required , i will work in inprogress workspace by creating a copy


text:
Q: Spark (scala): groupby and aggregate list of values to one list based on index I have the following dataframe:
root
 |-- visitor: string (nullable = true)
 |-- asset: array (nullable = true)
 |    |-- element: string (containsNull = true)

I am trying to groupby list of values that share similar indexes (visitor) to a single list of the original list type (array).
example:
val rawData1 = Seq(("visitor1",Array("item1","item2","item3","item4")),("visitor2",Array("item1","item2","item3")))
val rawData2 = Seq(("visitor1",Array("item1","item2","item5")),("visitor2",Array("item4","item7")))
val df1 = spark.createDataFrame(rawData1).toDF("visitor","asset")
val df2 = spark.createDataFrame(rawData2).toDF("visitor","asset")
val dfJoined = df1.union(df2)
dfJoined.groupBy("visitor").agg(collect_list("asset"))

and what I get is:
visitor collect_list(asset)
visitor2    [WrappedArray(item1, item2, item3), WrappedArray(item4, item7)]
visitor1    [WrappedArray(item1, item2, item3, item4), WrappedArray(item1, item2, item5)]

but I don't want two sublists in the asset column, I would like all values of the two lists to be grouped as one list with the original type (array).
Thanks!

A: One option is to flatten df1 and df2 with explode before combining them, then do the aggregation:
(df1.withColumn("asset", explode($"asset"))
    .union(df2.withColumn("asset", explode($"asset")))
    .groupBy("visitor")
    .agg(collect_list("asset"))
).show(false)

+--------+-------------------------------------------------+
|visitor |collect_list(asset)                              |
+--------+-------------------------------------------------+
|visitor2|[item1, item2, item3, item4, item7]              |
|visitor1|[item1, item2, item3, item4, item1, item2, item5]|
+--------+-------------------------------------------------+


text:
Q: angular materror check dropdown ngmodel object valid Good day,
Normally, I will set the drop down value into a string, for example:
<mat-form-field>
   <mat-select name="searchReloadType2" placeholder="reload to" required #searchReloadType2="ngModel"
      [(ngModel)]="reloadTypeObjStr" >
      <mat-option [value]="rReloadType.key" *ngFor="let rReloadType of reloadTypeList">{{ rReloadType.label }}
       </mat-option>
   </mat-select>
    <mat-error *ngIf="!searchReloadType2.valid">
        reloadTo is required
    </mat-error>
  </mat-form-field>

Where rReloadType.key is a string value from drop down that set to reloadTypeObjStr, and if user click on the drop down list, but didnt select any value, then will show "reloadTo is required" under the drop down there.
I wish to have a dropdown list which is set the value to an object instead of a string, for example:
     <mat-form-field>
       <mat-select name="searchReloadType" placeholder="reload to" required #searchReloadType="ngModel"
          [(ngModel)]="reloadTypeObj" >
          <mat-option [value]="rReloadType" *ngFor="let rReloadType of reloadTypeList">{{ rReloadType.label }}
           </mat-option>
       </mat-select>
        <mat-error *ngIf="!searchReloadType.valid">
            reloadTo is required
        </mat-error>
      </mat-form-field>

where rReloadType is an object (instead of string) from drop down, and set to reloadTypeObj, which is an object. At this point, if user didnt select any value from this drop down, the reloadTo is required wont show, the mat-error does not work at this point.
I would like to ask for advise, is there anything I can do for this? Or angular does not support this? I must use string value instead of object value for drop down?

A: Hope you are doin good.
I tried to reproduce your problem, and it is working fine in both the cases, I don't see any problem here.
https://stackblitz.com/edit/angular-mat-form-field-fbtask?file=app%2Fform-field-prefix-suffix-example.html
Also, I would suggest you to use searchReloadType.errors?.required inside mat-error, instead of !searchReloadType.valid.
So, you can also use errors?.required, errors?.pattern to check the pattern, errors?.minlength and errors?.maxlength, etc.
These would be more useful when you are dealing with variety of inputs.
Peace out.


text:
Q: SQL Server - best way to estimate size of result set of query in MB before returning the data? Given a query that queries multiple tables, is there a way to calculate the size of the result set before returning the full result set?
My best guess so far is to write a query that sums the size of all columns multiplied by row count to get an estimation. Maybe have a metatable that stores the average size of each column for each table, updated by a stored procedure each morning to get the average size (since some columns can be NVARCHAR(MAX))

A: You create a table with query results and run sp_spaceused. Here is my solution. You can refer.
SELECT *
INTO tablename
FROM ...

Exec sp_spaceused 'tablename'

Drop tablename


text:
Q: How to do Java lambda sum on Double not Integer? I have this obscene block of java lambda code that works (it sums a collection of integers, Netbeans IDE wrote it for me....)
Integer  thesum = times.values().stream().filter((val) -> (val != null)).reduce(thesum, Integer::sum);

Now the "times" Map changed to a Map<String,Double>not a Map<String,Integer> like above,
However, simply changing the Integer::sum to Double::sum doesn't work
   Double  thesum = times.values().stream().filter((val) -> (val != null)).reduce(thesum, Double::sum);//does not work

Why is it different with doubles vs integers?
TBH I actually don't care, because this works and IMO is more understandable anyway
 for(double d : times.values()){
          thesum+=d;
 }

But I thought those who enjoy the construction of lambda syntax as a form of human happiness and personal gratification might want to see an answer to this, because it annoyed me almost as much as the general syntax construct itself.
Thanks

A: Aside from the variable 'thesum' not being initialised before use; The code looks fine and compiles & runs as expected in eclipse.
I've added an example below, formatted for clarity
public static void main(String[] args) {
    Map<String,Double> times = new HashMap<>();
    times.put("1", 1.0);
    times.put("2", 2.0);
    times.put("null", null);
    times.put("3", 3.0);
    times.put("4", 4.0);

    Double thesum = 0.0;
    thesum = times.values().stream()
        .filter((val) -> (val != null))
        .reduce(thesum, Double::sum);

    System.out.println(thesum); // 10.0
}

A: The use of reduce here seems awkward. The Stream API includes a DoubleStream which can sum the values directly:
Double sum = times.values().stream().mapToDouble(n -> n).sum();

The mapToDouble is not particularly elegant but it's the easiest way I know to map from a Stream<Double> to a DoubleStream.
Also note that your for loop is not strictly equivalent to the stream version as it does not cope with null values.


text:
Q: Which motherboard manufacture(s) are the most Linux-friendly? I am looking to upgrade my motherboard to support DDR3, USB 3.0, and socket AM3+ CPUs.  I have used Gigabyte and ASRock motherboards without any serious issues.  I have been a fan of AMD for years now and try to stick with them.  Which motherboard manufacture(s) are the most Linux-friendly?

A: I think any manufacturer that supplies Linux drivers are OK.  Personally, I would use Intel or Gigabyte.  If you want complete hardware compatibility with Ubuntu, then you may want to check out the Ubuntu Hardware Support page.

A: ALWAYS do your research on the particular motherboard first. Some people say to use Gigabyte but they had an issue a few years back
Gigabyte, install windows to fix linux
I personally had an issue installing ubuntu 12.04 server on a Gigabyte ga-990fxa-ud3 to which their tech support said to install windows to fix my ethernet problem.
Google the motherboard you want and see if there are any issues. Even if a particular brand is said to be linux friendly, it doesn't matter because you are only getting one motherboard and it needs to work.

A: That is a somwhat subjective question. I normally dont use Linux on my Desktop, but I don't imagine you having problems with any manufacturer, excluding for specific models. Seeing as Asus has a lot of Ubuntu-based netbooks, I'd say they are very Linux-friendly, but if you don't have any issues with both Gigabyte and ASRock, then they should also be ok. But the best way is to search beforehand and get some feedback before buying a new motherboard.

A: I have been doing research on Linux based motherboards. Mostly on sites where people share their stories and problems with linux. The ASUS Z87 plus board is linux friendly. Check out the review on Newegg site.


text:
Q: Python Tkinter piggyback to system bindings I am using TKinter Menu widet, and I want to bind additional keyboard key to system event binded to other keys already. What I mean is when the code snippet bellow is executed a simple menu is shown. When I press the 'Key-F10' the "File" label is highlighted and when I press any of the "Up" or "Down" arrow the menu gets exapnded (posted). This is at least the behaviour on Windows 8 OS.
I want to be able to expand the menu with the "Space" key once its highlighted with the '<Key-F10>', using the functional callback that for the "Up" "Down" keys - sort of piggyback the "Space" to the same binding. However I am not able to find how to do it. My code is shown bellow.
from Tkinter import *
from tkFileDialog import askopenfilename

def popup(event):
   filemenu.post(filemenu.winfo_rootx(), filemenu.winfo_rooty())

root = Tk()
menu = Menu(root)
root.config(menu=menu)
filemenu = Menu(menu)
menu.add_cascade(label="File", menu=filemenu)
filemenu.add_command(label="New")
filemenu.add_command(label="Open...")
filemenu.add_separator()
filemenu.add_command(label="Exit")

root.bind('<Button-3>', popup)
mainloop()

What I was able to find on my own for the print root.bind_all('<Key-F10>') is : tk::WinMenuKey %W %N which leads me to here where the following is defined:
 *--------------------------------------------------------------
 *
 * TkWinMenuKeyObjCmd --
 *
 *  This function is invoked when keys related to pulling down menus is
 *  pressed. The corresponding Windows events are generated and passed to
 *  DefWindowProc if appropriate. This cmd is registered as tk::WinMenuKey
 *  in the interp.
 *
 * Results:
 *  Always returns TCL_OK.
 *
 * Side effects:
 *  The menu system may take over and process user events for menu input.
 *
 *--------------------------------------------------------------

Now how I can do for example root.bind('<Key-Up>', tk::WinMenuKey) to bind the Up key to the same event for pulling the menu. From what I have seen these events do not go through the Tkinter.Menu.post/tk_popup methods.
As an alternative i tried to  Tkinter.Menu.post in my registered callback for Muse button 3 with filemenu.winfo_rootx(), filemenu.winfo_rooty() as x, y coordinates however the menu is always expanded at the upper left part of the screen as shown in the screenshot. The behaviour is the same when I use filemenu.winfo_x(), filemenu.winfo_y().


text:
Q: How to send a local file using Twilio? Twilio's API provides a way of sending attachments or media in a text message using the media_url parameter. However it looks like media_url has to be a file hosted on an HTTP server. It breaks when you try to send it a local URI.
While I could just host the file I want to send publicly on the server, sometimes this file could be dynamic.
Is there a way to send the file contents through the API, or will I have to create some unique file in the public dir of my site and then use that for the media url?


text:
Q: java.lang.ClassNotFoundException: kafka.api.OffsetRequest I am getting error java.lang.ClassNotFoundException kafka.api.OffsetRequest while trying integrate Kafka to our Storm topology.
What versions you are running and it is working?
My pom.xml
  <dependency>
        <groupId>org.apache.storm</groupId>
        <artifactId>storm-core</artifactId>
        <version>0.9.2-incubating</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.storm</groupId>
        <artifactId>storm-kafka</artifactId>
        <version>0.9.2-incubating</version>
    </dependency>

A: Finally I solved it by implementing my own Kafka SPOUT (reusing example code) with this dependencies:
    <dependency>
        <groupId>org.apache.storm</groupId>
        <artifactId>storm-core</artifactId>
        <version>0.9.4</version>
    </dependency>
    <dependency>
        <groupId>org.apache.kafka</groupId>
        <artifactId>kafka_2.9.2</artifactId>
        <version>0.8.1.1</version>
        <scope>compile</scope>
        <exclusions>
            <exclusion>
                <artifactId>jmxri</artifactId>
                <groupId>com.sun.jmx</groupId>
            </exclusion>
            <exclusion>
                <artifactId>jms</artifactId>
                <groupId>javax.jms</groupId>
            </exclusion>
            <exclusion>
                <artifactId>jmxtools</artifactId>
                <groupId>com.sun.jdmk</groupId>
            </exclusion>
        </exclusions>
    </dependency>

A: I can successfully use kafka.api.OffsetRequest with the following sample topology (KafkaSpoutTestTopology) in a Docker cluster:
https://github.com/wurstmeister/storm-kafka-0.8-plus-test
The topology uses storm-kafka version 0.9.3.
Note: "fig" command is replaced with "docker-compose" command.
EarliestTime() and LatestTime() method work fine.


text:
Q: How to Change select value using PhantomJS I made a scraper using PhantomJS inside node (Node Module).
I am trying to get data from a table on the page (url).
When the page loads it only displays 25 records of the table. There is a 'select' at the bottom that you can change to 'All' to see all records. How can i change the value of the select to 'All' before getting the HTML returned?
var phantom = require('phantom');

phantom.create().then(function(ph){
    ph.createPage().then(function(page){
        page.open(url).then(function(status){
            console.log(status);

            page.property('content').then(function(content){
                console.log(content);

                page.close();
                ph.exit();
            });
        });
    });
});

<select name="qs-rankings_length" aria-controls="qs-rankings" class="jcf-hidden">
    <option value="100">100</option>
    <option value="200">200</option>
    <option value="-1">All</option>
</select>

A: This is how I do it.
page.evaluate(function() {
    $('#select_element_selector').val('All').change();
});

I'm assuming that you have jQuery on the page.
Or, without jQuery:
page.evaluate(function() {
    document.getElementById('select').selectedIndex = 0;
    // or use document.getElementById('select').value = 'All';
}


text:
Q: How to input a 2-D array directly in C with negative values, spaces and newline I want to directly input a 2-D Array in C, separated just by single spaces and newlines. At the same time I also want to verify whether the user is entering a valid single digit integer (either positive or negative).
I tried the following.
int A[3][3];
    int i,j;
    for(i=0;i<3;i++)
    {
        for(j=0;j<3;j++)
            scanf("%d",&A[i][j]);
    }
    for(i=0;i<3;i++)
    {
        for(j=0;j<3;j++)
            printf("%d ",A[i][j]);
        printf("\n");
    }

But I want 2 things in this:-

*

*Input that is first verified whether its a single digit integer or not.

*Not works merely for positive integers and 0 but also for negative integers.

eg.
input such as the following should be accepted and stored in 2-d array
1 2 -3 4
-5 1 2 -6
1 1 2 3

I'm sorry if I wasn't clear. An important component is that the input should be confirmed whether its integer or not i.e. the input should be either as char or string and if it is an integer  (which can be ascertained by functions such as isdigit() , then it should be converted to an integer value.
This following code chunk works for single positive values
char c = getchar();
  if (isdigit(c))
     int value = c - '0';

However, I don't know how to enable this functionality for negative integers in a complete 2D array input.

A: If you want to verify that a number is a single digit, just check if its between -9 and 9.
As for negative numbers, im pretty sure the %d modifier for the scanf captures that.
Please comment down below if the answer is incorrect so i could fix it :)
Edit: i forgot to note that scanf returns the number of read elements. so comparing this against 1 (since you read one element at a time) will allow you to know if the input was partial or not.
something like this:
if (scanf(" %d", &A[i][j]) != 1){
   //here goes the code for when the input is partial
}

should do the trick

A: So first, tell the user to enter values row-wise or column-wise. In this case, ask like this

printf("Enter integers row-wise");

Now the user will enter values.
After scanning those values put an if statement to verify that value is greater than or equal to -9 and less than 9. If value is within the range continue; else put a exit(1); statement and tell the user that entered value is incorrect. Like this:
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int A[3][3];
    int i, j;
    for( i = 0; i < 3; i++ )
    {
        for( j = 0; j < 3; j++)
        {
            scanf("%d", &A[i][j]);
            if(A[i][j] >= -9 && A[i][j] <= 9)
                continue;
            else
            {
                printf("Enter correct values.\n");
                exit(1);
            }
        }
    }

    for(i=0;i<3;i++)
    {
        for(j=0;j<3;j++)
            printf("%d ",A[i][j]);
        printf("\n");
    }
    return 0;
}


text:
Q: What is wrong with this attempt to crop an image with ImageMagick's convert utility? I am trying to make a tool that will, in imitation of responsive design on the web, make iPhone / iPad wallpapers by taking the largest centered crop-to-device-dimensions it can, and programmatically be available.
I have an original image in landscape, and commands, one per output wallpaper, like:
convert background.png -resize 320x480 -crop 320x480+0+0 background-320x480.png

However, after the conversion, background-320x480.png's dimensions are 320x239, and all of the generated images have the same aspect ratio, notwithstanding that they are intended to cover portrait and landscape resolutions across iPhones and iPads.
The same dimensions appear if I replace the first 480 with a number in the thousands.
What is appropriate use of ImageMagick's convert to shrink a master wallpaper down to the minimum dimensions that will enclose a wallpaper dimension (preserving aspect ratio), and then crop the center of the shrunken master to wallpaper dimensions and preferably center it? Let's say my original is 1600x1200 and I am trying to make a 320x480 wallpaper.
Thanks,

A: *

*1600x1200 ==(40%)==> 640x480

*crop from the center so the top left corner is moved from (0,0) to (160,0).

Try convert original.png -resize 40% -crop 320x480+160+0 reduced.png.


text:
Q: Disable automatic header file renaming in Eclipse CDT Is there a way to disable this feature in Eclipse CDT Luna?
https://wiki.eclipse.org/CDT/User/NewIn85#Header_File_Rename
I do not want my #include statements being replaced with relative paths as that is against my companies code style.
Example:
Before moving a header file:
#include <File.h>

After:
#include "../dir1/File.h"

Is there some setting which will disable this refactoring?

A: The header/include management is controlled through a set of options in the Preferences: C/C++ -> Code Style -> Organize Includes:


text:
Q: Insertar una tabla deserdonada en otra en t-sql tengo una tabla (tabla1) que quiero desordenarla y insertar la en otra tabla (tabla6), lo hecho de esta forma: con el select into:
select * into tabla6 from (select * from tabla1 order by newid());

pero me da este error

La cláusula ORDER BY no es válida en vistas, funciones insertadas,
tablas derivadas, subconsultas ni expresiones de tabla común, salvo
que se especifique también TOP, OFFSET o FOR XML.

A: La única forma que encontré para  que meta los registros desordenados, es esta opción.
Dado que no deja incluir el order en la subconsulta, entonces obtengo la cantidad de los ítems que están en mi tabla1 y meto ese valor en el top de mi subconsulta.
declare @top as integer = (select count(1) from tabla1 )

drop table if exists tabla6
select *
into tabla6
from (
    select TOP (@top) * from tabla1  order by newid()
) x

SELECT * FROM tabla6


text:
Q: Not able to load image using context root in java dynamic project I am developing project in java and there is a requirement to load logo or image but could not able to load from jsp. I have placed images in all possible places like under webcontent , WEB-INF but no luck to load but from a https url i am able to load images . I need a help to load images through context root . Please help on this .
Project structure
Web.xml
JSP/HTML code


text:
Q: asp.net mvc on asp.net 2.0 + ajax extensions 1.0 + iis 6 on win 2k3 server I have a lot of problems with url rewrite and ajax extensions 1.0 on a asp.net 2.0 web application.
I am considering using asp.net mvc.
Does it work for me since i am using asp.net 2.0, ajax extensions 1.0 + ajax control toolkit, iis 6 on a win2k3 server?
My development machine is windows vista with iis 7
Please advise.
Thank you.

A: mvc needs the 3.5 framework
"ASP.NET MVC 1.0 provides a new Model-View-Controller (MVC) framework on top of the existing ASP.NET 3.5 runtime."
http://www.microsoft.com/downloads/details.aspx?FamilyID=53289097-73ce-43bf-b6a6-35e00103cb4b&displaylang=en

A: In the blog http://alejandrovidalquiroga.blogspot.com/ there is an partial implementation of ASP.NET MVC for ASP.NET 2.0.


text:
Q: Next JS build fails when running 'next build' ~ Can't resolve next.js When running 'next build' I get the following error and I can't for the life of me figure out what's happening.
info  - Creating an optimized production build
Failed to compile.

ModuleNotFoundError: Module not found: Error: Can't resolve './C:/Users/Rob/AppData/Roaming/npm/node_modules/next/dist/client/next.js' in 'D:\wlc-landscapes'

> Build error occurred
Error: > Build failed because of webpack errors
    at C:\Users\Rob\AppData\Roaming\npm\node_modules\next\dist\build\index.js:15:924
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Span.traceAsyncFn (C:\Users\Rob\AppData\Roaming\npm\node_modules\next\dist\telemetry\trace\trace.js:6:584)
PS D:\wlc-landscapes>

I've tried deleting the .next, node_modules, package-lock.json, next global install and then re-installing everything and it still fails. Even when creating a brand new Next JS app and simply trying to build it I get the same error.
When deploying via Netlify it seems to build fine so it looks like this issue is local to my machine. Thanks in advance.


text:
Q: Eror while installing usb-detection module of node js in Raspberry pi Hello all i am installing usb-detection in raspberry pi but when i am running the respect cmd
       "npm install usb-detection" follwoing error comes
    usb-detection@1.3.0 install /home/pi/node_modules/usb-detection

node-gyp rebuild

make: Entering directory '/home/pi/node_modules/usb-detection/build'
  CXX(target) Release/obj.target/detection/src/detection.o
In file included from ../src/detection.h:13:0,
                 from ../src/detection.cpp:1:
../node_modules/nan/nan.h:41:3: error: #error This version of node/NAN/v8 requires a C++11 compiler
In file included from /home/pi/.node-gyp/4.2.1/include/node/node.h:42:0,
                 from ../src/detection.h:5,
                 from ../src/detection.cpp:1:
/home/pi/.node-gyp/4.2.1/include/node/v8.h:336:1: error: expected unqualified-id before 'using'
/home/pi/.node-gyp/4.2.1/include/node/v8.h:469:1: error: expected unqualified-id before 'using'
/home/pi/.node-gyp/4.2.1/include/node/v8.h:852:1: error: expected unqualified-id before 'using'
In file included from ../node_modules/nan/nan.h:194:0,
                 from ../src/detection.h:13,
                 from ../src/detection.cpp:1:
../node_modules/nan/nan_maybe_43_inl.h:13:1: error: expected unqualified-id before 'using'
../node_modules/nan/nan_maybe_43_inl.h:16:1: error: expected unqualified-id before 'using'
../node_modules/nan/nan_maybe_43_inl.h:19:12: error: 'Maybe' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:24:12: error: 'Maybe' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:31:1: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:36:1: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:41:1: error: 'Maybe' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:46:1: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:51:1: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:59:1: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:64:12: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:69:12: error: 'Maybe' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:76:12: error: 'Maybe' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:83:12: error: 'Maybe' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:91:12: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:98:1: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:108:12: error: 'Maybe' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:114:12: error: 'Maybe' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:118:12: error: 'Maybe' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:125:1: error: 'Maybe' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:130:1: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:135:1: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:139:12: error: 'Maybe' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:145:12: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:150:12: error: 'Maybe' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:156:12: error: 'Maybe' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:162:12: error: 'Maybe' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:168:12: error: 'Maybe' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:174:12: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:180:12: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:186:12: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:194:12: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:201:1: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:205:12: error: 'Maybe' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:209:12: error: 'Maybe' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:213:12: error: 'Maybe' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:217:12: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan_maybe_43_inl.h:223:12: error: 'MaybeLocal' does not name a type
In file included from ../node_modules/nan/nan.h:199:0,
                 from ../src/detection.h:13,
                 from ../src/detection.cpp:1:
../node_modules/nan/nan_converters.h:14:11: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan_converters.h:16:56: error: 'Maybe' does not name a type
../node_modules/nan/nan_converters.h:26:1: error: 'return_t' does not name a type
../node_modules/nan/nan_converters.h:27:1: error: 'return_t' does not name a type
../node_modules/nan/nan_converters.h:28:1: error: 'return_t' does not name a type
../node_modules/nan/nan_converters.h:29:1: error: 'return_t' does not name a type
../node_modules/nan/nan_converters.h:30:1: error: 'return_t' does not name a type
../node_modules/nan/nan_converters.h:31:1: error: 'return_t' does not name a type
../node_modules/nan/nan_converters.h:32:1: error: 'return_t' does not name a type
../node_modules/nan/nan_converters.h:42:1: error: 'return_t' does not name a type
../node_modules/nan/nan_converters.h:43:1: error: 'return_t' does not name a type
../node_modules/nan/nan_converters.h:44:1: error: 'return_t' does not name a type
../node_modules/nan/nan_converters.h:45:1: error: 'return_t' does not name a type
../node_modules/nan/nan_converters.h:46:1: error: 'return_t' does not name a type
In file included from ../node_modules/nan/nan_converters.h:59:0,
                 from ../node_modules/nan/nan.h:199,
                 from ../src/detection.h:13,
                 from ../src/detection.cpp:1:
../node_modules/nan/nan_converters_43_inl.h:18:1: error: 'return_t' in 'struct Nan::imp::ToFactory<v8::Boolean>' does not name a type
../node_modules/nan/nan_converters_43_inl.h:19:1: error: 'return_t' in 'struct Nan::imp::ToFactory<v8::Number>' does not name a type
../node_modules/nan/nan_converters_43_inl.h:20:1: error: 'return_t' in 'struct Nan::imp::ToFactory<v8::String>' does not name a type
../node_modules/nan/nan_converters_43_inl.h:21:1: error: 'return_t' in 'struct Nan::imp::ToFactory<v8::Object>' does not name a type
../node_modules/nan/nan_converters_43_inl.h:22:1: error: 'return_t' in 'struct Nan::imp::ToFactory<v8::Integer>' does not name a type
../node_modules/nan/nan_converters_43_inl.h:23:1: error: 'return_t' in 'struct Nan::imp::ToFactory<v8::Uint32>' does not name a type
../node_modules/nan/nan_converters_43_inl.h:24:1: error: 'return_t' in 'struct Nan::imp::ToFactory<v8::Int32>' does not name a type
../node_modules/nan/nan_converters_43_inl.h:34:1: error: 'return_t' in 'struct Nan::imp::ToFactory<bool>' does not name a type
../node_modules/nan/nan_converters_43_inl.h:35:1: error: 'return_t' in 'struct Nan::imp::ToFactory<double>' does not name a type
../node_modules/nan/nan_converters_43_inl.h:36:1: error: 'return_t' in 'struct Nan::imp::ToFactory<long long int>' does not name a type
../node_modules/nan/nan_converters_43_inl.h:37:1: error: 'return_t' in 'struct Nan::imp::ToFactory<unsigned int>' does not name a type
../node_modules/nan/nan_converters_43_inl.h:38:1: error: 'return_t' in 'struct Nan::imp::ToFactory<int>' does not name a type
In file included from ../node_modules/nan/nan.h:200:0,
                 from ../src/detection.h:13,
                 from ../src/detection.cpp:1:
../node_modules/nan/nan_new.h: In function 'v8::Local<T> Nan::imp::To(v8::Local<v8::Integer>) [with T = v8::Integer]':
../node_modules/nan/nan_new.h:21:32: error: no matching function for call to 'To(v8::Local<v8::Integer>&)'
../node_modules/nan/nan_new.h:21:32: note: candidate is:
../node_modules/nan/nan_converters.h:53:38: note: template<class T> typename Nan::imp::ToFactory::return_t Nan::To(v8::Local<v8::Value>)
../node_modules/nan/nan_new.h: In function 'v8::Local<T> Nan::imp::To(v8::Local<v8::Integer>) [with T = v8::Int32]':
../node_modules/nan/nan_new.h:28:30: error: no matching function for call to 'To(v8::Local<v8::Integer>&)'
../node_modules/nan/nan_new.h:28:30: note: candidate is:
../node_modules/nan/nan_converters.h:53:38: note: template<class T> typename Nan::imp::ToFactory::return_t Nan::To(v8::Local<v8::Value>)
../node_modules/nan/nan_new.h: In function 'v8::Local<T> Nan::imp::To(v8::Local<v8::Integer>) [with T = v8::Uint32]':
../node_modules/nan/nan_new.h:35:31: error: no matching function for call to 'To(v8::Local<v8::Integer>&)'
../node_modules/nan/nan_new.h:35:31: note: candidate is:
../node_modules/nan/nan_converters.h:53:38: note: template<class T> typename Nan::imp::ToFactory::return_t Nan::To(v8::Local<v8::Value>)
../node_modules/nan/nan_new.h: At global scope:
../node_modules/nan/nan_new.h:43:11: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan_new.h:75:17: error: 'return_t' does not name a type
../node_modules/nan/nan_new.h:141:17: error: 'return_t' does not name a type
../node_modules/nan/nan_new.h:147:17: error: 'return_t' does not name a type
../node_modules/nan/nan_new.h:148:17: error: 'return_t' does not name a type
../node_modules/nan/nan_new.h:160:17: error: 'return_t' does not name a type
../node_modules/nan/nan_new.h:161:17: error: 'return_t' does not name a type
../node_modules/nan/nan_new.h:162:17: error: 'return_t' does not name a type
../node_modules/nan/nan_new.h:163:17: error: 'return_t' does not name a type
../node_modules/nan/nan_new.h:165:17: error: 'return_t' does not name a type
../node_modules/nan/nan_new.h:166:17: error: 'return_t' does not name a type
../node_modules/nan/nan_new.h:182:17: error: 'return_t' does not name a type
../node_modules/nan/nan_new.h:183:17: error: 'return_t' does not name a type
In file included from ../node_modules/nan/nan_new.h:189:0,
                 from ../node_modules/nan/nan.h:200,
                 from ../src/detection.h:13,
                 from ../src/detection.cpp:1:
../node_modules/nan/nan_implementation_12_inl.h:56:1: error: 'return_t' in 'struct Nan::imp::Factory<v8::Date>' does not name a type
../node_modules/nan/nan_implementation_12_inl.h: In static member function 'static Nan::imp::FactoryBase<v8::Function>::return_t Nan::imp::Factory<v8::Function>::New(Nan::FunctionCallback, v8::Local<v8::Value>)':
../node_modules/nan/nan_implementation_12_inl.h:90:46: error: 'NewInstance' was not declared in this scope
../node_modules/nan/nan_implementation_12_inl.h: In static member function 'static Nan::imp::FactoryBase<v8::FunctionTemplate>::return_t Nan::imp::Factory<v8::FunctionTemplate>::New(Nan::FunctionCallback, v8::Local<v8::Value>, v8::Local<v8::Signature>)':
../node_modules/nan/nan_implementation_12_inl.h:118:48: error: 'NewInstance' was not declared in this scope
../node_modules/nan/nan_implementation_12_inl.h: At global scope:
../node_modules/nan/nan_implementation_12_inl.h:197:1: error: 'return_t' in 'struct Nan::imp::Factory<v8::RegExp>' does not name a type
../node_modules/nan/nan_implementation_12_inl.h:216:1: error: 'return_t' in 'struct Nan::imp::Factory<v8::Script>' does not name a type
../node_modules/nan/nan_implementation_12_inl.h:222:1: error: 'return_t' in 'struct Nan::imp::Factory<v8::Script>' does not name a type
../node_modules/nan/nan_implementation_12_inl.h:254:1: error: 'return_t' in 'struct Nan::imp::Factory<v8::String>' does not name a type
../node_modules/nan/nan_implementation_12_inl.h:262:1: error: 'return_t' in 'struct Nan::imp::Factory<v8::String>' does not name a type
../node_modules/nan/nan_implementation_12_inl.h:268:1: error: 'return_t' in 'struct Nan::imp::Factory<v8::String>' does not name a type
../node_modules/nan/nan_implementation_12_inl.h:275:1: error: 'return_t' in 'struct Nan::imp::Factory<v8::String>' does not name a type
../node_modules/nan/nan_implementation_12_inl.h:281:1: error: 'return_t' in 'struct Nan::imp::Factory<v8::String>' does not name a type
../node_modules/nan/nan_implementation_12_inl.h:286:1: error: 'return_t' in 'struct Nan::imp::Factory<v8::String>' does not name a type
../node_modules/nan/nan_implementation_12_inl.h:347:1: error: 'return_t' in 'struct Nan::imp::Factory<v8::UnboundScript>' does not name a type
../node_modules/nan/nan_implementation_12_inl.h:354:1: error: 'return_t' in 'struct Nan::imp::Factory<v8::UnboundScript>' does not name a type
In file included from ../node_modules/nan/nan.h:200:0,
                 from ../src/detection.h:13,
                 from ../src/detection.cpp:1:
../node_modules/nan/nan_new.h:293:1: error: 'return_t' in 'struct Nan::imp::Factory<v8::String>' does not name a type
../node_modules/nan/nan_new.h:299:1: error: 'return_t' in 'struct Nan::imp::Factory<v8::String>' does not name a type
../node_modules/nan/nan_new.h:305:1: error: 'return_t' in 'struct Nan::imp::Factory<v8::String>' does not name a type
../node_modules/nan/nan_new.h:311:1: error: 'return_t' in 'struct Nan::imp::Factory<v8::String>' does not name a type
../node_modules/nan/nan_new.h:317:1: error: 'return_t' in 'struct Nan::imp::Factory<v8::String>' does not name a type
../node_modules/nan/nan_new.h:323:1: error: 'return_t' in 'struct Nan::imp::Factory<v8::String>' does not name a type
../node_modules/nan/nan_new.h:329:1: error: 'return_t' in 'struct Nan::imp::Factory<v8::String>' does not name a type
../node_modules/nan/nan_new.h:335:1: error: 'return_t' in 'struct Nan::imp::Factory<v8::RegExp>' does not name a type
In file included from ../src/detection.h:13:0,
                 from ../src/detection.cpp:1:
../node_modules/nan/nan.h: In function 'v8::Local<v8::Value> Nan::Error(const char*)':
../node_modules/nan/nan.h:659:3: error: 'Nan::imp::FactoryBase<v8::Boolean>::return_t' has no member named 'ToLocalChecked'
../node_modules/nan/nan.h: In function 'void Nan::ThrowError(const char*)':
../node_modules/nan/nan.h:659:3: error: 'Nan::imp::FactoryBase<v8::Boolean>::return_t' has no member named 'ToLocalChecked'
../node_modules/nan/nan.h: In function 'v8::Local<v8::Value> Nan::RangeError(const char*)':
../node_modules/nan/nan.h:660:3: error: 'Nan::imp::FactoryBase<v8::Boolean>::return_t' has no member named 'ToLocalChecked'
../node_modules/nan/nan.h: In function 'void Nan::ThrowRangeError(const char*)':
../node_modules/nan/nan.h:660:3: error: 'Nan::imp::FactoryBase<v8::Boolean>::return_t' has no member named 'ToLocalChecked'
../node_modules/nan/nan.h: In function 'v8::Local<v8::Value> Nan::ReferenceError(const char*)':
../node_modules/nan/nan.h:661:3: error: 'Nan::imp::FactoryBase<v8::Boolean>::return_t' has no member named 'ToLocalChecked'
../node_modules/nan/nan.h: In function 'void Nan::ThrowReferenceError(const char*)':
../node_modules/nan/nan.h:661:3: error: 'Nan::imp::FactoryBase<v8::Boolean>::return_t' has no member named 'ToLocalChecked'
../node_modules/nan/nan.h: In function 'v8::Local<v8::Value> Nan::SyntaxError(const char*)':
../node_modules/nan/nan.h:662:3: error: 'Nan::imp::FactoryBase<v8::Boolean>::return_t' has no member named 'ToLocalChecked'
../node_modules/nan/nan.h: In function 'void Nan::ThrowSyntaxError(const char*)':
../node_modules/nan/nan.h:662:3: error: 'Nan::imp::FactoryBase<v8::Boolean>::return_t' has no member named 'ToLocalChecked'
../node_modules/nan/nan.h: In function 'v8::Local<v8::Value> Nan::TypeError(const char*)':
../node_modules/nan/nan.h:663:3: error: 'Nan::imp::FactoryBase<v8::Boolean>::return_t' has no member named 'ToLocalChecked'
../node_modules/nan/nan.h: In function 'void Nan::ThrowTypeError(const char*)':
../node_modules/nan/nan.h:663:3: error: 'Nan::imp::FactoryBase<v8::Boolean>::return_t' has no member named 'ToLocalChecked'
../node_modules/nan/nan.h: At global scope:
../node_modules/nan/nan.h:671:14: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan.h:693:14: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan.h:709:14: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan.h:722:14: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan.h:739:14: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan.h:745:14: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan.h:753:14: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan.h:760:14: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan.h:766:14: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan.h: In member function 'void Nan::Callback::SetFunction(const v8::Local<v8::Function>&)':
../node_modules/nan/nan.h:1402:40: error: 'Set' was not declared in this scope
../node_modules/nan/nan.h:1402:40: note: suggested alternative:
/home/pi/.node-gyp/4.2.1/include/node/v8.h:3021:17: note:   'v8::Set'
../node_modules/nan/nan.h: In member function 'void Nan::AsyncWorker::SaveToPersistent(const char*, const v8::Local<v8::Value>&)':
../node_modules/nan/nan.h:1524:41: error: 'Nan::imp::FactoryBase<v8::Boolean>::return_t' has no member named 'ToLocalChecked'
../node_modules/nan/nan.h: In member function 'v8::Local<v8::Value> Nan::AsyncWorker::GetFromPersistent(const char*) const':
../node_modules/nan/nan.h:1542:45: error: 'Nan::imp::FactoryBase<v8::Boolean>::return_t' has no member named 'ToLocalChecked'
../node_modules/nan/nan.h: In member function 'virtual void Nan::AsyncWorker::HandleErrorCallback()':
../node_modules/nan/nan.h:1576:58: error: no matching function for call to 'New(const char*)'
../node_modules/nan/nan.h:1576:58: note: candidates are:
../node_modules/nan/nan_implementation_12_inl.h:390:21: note: template<class T, class M> v8::Local<T> Nan::New(const v8::Persistent<S, M>&)
../node_modules/nan/nan_implementation_12_inl.h:395:21: note: template<class T, class M> v8::Local<T> Nan::New(const Nan::Persistent<T, M>&)
../node_modules/nan/nan_implementation_12_inl.h:400:21: note: template<class T> v8::Local<T> Nan::New(const Nan::Global<T>&)
../node_modules/nan/nan_new.h:201:1: note: template<class T> typename Nan::imp::Factory::return_t Nan::New()
../node_modules/nan/nan_new.h:207:1: note: template<class T, class A0> typename Nan::imp::Factory<T>::return_t Nan::New(A0)
../node_modules/nan/nan_new.h:213:1: note: template<class T, class A0, class A1> typename Nan::imp::Factory<T>::return_t Nan::New(A0, A1)
../node_modules/nan/nan_new.h:219:1: note: template<class T, class A0, class A1, class A2> typename Nan::imp::Factory<T>::return_t Nan::New(A0, A1, A2)
../node_modules/nan/nan_new.h:225:1: note: template<class T, class A0, class A1, class A2, class A3> typename Nan::imp::Factory<T>::return_t Nan::New(A0, A1, A2, A3)
../node_modules/nan/nan_new.h:237:1: note: template<class T> typename Nan::imp::Factory::return_t Nan::New(Nan::FunctionCallback, v8::Local<v8::Value>)
../node_modules/nan/nan_new.h:245:1: note: template<class T, class A2> typename Nan::imp::Factory<T>::return_t Nan::New(Nan::FunctionCallback, v8::Local<v8::Value>, A2)
../node_modules/nan/nan.h: In function 'void Nan::SetMethod(const T&, const char*, Nan::FunctionCallback)':
../node_modules/nan/nan.h:1865:16: error: there are no arguments to 'GetFunction' that depend on a template parameter, so a declaration of 'GetFunction' must be available [-fpermissive]
../node_modules/nan/nan.h:1865:16: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
../node_modules/nan/nan.h:1866:45: error: 'Nan::imp::FactoryBase<v8::Boolean>::return_t' has no member named 'ToLocalChecked'
../node_modules/nan/nan.h: In function 'void Nan::SetPrototypeMethod(v8::Local<v8::FunctionTemplate>, const char*, Nan::FunctionCallback)':
../node_modules/nan/nan.h:1878:32: error: 'GetFunction' was not declared in this scope
../node_modules/nan/nan.h:1879:45: error: 'Nan::imp::FactoryBase<v8::Boolean>::return_t' has no member named 'ToLocalChecked'
../node_modules/nan/nan.h: In function 'void Nan::SetAccessor(v8::Local<v8::ObjectTemplate>, v8::Local<v8::String>, Nan::GetterCallback, Nan::SetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, Nan::imp::Sig)':
../node_modules/nan/nan.h:1904:47: error: 'NewInstance' was not declared in this scope
../node_modules/nan/nan.h: In function 'bool Nan::SetAccessor(v8::Local<v8::Object>, v8::Local<v8::String>, Nan::GetterCallback, Nan::SetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute)':
../node_modules/nan/nan.h:1947:51: error: 'NewInstance' was not declared in this scope
../node_modules/nan/nan.h: In function 'void Nan::SetNamedPropertyHandler(v8::Local<v8::ObjectTemplate>, Nan::PropertyGetterCallback, Nan::PropertySetterCallback, Nan::PropertyQueryCallback, Nan::PropertyDeleterCallback, Nan::PropertyEnumeratorCallback, v8::Local<v8::Value>)':
../node_modules/nan/nan.h:1995:47: error: 'NewInstance' was not declared in this scope
../node_modules/nan/nan.h: In function 'void Nan::SetIndexedPropertyHandler(v8::Local<v8::ObjectTemplate>, Nan::IndexGetterCallback, Nan::IndexSetterCallback, Nan::IndexQueryCallback, Nan::IndexDeleterCallback, Nan::IndexEnumeratorCallback, v8::Local<v8::Value>)':
../node_modules/nan/nan.h:2065:47: error: 'NewInstance' was not declared in this scope
../node_modules/nan/nan.h: In function 'void Nan::SetCallHandler(v8::Local<v8::FunctionTemplate>, Nan::FunctionCallback, v8::Local<v8::Value>)':
../node_modules/nan/nan.h:2120:47: error: 'NewInstance' was not declared in this scope
../node_modules/nan/nan.h: In function 'void Nan::SetCallAsFunctionHandler(v8::Local<v8::ObjectTemplate>, Nan::FunctionCallback, v8::Local<v8::Value>)':
../node_modules/nan/nan.h:2142:47: error: 'NewInstance' was not declared in this scope
In file included from ../src/detection.h:13:0,
                 from ../src/detection.cpp:1:
../node_modules/nan/nan.h: In function 'void Nan::Export(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE, const char*, Nan::FunctionCallback)':
../node_modules/nan/nan.h:2169:35: error: no matching function for call to 'New(const char*&)'
../node_modules/nan/nan.h:2169:35: note: candidates are:
../node_modules/nan/nan_implementation_12_inl.h:390:21: note: template<class T, class M> v8::Local<T> Nan::New(const v8::Persistent<S, M>&)
../node_modules/nan/nan_implementation_12_inl.h:395:21: note: template<class T, class M> v8::Local<T> Nan::New(const Nan::Persistent<T, M>&)
../node_modules/nan/nan_implementation_12_inl.h:400:21: note: template<class T> v8::Local<T> Nan::New(const Nan::Global<T>&)
../node_modules/nan/nan_new.h:201:1: note: template<class T> typename Nan::imp::Factory::return_t Nan::New()
../node_modules/nan/nan_new.h:207:1: note: template<class T, class A0> typename Nan::imp::Factory<T>::return_t Nan::New(A0)
../node_modules/nan/nan_new.h:213:1: note: template<class T, class A0, class A1> typename Nan::imp::Factory<T>::return_t Nan::New(A0, A1)
../node_modules/nan/nan_new.h:219:1: note: template<class T, class A0, class A1, class A2> typename Nan::imp::Factory<T>::return_t Nan::New(A0, A1, A2)
../node_modules/nan/nan_new.h:225:1: note: template<class T, class A0, class A1, class A2, class A3> typename Nan::imp::Factory<T>::return_t Nan::New(A0, A1, A2, A3)
../node_modules/nan/nan_new.h:237:1: note: template<class T> typename Nan::imp::Factory::return_t Nan::New(Nan::FunctionCallback, v8::Local<v8::Value>)
../node_modules/nan/nan_new.h:245:1: note: template<class T, class A2> typename Nan::imp::Factory<T>::return_t Nan::New(Nan::FunctionCallback, v8::Local<v8::Value>, A2)
../node_modules/nan/nan.h:2170:47: error: 'GetFunction' was not declared in this scope
../node_modules/nan/nan.h:2170:65: error: 'Set' was not declared in this scope
../node_modules/nan/nan.h:2170:65: note: suggested alternative:
/home/pi/.node-gyp/4.2.1/include/node/v8.h:3021:17: note:   'v8::Set'
../node_modules/nan/nan.h: In constructor 'Nan::Tap::Tap(v8::Local<v8::Value>)':
../node_modules/nan/nan.h:2177:30: error: no matching function for call to 'To(v8::Local<v8::Value>&)'
../node_modules/nan/nan.h:2177:30: note: candidate is:
../node_modules/nan/nan_converters.h:53:38: note: template<class T> typename Nan::imp::ToFactory::return_t Nan::To(v8::Local<v8::Value>)
../node_modules/nan/nan.h: In member function 'void Nan::Tap::ok(bool, const char*)':
../node_modules/nan/nan.h:2190:33: error: 'Nan::imp::FactoryBase<v8::Boolean>::return_t' has no member named 'ToLocalChecked'
../node_modules/nan/nan.h: In member function 'void Nan::Tap::pass(const char*)':
../node_modules/nan/nan.h:2196:30: error: 'Nan::imp::FactoryBase<v8::Boolean>::return_t' has no member named 'ToLocalChecked'
../node_modules/nan/nan.h: At global scope:
../node_modules/nan/nan.h:2220:10: error: 'MaybeLocal' does not name a type
../node_modules/nan/nan.h:2225:40: error: 'MaybeLocal' was not declared in this scope
../node_modules/nan/nan.h:2225:40: note: suggested alternative:
/home/pi/.node-gyp/4.2.1/include/node/v8.h:111:7: note:   'v8::MaybeLocal'
../node_modules/nan/nan.h:2225:52: error: template argument 1 is invalid
../node_modules/nan/nan.h:2225:54: error: expected unqualified-id before '>' token
../node_modules/nan/nan.h:2234:1: error: 'MaybeLocal' does not name a type
../src/detection.cpp:211:17: error: variable or field 'init' declared void
../src/detection.cpp:211:13: error: 'Handle' is not a member of 'v8'
../src/detection.cpp:211:34: error: expected primary-expression before '>' token
../src/detection.cpp:211:36: error: 'target' was not declared in this scope
../src/detection.cpp:221:1: error: 'init' was not declared in this scope
detection.target.mk:90: recipe for target 'Release/obj.target/detection/src/detection.o' failed
make: *** [Release/obj.target/detection/src/detection.o] Error 1
make: Leaving directory '/home/pi/node_modules/usb-detection/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 3.18.7-v7+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/node_modules/usb-detection
gyp ERR! node -v v4.2.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm ERR! Linux 3.18.7-v7+
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "usb-detection"
npm ERR! node v4.2.1
npm ERR! npm  v2.14.7
npm ERR! code ELIFECYCLE

npm ERR! usb-detection@1.3.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the usb-detection@1.3.0 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the usb-detection package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls usb-detection
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/pi/npm-debug.log

A: looks like you need another c++ compiler.
I think this will help you:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-5 g++-5
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 80 --slave /usr/bin/g++ g++ /usr/bin/g++-5
sudo update-alternatives --config gcc (choose gcc-5 from the list)


text:
Q: Calling multiple leaflets of unique shapefiles and data frames on the same map in R I am visualizing population heat maps for the commission districts of thirty Florida counties using Leaflet, but I can't figure out how to call them on the same leaflet map with the same population legend for all districts. I am starting with two counties for now, Alachua1 and Putnam2; their commission districts shapefiles are linked at the bottom of this post. The closest method I have found is combineWidgets and this simply places the different leaflets for each county side by side, not on the same map. I also tried sync, but it doesn't work for this either. I tried to incorporate all county maps in one leaflet but I couldn't because the code to get the population for each county's commission districts is obviously extensive and highly unique. I also included a screenshot of what the two county districts look like side by side. I can make perfect tmaps of this data, but I want it to be interactive, on the same plane, so you can see all county commission districts for thirty counties colored by population percentile/tier.
In R, I want to view multiple different shapefiles with different data frames on the same map but I cannot figure out how to call them in a single leaflet code or how to call them as individual leaflet maps overlayed on the same page.
library(sf)
library(sp)
library(terra)
library(tidyverse)
library(spData)
library(tmap)
library(tidycensus)
library(raster)
library(dplyr)
library(leaflet)
library(leaflet.minicharts)
library(stringr)
library(RColorBrewer)
library(leafsync)
library(manipulateWidget)

census_api_key("***")
display.brewer.all()
pl_vars <- load_variables(2020, "pl", cache = TRUE)

#Alachua County - Intersection - Total Population of BCC Districts-----
download.file(url = "https://www2.census.gov/geo/tiger/TIGER2020PL/STATE/12_FLORIDA/12001/tl_2020_12001_tabblock20.zip",
              destfile = "/Users/***/Documents/R Studio/Census Files/Block Files/Alachua/tl_2020_12001_tabblock20.zip",
              mode = "wb")

unzip("/Users/***/Documents/R Studio/Census Files/Block Files/Alachua/tl_2020_12001_tabblock20.zip", exdir = "/Users/***/Documents/R Studio/Census Files/Block Files/Alachua/", overwrite = T)

alachua_blocks <- read_sf("/Users/***/Documents/R Studio/Census Files/Block Files/Alachua/tl_2020_12001_tabblock20.shp")

tm_shape(alachua_blocks) +
  tm_borders()

alachua_districts <- read_sf("/Users/***/Documents/R Studio/District Files/County Commission Districts/Alachua/Alachua_BCC/Commissioner_Districts.shp")

tm_shape(alachua_districts) +
  tm_borders()

pop_total_2020_alachua <- get_decennial(geography = "block",
                                state = "FL",
                                county = "Alachua",
                                variables = "P1_001N",
                                year = 2020) %>%
  dplyr::select(GEOID, value) %>%
  rename(pop_total_2020_alachua = value)

alachua_blocks <- alachua_blocks %>%
  mutate(GEOID = GEOID20)

alachua_blocks <- inner_join(alachua_blocks, pop_total_2020_alachua, by = "GEOID")

tm_shape(alachua_blocks) +
  tm_polygons(col = "pop_total_2020_alachua")

alachua_districts_transform <- st_transform(alachua_districts, crs = crs(alachua_blocks))

alachua_districts_blocks <- st_intersection(x = alachua_blocks, y = alachua_districts_transform)

alachua_districts_blocks.df <- as.data.frame(alachua_districts_blocks)

district_pop_alachua.sf <- alachua_districts_blocks %>%
  group_by(COMMDIST) %>%
  summarize(district_pop_alachua = sum(pop_total_2020_alachua))

tm_shape(alachua_districts) +
  tm_borders() +
  tm_text(text = "COMMDIST")

view(district_pop_alachua.sf)

tm_shape(district_pop_alachua.sf) +
  tm_polygons(col = "district_pop_alachua", palette = "Blues") +
  tm_text(text = "COMMDIST")

Alachua_County_Total_Pop_Map = tm_shape(district_pop_alachua.sf) +
  tm_polygons(col = "district_pop_alachua", palette = "YlOrRd", title='',
              border.col='grey27', alpha=.9) +
  tm_layout(main.title = "Alachua", main.title.position = c('center', 'top'),
            legend.position = c("left", "bottom")) +
  tm_credits(text = "Total Population", position = c('center', 'bottom'),  fontface = "bold") +
  tm_text(text = "COMMDIST")

#Putnam County - Intersection - Total Population of BCC Districts-----
download.file(url = "https://www2.census.gov/geo/tiger/TIGER2020PL/STATE/12_FLORIDA/12107/tl_2020_12107_tabblock20.zip",
              destfile = "/Users/***/Documents/R Studio/Census Files/Block Files/Putnam/tl_2020_12107_tabblock20.zip",
              mode = "wb")

unzip("/Users/***/Documents/R Studio/Census Files/Block Files/Putnam/tl_2020_12107_tabblock20.zip", exdir = "/Users/***/Documents/R Studio/Census Files/Block Files/Putnam/", overwrite = T)

putnam_blocks <- read_sf("/Users/***/Documents/R Studio/Census Files/Block Files/Putnam/tl_2020_12107_tabblock20.shp")

tm_shape(putnam_blocks) +
  tm_borders()

putnam_districts <- read_sf("/Users/***/Documents/R Studio/District Files/County Commission Districts/Putnam/Putnam_BCC/County_Districts.shp")

tm_shape(putnam_districts) +
  tm_borders()

pop_total_2020_putnam <- get_decennial(geography = "block",
                                state = "FL",
                                county = "Putnam",
                                variables = "P1_001N",
                                year = 2020) %>%
  dplyr::select(GEOID, value) %>%
  rename(pop_total_2020_putnam = value)

putnam_blocks <- putnam_blocks %>%
  mutate(GEOID = GEOID20)

putnam_blocks <- inner_join(putnam_blocks, pop_total_2020_putnam, by = "GEOID")

tm_shape(putnam_blocks) +
  tm_polygons(col = "pop_total_2020_putnam")

putnam_districts_transform <- st_transform(putnam_districts, crs = crs(putnam_blocks))

putnam_districts_blocks <- st_intersection(x = putnam_blocks, y = putnam_districts_transform)

putnam_districts_blocks.df <- as.data.frame(putnam_districts_blocks)

district_pop_putnam.sf <- putnam_districts_blocks %>%
  group_by(DISTRICTID) %>%
  summarize(district_pop_putnam = sum(pop_total_2020_putnam))

tm_shape(putnam_districts) +
  tm_borders() +
  tm_text(text = "DISTRICTID")

view(district_pop_putnam.sf)

tm_shape(district_pop_putnam.sf) +
  tm_polygons(col = "district_pop_putnam", palette = "Blues") +
  tm_text(text = "DISTRICTID")

Putnam_County_Total_Pop_Map = tm_shape(district_pop_putnam.sf) +
  tm_polygons(col = "district_pop_putnam", palette="YlOrRd", title='',
              border.col='grey27', alpha=.9) +
  tm_layout(main.title = "Putnam", main.title.position = c('center', 'top'),
            legend.position = c("left", "bottom")) +
  tm_credits(text = "Total Population", position = c('center', 'bottom'), fontface = "bold") +
  tm_text(text = "DISTRICTID")

#DISPLAY FUNCTION FOR ALL COUNTY MAPS-----
tmap_arrange(Alachua_County_Total_Pop_Map, Putnam_County_Total_Pop_Map)

#Alachua Leaflet Map Data
popupdistrictpopulationalachua <- paste(district_pop_alachua.sf$district_pop_alachua)
pal1 <- colorQuantile(palette = "YlOrRd", domain = district_pop_alachua.sf$district_pop_alachua, n = 7)

alachua_leaflet_total_pop <- district_pop_alachua.sf %>%
  st_transform(crs = "+init=epsg:4326") %>%
  leaflet(width = "100%") %>%
  addProviderTiles(provider = "CartoDB.Positron") %>%
  addPolygons(popup = ~ str_extract(COMMDIST, "^([^,]*)"),
              label = popupdistrictpopulationalachua,
              stroke = FALSE,
              smoothFactor = 0,
              fillOpacity = 0.7,
              color = ~ pal1(district_pop_alachua)) %>%
  addPolygons(data = FL_counties_transform, weight = 1, fill = FALSE, opacity = 1) %>%
  addLegend("bottomright",
            pal = pal1,#colorQuantile(palette = "YlOrRd", domain = district_pop_alachua.sf$district_pop_alachua, n = 7),
            values = ~ district_pop_alachua,
            title = "Alachua Population",
            opacity = 1)
alachua_leaflet_total_pop

#Putnam Leaflet Map Data
popupdistrictpopulationputnam <- paste(district_pop_putnam.sf$district_pop_putnam)
pal2 <- colorQuantile(palette = "YlOrRd", domain = district_pop_putnam.sf$district_pop_putnam, n = 5)

putnam_leaflet_total_pop <- district_pop_putnam.sf %>%
  st_transform(crs = "+init=epsg:4326") %>%
  leaflet(width = "100%") %>%
  addProviderTiles(provider = "CartoDB.Positron") %>%
  addPolygons(popup = ~ str_extract(DISTRICTID, "^([^,]*)"),
              label = popupdistrictpopulationputnam,
              stroke = FALSE,
              smoothFactor = 0,
              fillOpacity = 0.7,
              color = ~ pal2(district_pop_putnam)) %>%
  addLegend("bottomright",
            pal = pal2,#colorQuantile(palette = "YlOrRd", domain = district_pop_putnam.sf$district_pop_putnam, n = 7),
            values = ~ district_pop_putnam,
            title = "Putnam Population",
            opacity = 1)

#doesnt work
sync(alachua_leaflet_total_pop, putnam_leaflet_total_pop)

#Works, but only side by side
combineWidgets(alachua_leaflet_total_pop, putnam_leaflet_total_pop)

A: I didn't duplicate your legend format exactly, but in {tmap} you would simply map the two districts together by calling them with a + like this:
#toggle tmap interactive mode
tmap_mode("view")

 tm_shape(district_pop_putnam.sf) +
  tm_polygons(group="Putnam",
              col = "district_pop_putnam",
              palette="YlOrRd",
              style="quantile",
              title='Putnam Population',
              border.col='grey27',
              alpha=.9) +
  tm_text(text = "DISTRICTID")+

  tm_shape(district_pop_alachua.sf) +
  tm_polygons(group="Alachua Population",
              col = "district_pop_alachua",
              palette = "YlOrRd",
              style="quantile",
              title='Alachua Population',
              border.col='grey27',
              alpha=.9) +
   tm_text(text = "COMMDIST")

To produce the following:

{tmap} doesn't quite have the customizability of {leaflet} when it comes to titles and credits in view mode - is this why you opted to switch to {leaflet} or were you thinking it was your only option for displaying the districts together on the same interactive map?


text:
Q: Asking help with iptables Firstly I want to ask why my rules.v4 looks so complicated after using: iptables -F. I thought it will be empty after flushing:
# Generated by iptables-save v1.6.0 on Tue Jan  9 21:25:13 2018
*filter
:INPUT ACCEPT [76:4024]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [1:40]
:ufw-after-forward - [0:0]
:ufw-after-input - [0:0]
:ufw-after-logging-forward - [0:0]
:ufw-after-logging-input - [0:0]
:ufw-after-logging-output - [0:0]
:ufw-after-output - [0:0]
:ufw-before-forward - [0:0]
:ufw-before-input - [0:0]
:ufw-before-logging-forward - [0:0]
:ufw-before-logging-input - [0:0]
:ufw-before-logging-output - [0:0]
:ufw-before-output - [0:0]
:ufw-logging-allow - [0:0]
:ufw-logging-deny - [0:0]
:ufw-not-local - [0:0]
:ufw-reject-forward - [0:0]
:ufw-reject-input - [0:0]
:ufw-reject-output - [0:0]
:ufw-skip-to-policy-forward - [0:0]
:ufw-skip-to-policy-input - [0:0]
:ufw-skip-to-policy-output - [0:0]
:ufw-track-forward - [0:0]
:ufw-track-input - [0:0]
:ufw-track-output - [0:0]
:ufw-user-forward - [0:0]
:ufw-user-input - [0:0]
:ufw-user-limit - [0:0]
:ufw-user-limit-accept - [0:0]
:ufw-user-logging-forward - [0:0]
:ufw-user-logging-input - [0:0]
:ufw-user-logging-output - [0:0]
:ufw-user-output - [0:0]
-A INPUT -i enp3s0 -p udp -m udp --dport 67 -j ACCEPT
-A INPUT -i enp3s0 -p tcp -m tcp --dport 67 -j ACCEPT
-A INPUT -i enp3s0 -p udp -m udp --dport 53 -j ACCEPT
-A INPUT -i enp3s0 -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -i enp2s0 -p udp -m udp --dport 67 -j ACCEPT
-A INPUT -i enp2s0 -p tcp -m tcp --dport 67 -j ACCEPT
-A INPUT -i enp2s0 -p udp -m udp --dport 53 -j ACCEPT
-A INPUT -i enp2s0 -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -j ufw-before-logging-input
-A INPUT -j ufw-before-input
-A INPUT -j ufw-after-input
-A INPUT -j ufw-after-logging-input
-A INPUT -j ufw-reject-input
-A INPUT -j ufw-track-input
-A FORWARD -d 10.42.0.0/24 -o enp3s0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -s 10.42.0.0/24 -i enp3s0 -j ACCEPT
-A FORWARD -i enp3s0 -o enp3s0 -j ACCEPT
-A FORWARD -o enp3s0 -j REJECT --reject-with icmp-port-unreachable
-A FORWARD -i enp3s0 -j REJECT --reject-with icmp-port-unreachable
-A FORWARD -d 10.42.1.0/24 -o enp2s0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -s 10.42.1.0/24 -i enp2s0 -j ACCEPT
-A FORWARD -i enp2s0 -o enp2s0 -j ACCEPT
-A FORWARD -o enp2s0 -j REJECT --reject-with icmp-port-unreachable
-A FORWARD -i enp2s0 -j REJECT --reject-with icmp-port-unreachable
-A FORWARD -j ufw-before-logging-forward
-A FORWARD -j ufw-before-forward
-A FORWARD -j ufw-after-forward
-A FORWARD -j ufw-after-logging-forward
-A FORWARD -j ufw-reject-forward
-A FORWARD -j ufw-track-forward
-A OUTPUT -j ufw-before-logging-output
-A OUTPUT -j ufw-before-output
-A OUTPUT -j ufw-after-output
-A OUTPUT -j ufw-after-logging-output
-A OUTPUT -j ufw-reject-output
-A OUTPUT -j ufw-track-output
-A ufw-after-input -p udp -m udp --dport 137 -j ufw-skip-to-policy-input
-A ufw-after-input -p udp -m udp --dport 138 -j ufw-skip-to-policy-input
-A ufw-after-input -p tcp -m tcp --dport 139 -j ufw-skip-to-policy-input
-A ufw-after-input -p tcp -m tcp --dport 445 -j ufw-skip-to-policy-input
-A ufw-after-input -p udp -m udp --dport 67 -j ufw-skip-to-policy-input
-A ufw-after-input -p udp -m udp --dport 68 -j ufw-skip-to-policy-input
-A ufw-after-input -m addrtype --dst-type BROADCAST -j ufw-skip-to-policy-input
-A ufw-after-logging-forward -m limit --limit 3/min --limit-burst 10 -j LOG --log-prefix "[UFW BLOCK] "
-A ufw-after-logging-input -m limit --limit 3/min --limit-burst 10 -j LOG --log-prefix "[UFW BLOCK] "
-A ufw-before-forward -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A ufw-before-forward -p icmp -m icmp --icmp-type 3 -j ACCEPT
-A ufw-before-forward -p icmp -m icmp --icmp-type 4 -j ACCEPT
-A ufw-before-forward -p icmp -m icmp --icmp-type 11 -j ACCEPT
-A ufw-before-forward -p icmp -m icmp --icmp-type 12 -j ACCEPT
-A ufw-before-forward -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A ufw-before-forward -j ufw-user-forward
-A ufw-before-input -i lo -j ACCEPT
-A ufw-before-input -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A ufw-before-input -m conntrack --ctstate INVALID -j ufw-logging-deny
-A ufw-before-input -m conntrack --ctstate INVALID -j DROP
-A ufw-before-input -p icmp -m icmp --icmp-type 3 -j ACCEPT
-A ufw-before-input -p icmp -m icmp --icmp-type 4 -j ACCEPT
-A ufw-before-input -p icmp -m icmp --icmp-type 11 -j ACCEPT
-A ufw-before-input -p icmp -m icmp --icmp-type 12 -j ACCEPT
-A ufw-before-input -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A ufw-before-input -p udp -m udp --sport 67 --dport 68 -j ACCEPT
-A ufw-before-input -j ufw-not-local
-A ufw-before-input -d 224.0.0.251/32 -p udp -m udp --dport 5353 -j ACCEPT
-A ufw-before-input -d 239.255.255.250/32 -p udp -m udp --dport 1900 -j ACCEPT
-A ufw-before-input -j ufw-user-input
-A ufw-before-output -o lo -j ACCEPT
-A ufw-before-output -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A ufw-before-output -j ufw-user-output
-A ufw-logging-allow -m limit --limit 3/min --limit-burst 10 -j LOG --log-prefix "[UFW ALLOW] "
-A ufw-logging-deny -m conntrack --ctstate INVALID -m limit --limit 3/min --limit-burst 10 -j RETURN
-A ufw-logging-deny -m limit --limit 3/min --limit-burst 10 -j LOG --log-prefix "[UFW BLOCK] "
-A ufw-not-local -m addrtype --dst-type LOCAL -j RETURN
-A ufw-not-local -m addrtype --dst-type MULTICAST -j RETURN
-A ufw-not-local -m addrtype --dst-type BROADCAST -j RETURN
-A ufw-not-local -m limit --limit 3/min --limit-burst 10 -j ufw-logging-deny
-A ufw-not-local -j DROP
-A ufw-skip-to-policy-forward -j DROP
-A ufw-skip-to-policy-input -j DROP
-A ufw-skip-to-policy-output -j ACCEPT
-A ufw-track-output -p tcp -m conntrack --ctstate NEW -j ACCEPT
-A ufw-track-output -p udp -m conntrack --ctstate NEW -j ACCEPT
-A ufw-user-limit -m limit --limit 3/min -j LOG --log-prefix "[UFW LIMIT BLOCK] "
-A ufw-user-limit -j REJECT --reject-with icmp-port-unreachable
-A ufw-user-limit-accept -j ACCEPT
COMMIT
# Completed on Tue Jan  9 21:25:13 2018
# Generated by iptables-save v1.6.0 on Tue Jan  9 21:25:13 2018
*nat
:PREROUTING ACCEPT [306:30491]
:INPUT ACCEPT [79:4750]
:OUTPUT ACCEPT [128:10004]
:POSTROUTING ACCEPT [122:8932]
-A POSTROUTING -s 10.42.0.0/24 ! -d 10.42.0.0/24 -j MASQUERADE
-A POSTROUTING -s 10.42.1.0/24 ! -d 10.42.1.0/24 -j MASQUERADE
COMMIT
# Completed on Tue Jan  9 21:25:13 2018

Second question - I need iptables to rate limit new connections on specific port (limit not per ip, but all new attempts if there are too many of them), at the same time don't block any traffic that doesn't come to that specific port. All examples I saw on the internet use DROP for default INPUT policy, but that don't suit me.
Update: I run game server on port 45000 (it uses tcp and upd protocol)and recently I had problems with bot spam. Bots are trying to connect to my server from all over the world using hundreds of proxys. Game server plugins successfully blocked them, but this attack become much stronger lately and now it cause lags. Ideally I wanted to block access to this port based on geolocation and allow only 5-10 countries, but thats complicated. Another option is to rate-limit new connections to that port while keeping already existing. Of course it sertanly will block normal players trying to join during attack, but at least those who already play can do it without extreme lagging. My server isn't large (30 players max) so I assume rate limit to 30 new connections to port 45000 per 30 seconds will be fine.

A: All the items you posted are because at some point you activated ufw which is a front end to iptables and made all those custom tables.
The -F option removes the rules from some, but  not all of the rules from all the tables nor the empty chains you are seeing.
You need some additional options:
From https://serverfault.com/questions/200635/linux-iptables-best-way-to-clear-all-rules-leaving-anything-open the full set of commands to reset iptables is:
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -t nat -F
iptables -t mangle -F
iptables -F
iptables -X

*

*-P option resets the default policy for the tables.

*The -t nat -F flushes the nat table.

*The -t mangle -F flushes mangle, which is hardly ever used.

*-X deletes empty chains.

See the link for IPv6 and the man iptables for additional details.
The "problem" is the -F option, without specifying a chain, does not flush all chains, in your case you have a few remaining chains created by UFW.
To delete those chains you need to flush them first (-X will not delete them unless they are empty)
So for each chain you first have to remove any reference to the chain , flush the chain, and then delete it
Starting with "ufw-before-logging-forward"
sudo iptables -D FORWARD -j ufw-before-logging-forward
sudo iptables -F ufw-before-logging-forward
sudo iptables -X ufw-before-logging-forward

and on for all the custom chains ufw added.
Of course as you are using ufw, so there is a far easier method:
sudo ufw disable

A few general comments

*

*I suggest you keep the default policy ACCEPT rather than REJECT or DROP. If you set the default policy to REJECT/DROP you can lock yourself your if you run iptables -F

*If you manually write iptables rules do not use ufw or other tools to alter your rules.

*I highly suggest REJECT rather then DROP. In a nut shell, DROP is more bothersome to legitimate traffic and although it sounds nice, DROP does not slow down or fool any of the modern cracking tools. Because your system reacts to a packet would be crackers know you are up and running at your ip address and DROP hides nothing.
See http://www.chiark.greenend.org.uk/~peterb/network/drop-vs-reject for details.

*Use iptables-persistent

The top answer How to save rules of the iptables? reviews basic usage including saving and restoring your rule set . See the man page for additional details.

For help writing rules I need more details, what port and what traffic do you want to limit and how. Limiting ping is different. Limiting a web server is different than limiting ssh connections. Allowing most but limiting a few is using perhaps a black list. Limiting all and allowing a few is a white list, etc.
Examples:
Web traffic - I might use the general syntax for a web server if it were very busy:
iptables -I INPUT -p tcp -m state --state NEW -m limit --limit 30/minute --limit-burst 5 -j ACCEPT

You certainly can add the option --dport 80 to the above command.
This limits to 30 connections a minute which is very slow for Apache. If the web server were not so busy you can liberalize up to thousands of connections / minute.
SSH - These rules are great for blocking brute force attempts
# This rule tracks incoming connections to port 22
iptables -A INPUT -p tcp -m tcp --dport 22 -m tcp -m state --state NEW -m recent --set --name SSH --rsource

# This command rejects any attempt to connect to ssh more than
# 8 times in 10 minutes
# After 10 minutes you can attempt again so not permanent ban
iptables -A INPUT -p tcp -m tcp --dport 22 -m recent --update --seconds 600 --hitcount 8 --rttl --name SSH --rsource -j REJECT --reject-with icmp-host-prohibited

# Finally this will accept the connections
iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT

If you need more specific help please update your question =)


text:
Q: Can a pin be GPIO output and input at the same time? So I'm working with an AD5593R chip, which I don't expect anyone to have specific experience with, but I'm hoping there might be a general principle which I can apply.
Basically there's a control register that lets you set which of its 8 pins are GPIO output, and a separate register that lets you set which of its 8 pins are GPIO input. This confuses me slightly.
What if I set them all to 1 in both registers? Are they all output and input at the same time? Or does whatever I set most recently override the other?
I mean, what about the control register that dictates which are DAC pins? What if I try to make them all GPIO in, GPIO out, and DAC simultaneously?
How does this sort of thing usually work? The datasheet does not make it clear.
I mean, I'm not even sure what happens if I tell set all the bits to 0 in all those registers-- then what mode are the pins left in?

A: Your question was already answered on the datasheet, page 25. "When a pin is configured as both a general-purpose input and output, the primary function is as an output pin. This configuration allows the status of the output pin
to be determined by reading the GPIO read configuration
register"

A: Answered in the GPIO SECTION of the data sheet.

When an I/Ox pin is set as an output, it is possible to  read its
  status by also setting it as an input pin. When reading  the status of
  the I/Ox pins set as inputs the status of an I/Ox pin  set as both and
  input and output pin is also returned

A: Don't know your chip - the datasheet is likely your best bet.
Reading an output pin is common - you read its actual logic state. MCUs do that day-in and day-out. Nothing unique here.


text:
Q: Incrementing date to implement trial period using Inno Setup I am using Inno Setup compiler to create an installer set up for my software. The installer adds a timestamp to the Windows registry during the first installation. When the software is reinstalled, it checks the saved timestamp in Windows registry and if it is more than 90 days from the current date then it should stop the installation? so I am forcing the user to use the software only for 90 days.
I am trying to add 90 days to the current datetime for comparison. There is no option to do this in the datatype TSystemTime. I can add days to a TDateTime variable, but I can't use that variable in the Inno Setup script.
This is my code
function InitializeSetup(): Boolean;
var
  InstallDatetime: string;
begin
  if RegQueryStringValue(HKLM, 'Software\Company\Player\Settings', 'DateTimeInstall', InstallDatetime) then
    { I want to add 90 days before comparison }
    Result := CompareStr(GetDateTimeString('yyyymmdd', #0,#0), InstallDatetime) <= 0;
  if not result then
    MsgBox('This Software trial period is over. The Program will not install.', mbError, MB_OK);
    Result := True;
end;

I have seen a similar example on Stack Overflow. They have used a constant to compare the datetime. Instead, I am adding 90 days to my saved installation datetime.
Any help will be much appreciated.

A: To increment TSystemTime, check performing Arithmetic on SYSTEMTIME.
Though it would probably be difficult to implement 128-bit arithmetic in Inno Setup.

Alternatively, you can implement it on your own:
procedure IncDay(var Year, Month, Day: Integer);
var
  DIM: Integer;
begin
  Inc(Day);
  case Month of
    1, 3, 5, 7, 8, 10, 12: DIM := 31;
    2: if (Year mod 4 = 0) and ((Year mod 100 <> 0) or (Year mod 400 = 0)) then
         DIM := 29
       else
         DIM := 28;
    4, 6, 9, 11: DIM := 30;
  end;
  if Day > DIM then
  begin
    Inc(Month);
    Day := 1;
    if Month > 12 then
    begin
      Inc(Year);
      Month := 1;
    end;
  end;
end;

procedure IncDays(var Year, Month, Day: Integer; Days: Integer);
begin
  while Days > 0 do
  begin
    IncDay(Year, Month, Day);
    Dec(Days);
  end;
end;

function IncDaysStr(S: string; Days: Integer): string;
var
  Year, Month, Day: Integer;
begin
  Year := StrToInt(Copy(S, 1, 4));
  Month := StrToInt(Copy(S, 5, 2));
  Day := StrToInt(Copy(S, 7, 2));
  IncDays(Year, Month, Day, Days);
  Result := Format('%.4d%.2d%.2d', [Year, Month, Day]);
end;

Use it like:
result :=
  CompareStr(GetDateTimeString('yyyymmdd', #0,#0), IncDaysStr(InstallDatetime, 90)) <= 0;