text:
Q: How to manually create Proxy for Detail Collection in NHibernate I've got class, let it be Foo:
public class Foo
{
  ...

  protected MyCollection<Detail> _details
  public virtual MyCollection<Detail> Details
  {
     get { return _details ?? new MyCollection<Details>(); }
     set { _details = value; ... }
  }
  ...
}

public class Detail {...}

When I do LINQ query:
var q = session.Query<Foo>().Select(foo => new Foo( property1 = foo.property1, ... );
...
q.ToList();

I've got NULL in _details field, and when I access to Details to get all Lazy details, of course I get new MyCollection(), but not IPersistentBag (or else, IPersistentCollection).
So How can I manually create proxy collection (I've got session / sessionFactory references)?
[ Added ] here is the mappings (on Foo):
<bag name="Details" lazy="true" collection-type="NHibernateDataService.DetailBag`1[[DataObjects.Detail, DataObjects]], NHibernateDataService" cascade="all-delete-orphan" fetch="select" batch-size="1" access="property" inverse="true">
  <key column="`Master`" />
  <one-to-many class="DataObjects.Detail" />
</bag>

Thank you!

A: MyCollection can't be mapped to IPersistentBag, unless, of course, you implement that interface on MyCollection (and probably set the mapping type explicitly??)...
A more standard approach is to set the "collection-type" property on the bag mapping to a custom type - an implementation of IUserCollectionType, which you can choose to make a base class that MyCollection derives from.


text:
Q: Issue on using AutoMapper in asp.net core I am following a tutorial on asp.net core and angular. When I add the Automapper inside my Startup class it crashes the dotnet cli and couldn't render the page. This is how I use the Automapper in the Startup:
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SpaServices.AngularCli;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.EntityFrameworkCore;
using aspcoreangular.persistence;
using AutoMapper;

namespace aspcoreangular
{
    public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddAutoMapper();
            services.AddDbContext<VegaDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("Default")));
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            // In production, the Angular files will be served from this directory
            services.AddSpaStaticFiles(configuration =>
            {
                configuration.RootPath = "ClientApp/dist";
            });
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseSpaStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller}/{action=Index}/{id?}");
            });

            app.UseSpa(spa =>
            {
                // To learn more about options for serving an Angular SPA from ASP.NET Core,
                // see https://go.microsoft.com/fwlink/?linkid=864501

                spa.Options.SourcePath = "ClientApp";

                if (env.IsDevelopment())
                {
                    spa.UseAngularCliServer(npmScript: "start");
                }
            });
        }
    }
}

This is how I use it in the controller. But it doesn't get to this point
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using aspcoreangular.models;
using aspcoreangular.persistence;
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;

namespace aspcoreangular.Controllers
{
    public class MakesController : Controller
    {
        private readonly VegaDbContext context;
        private readonly IMapper mapper;

        protected MakesController(VegaDbContext context, IMapper mapper)
        {
            this.mapper = mapper;
            this.context = context;
        }

        [HttpGet("/api/makes")]
        public async Task<IEnumerable<Resources.MakeResource>> GetMakes()
        {
            var makes =  await context.Makes.Include(m => m.Models).ToListAsync();
            return mapper.Map<List<Make>, List<Resources.MakeResource>>(makes);
        }
    }
}

This is the image of the crash:

Can you please help me with this? Thank you.
This my MakeResouce class
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using aspcoreangular.models;

namespace aspcoreangular.Controllers.Resources
{
    public class MakeResource
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public ICollection<ModelResource> Models { get; set; }

        public MakeResource()
        {
            Models = new Collection<ModelResource>();
        }
    }
}

and in my mappingprofile
using aspcoreangular.Controllers.Resources;
using aspcoreangular.models;
using AutoMapper;

namespace aspcoreangular.ClientApp.Mapping
{
    public class MappingProfile : Profile
    {
        protected MappingProfile()
        {
            CreateMap<Make, MakeResource>();
            CreateMap<Model, ModelResource>();
        }
    }
}

A: When AutoMapper maps source object to destination object before mapping itself it has to create an instance of the destination object and then Mapper can map properties using reflection.
And the error says: No parameterless constructor is defined for this object.

That means: AutoMapper kindly asks System.Activator class to create instance of the destination object for him. But System.Activator fails because it can't find public parameterless contructor in destination class (obviously, System.Activator can use constructor with parameters, but AutoMapper hadn't provided any parameters for constructor). And that is why the third line of the Error message comes from Activator.CreateInstance method.

So, to sum up, you should examine Resources.MakeResource class (as destination) for parameterless constructor.
PS. But I can't tell you on Why this exception crashes the whole Application

redpajama_set_name: RedPajamaStackExchange


text:
Q: Store PostgreSQL resultset into sessions? I'm creating a web app using PHP and PostgreSQL. Database are too big and some kinds of
search takes a lot of time to process.
User can wait into first search, but it sucks when paginates. Can I store the resultset into sessions vars?
It would be great to deal with pagination.

A: Yes, of course you can, but with a lot of different resultsets, loading the amount of data on a session_start can become cumbersome. Also, the same search could be done by more then one user, resulting in duplicate (time consuming) retrievals / large sessions (every pageload takes longer) / more storage space.
If the data is safe from alteration enough to store in a session, look at caches like APC or Memcached to store the result with a meaningful key. That way, the load is lifted from the database, and searches can be shared amongst users.
If you have a fixed number of items for pagination, you could even consider storing the different 'pages' with a pre- or postfix in the key, so you don't have to select a subset of the result every time (i.e. store with a key like 'search:foo=bar|1' / 'search:foo=bar|2' etc.)


text:
Q: How to specify cookbook dependencies based on OS? I am trying to find the best way of managing dependencies which are not available for all OS platforms. Our cookbook is cross-platform, it is aimed at both Linux and Windows systems. One of our recent requirements however, is to add in features that are only needed on Linux.
To do that normally, I would use a 'depends' line in the metadata.rb to specify a separate cookbook as being needed. For example:
depends 'hostfile_edit', '=0.1.2'

Our Chef system is split into two distinct orgs for security reasons - Windows and Linux. However, in this case the "hostfile_edit" cookbook is only available on the Linux org. Hence, when we run rake unit on Windows we get a failure as Chef is unable to reference this other cookbook. The rake unit runs perfectly when run on a Linux system. Similarly, when using the cookbook in a deployment there are failures on Windows, but not on Linux.

A: The answer lies in metadata.rb file, you can add like this
%w( aix amazon centos fedora freebsd debian oracle mac_os_x redhat suse opensuseleap ubuntu windows zlinux ).each do |os|
  supports os
end

You can read more about this are https://docs.chef.io/config_rb_metadata/


text:
Q: NPM module Is In /node_modules folder but cannot be found? I am having a bit of an issue getting the md5 node module installed properly on an Ubuntu dev server I have setup.
(It works fine on my local windows machine, and I can install other modules with npm just fine on the dev server)
When I try and start a NodeJS application I am working on it fails stating that the md5 module is not installed.
    // trying to start my application that depends on md5.
    drichardson@devwebserver:/var/www/node_app/meanapp$ node server.js
    module.js:340
        throw err;
        ^
    Error: Cannot find module 'md5'
        at Function.Module._resolveFilename (module.js:338:15)
        at Function.Module._load (module.js:280:25)
        at Module.require (module.js:364:17)
        at require (module.js:380:17)
        at Object.<anonymous> (/var/www/node_app/node_modules/hashfile/index.js:7:11)
        at Module._compile (module.js:456:26)
        at Object.Module._extensions..js (module.js:474:10)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:312:12)
        at Module.require (module.js:364:17)
        at require (module.js:380:17)
        at Object.<anonymous> (/var/www/node_app/meanapp/app/controllers/exchanges.server.controller.js:15:14)
        at Module._compile (module.js:456:26)
        at Object.Module._extensions..js (module.js:474:10)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:312:12)

I have tried installing this within my working directory:
    // Installing in working directory
    drichardson@devwebserver:/var/www/node_app/meanapp$ sudo npm install --save md5
    npm http GET https://registry.npmjs.org/md5
    npm http GET https://registry.npmjs.org/md5
    npm http 304 https://registry.npmjs.org/md5
    npm http GET https://registry.npmjs.org/is-buffer
    npm http GET https://registry.npmjs.org/crypt
    npm http GET https://registry.npmjs.org/charenc
    npm http 304 https://registry.npmjs.org/crypt
    npm http GET https://registry.npmjs.org/is-buffer
    npm http GET https://registry.npmjs.org/charenc
    npm http 200 https://registry.npmjs.org/is-buffer
    npm http GET https://registry.npmjs.org/is-buffer/-/is-buffer-1.0.2.tgz
    npm http GET https://registry.npmjs.org/is-buffer/-/is-buffer-1.0.2.tgz
    npm http GET https://registry.npmjs.org/charenc
    npm http GET https://registry.npmjs.org/charenc/-/charenc-0.0.1.tgz
    npm http 200 https://registry.npmjs.org/charenc/-/charenc-0.0.1.tgz
    npm http GET https://registry.npmjs.org/is-buffer/-/is-buffer-1.0.2.tgz
    npm http 200 https://registry.npmjs.org/is-buffer/-/is-buffer-1.0.2.tgz
    md5@2.0.0 node_modules/md5
    ├── charenc@0.0.1
    ├── crypt@0.0.1
    └── is-buffer@1.0.2

Even though the node module shows up in my /node_modules folder, it still throws the "Cannot find module md5 "
    // MD5 In my node_modules folder:
    drichardson@devwebserver:/var/www/node_app/meanapp/node_modules$ ls -la | grep 'md5'
    drwxr-xr-x  2 drichardson drichardson 4096 Oct 30 13:53 md5

I have also tried:
- Installing the module globally with "npm install -g md5"
- Cleaning the Cache and Reinstalling "npm cache clean"
- Reinstalling the application with "npm install"
What else can I try to get this so that npm recognizes md5 as being installed?
Thanks,

A: I had a similar issue and the problem wasn't where the module was installed, but instead it was because the main property in the package.json file was not correctly set.  In my case it referred to a file that wasn't there.  Make sure that the "main":"..." is set correctly for the module.
If this is a module that you do not control, as a quick fix you can make the change in the nearest node_modules directory.  In our case this was located in the root of the project.

A: Can you try clearing entire node_modules and installing everything again?
   rm -rf node_modules
   npm install

A: In folder /var/www/node_app/node_modules/hashfile/
run npm install md5
You tried this?

A: My problem ended up being the version of Node and NPM that I was running locally vs in my Docker containers.
# Local versions:
$ node --version
v12.18.2
$ npm --version
6.14.10

I changed in my Dockerfile
FROM node:15-alpine3.12
#         ^^
# ...

to
FROM node:12-alpine3.12
#         ^^
# ...


text:
Q: Add "Back" button on ExoPlayer Controller View I have ExoPlayer on an activity.
How can I add "Back" button into controller view to let user go back to the previous activity? Any help are really welcome.

A: First, to customize the layout of SimpleExoPlayerView throughout your app, or just for certain configurations, you can define exo_playback_control_view.xml layout file in your application res/layout directories. These layouts will override the one provided by the ExoPlayer library, and will be inflated for use by SimpleExoPlayerView.
In exo_playback_control_view.xml, you can try with mine:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    android:layoutDirection="ltr"
    android:background="#CC000000"

    android:orientation="vertical">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:paddingTop="4dp"
        android:orientation="horizontal">

        <ImageView
            android:layout_width="24dp"
            android:src="@drawable/ic_hide"
            android:id="@+id/exo_controller"
            android:layout_height="24dp" />

        <ImageButton android:id="@id/exo_play"
            style="@style/ExoMediaButton.Play"/>

        <ImageButton android:id="@id/exo_pause"
            style="@style/ExoMediaButton.Pause"/>

        <Button
            android:id="@+id/btn_back"
            android:text="Back"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="4dp"
        android:gravity="center_vertical"
        android:orientation="horizontal">

        <TextView android:id="@id/exo_position"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="14sp"
            android:textStyle="bold"
            android:paddingLeft="4dp"
            android:paddingRight="4dp"
            android:includeFontPadding="false"
            android:textColor="#FFBEBEBE"/>

        <com.google.android.exoplayer2.ui.DefaultTimeBar
            android:id="@id/exo_progress"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="26dp"/>

    <TextView android:id="@id/exo_duration"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="14sp"
            android:textStyle="bold"
            android:paddingLeft="4dp"
            android:paddingRight="4dp"
            android:includeFontPadding="false"
            android:textColor="#FFBEBEBE"/>

    </LinearLayout>

</LinearLayout>

This class provide some common controllers for exoplayer and one more button with id "btn_back". You can findBindId in your activity then add whatever event you want, something like this.finish().

A: Add below code into your main layout like LinearLayout, RelativeLayout, etc.
 <RelativeLayout
            android:id="@+id/ry_player_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:visibility="visible">

            <com.potyvideo.library.AndExoPlayerView
                android:id="@+id/andExoPlayerView"
                android:layout_width="match_parent"
                android:layout_height="240dp"
                android:visibility="visible"
                app:andexo_aspect_ratio="aspect_match"
                app:andexo_full_screen="true"
                app:andexo_play_when_ready="false"
                app:andexo_resize_mode="Fit" />

            <RelativeLayout
                android:id="@+id/ry_course_iv"
                android:layout_width="match_parent"
                android:layout_height="240dp"
                android:layout_gravity="center"
                android:clickable="true"
                android:focusable="true"
                android:foreground="#66000000"
                android:visibility="visible">

                <ImageView
                    android:id="@+id/iv_thumb"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:scaleType="fitXY" />

            </RelativeLayout>

            <LinearLayout
                android:id="@+id/ly_back"
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:layout_margin="15dp"
                android:gravity="center"
                android:orientation="vertical">

                <TextView
                    android:layout_width="17dp"
                    android:layout_height="18dp"
                    android:background="@drawable/ic_back" />

            </LinearLayout>

    </RelativeLayout>


text:
Q: Consuming WCF service in Xamarin WIndows Phone project I have a bit of a problem with my Xamarin.Forms project. I have generated web service proxy class with SlSvcutil.exe and have imported that class in my PCL library that is shared amongs platform specific projects / iOs, Android and WindowsPhone.
All the references from System.ServiceModel are missing because, ofcourse, that reference does not exist in my project. How do I add it? I tried to do it with NuGet but it just fails all the time with same error.

You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile111', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

I tried selecting 'Ignore All' for Dependacy Behavior when installing package but to no avail.
This is driving me crazy as I have so much problems with this Xamarin and I havent really started programming yet.

A: You should not need to install an extra package. Just add System.ServiceModel, System.Runtime.Serialization and System.Xml to your references. If you need to, you can just open your csproj file in a text editor and add these to the same area where you see other references in the file:
<Reference Include="System.ServiceModel" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml" />

And make sure that you are using slsvcutil.exe from the Silverlight 5 SDK, not an older one. Taking a look at a working WCF client in one of our projects, I see this exact tool version:
// This code was auto-generated by SlSvcUtil, version 5.0.61118.0


text:
Q: Adding Currency code to textblock programmatically I am working on a windows phone 8 app and need to add a currency hex code to a textblock text property programmatically. It works perfectly on xaml:
<TextBlock  Text="₦" />

but when i use the statement below:
textblock.text = "₦";

it just display the text as it is. How can I do this programmatically?

A: You need the Unicode value in the string.  Using Unicode character escape sequences in strings.
  textblock2.Text = "\u20a6";

Or you can use the hex number and convert to a char.
  textblock2.Text = char.ConvertFromUtf32(0x20a6);

Also, you can simply use the character:
textblock2.Text = "₦";

A: Try this:
            var formatter = new System.Globalization.CultureInfo("HA-LATN-NG");
            formatter.NumberFormat.CurrencySymbol = "₦";

            textblock.text  = long.Parse("20a6", NumberStyles.AllowHexSpecifier
            | NumberStyles.HexNumber,
            formatter).ToString("c");

But, if you need a decimal value, see this link.


text:
Q: Helm install dependency charts without root helm I have a little bit strange question, but maybe you can advise right way for this implementation.
I read about Helm Dependencies - when you can set the list of necessary charts and install them during your "main" chart install.
Is it possible to have this list of dependencies (with versions) without "main/root" chart?
For example - I want to install to my k8s cluster rabbit, redis, postgres and few my custom charts.
I don't want to run few times "helm chart install..." - I want to have one file with the list of helms/versions and install them in one command.
Also I want to easy upgrade helm charts using my the same one file - I want to change version, run again one command and update only necessary helm charts (with different versions).
Is it possible, or, maybe I should use something another for this?

A: There's no actual requirement that a Helm chart contain any templates of its own.  It's possible to have a Helm chart that only contains dependencies; then running helm install on that "parent" chart would install all of the dependencies.
It would be valid to run helm create to build a new chart, then delete the values.yaml file and template directory from the generator, and fill in the requirements in Chart.yaml.
In your setup you're just installing infrastructure services.  Occasionally you will see a dependency-only chart like this used to install several application components as well; this is sometimes called an umbrella chart.  There are potential problems around umbrella charts where Helm likes to combine together dependencies: if different application components depend on different major versions of some chart there can be a conflict, and if you have multiple components that each depend on, say, Redis, an umbrella-chart installation will typically install just one shared Redis rather than an isolated Redis per component.
There are a number of ways to group multiple helm install commands into a single execution.  Just writing a simple shell script will often work, depending on your needs.  General-purpose automation tools (Ansible, Salt Stack, Chef) may have ways to run Helm, or if not, then to run arbitrary commands.  There are also a couple of Helm-specific tools here: Helmsman is simpler and Helmfile more complex, but both let you "install" a collection of related charts without necessarily building an umbrella chart.

A: What you describe at the beginning of your question is called "Umbrella Charts". These are Charts that are used to bundle other Charts and manage these as one unit.
If this is not what you want to do (that's how I understand your question), then you are required to use other tools. One such tool is Helmfile, which allows you to define a list of Helm Charts, their versions and Helm Values. You can then install/upgrade/uninstall all referenced Helm Charts in one go.
Another option is to use kluctl (disclaimer: I'm the main developer of it). It basically allows you to do the same as offered by Helmfile, but in a different way/style. Kluctl focuses on Kustomize deployments while allowing you to easily pull-in third-party Helm Charts.
Having the mentioned Helm Charts in a Kluctl deployment would require you to have a kluctl deployment project that looks like this:
my_project
├── third-party
│   ├── rabbit
│   │   ├── kustomization.yaml
│   │   ├── helm-chart.yaml
│   │   └── helm-values.yaml
│   ├── redis
│   │   ├── kustomization.yaml
│   │   ├── helm-chart.yaml
│   │   └── helm-values.yaml
│   └── deployment.yaml
├── deployment.yaml
└── .kluctl.yaml

my_project/deployment.yaml
vars:
- values:
    # this is arbitrary yaml
    my:
      ns: my-namespace
# this is also possible, loading vars from a file...
# many other sources are supported as well
# - file: my-config.yaml

deployments:
- include: third-party

commonLabels:
  my.example.com/deployment: my-example-deployment
  my.example.com/target: {{ target.name }}

my_project/third-party/deployment.yaml
deployments:
- path: rabbit
- path: redis

my_project/third-party/rabbit/kustomization.yaml
resources:
# this file is auto-generated by the helm-integration
- deploy.yaml

my_project/third-party/rabbit/helm-chart.yaml
helmChart:
  repo: https://charts.bitnami.com/bitnami
  chartName: rabbitmq
  chartVersion: 10.3.2
  releaseName: my-rabbit
  # my.ns comes from the 'vars' defined in the root deployment.yaml
  namespace: "{{ my.ns }}"
  output: deploy.yaml

my_project/third-party/rabbit/helm-values.yaml
auth:
  username: my-user
  password: you-would-of-course-never-do-this

my_project/third-party/redis/helm-chart.yaml and helm-values.yaml
Basically the same as for rabbitmq, but with redis specific settings.
my_project/.kluctl.yaml
targets:
- name: dev
  context: my-dev-cluster-context

Using kluctl
Based on the above example, you would then run kluctl helm-pull from the root project directory, which will then pre-pull all involved Helm Charts and write the contents besides the helm-chart.yaml files. These pre-pulled Charts are meant to be added to you version control (this might change in the future).
After that, you can run commands like kluctl diff -t dev, kluctl deploy -t dev and kluctl prune -t dev to work with the deployment.
kluctl helm-upgrade will help you while upgrading the pre-pulled Helm Charts.
Fully working example
A fully working example can be found here. The shown yamls from above are only meant to give an idea about the Helm related stuff.


text:
Q: Visual C++ 2008 Boost Problem Hey I'm using the C++ Communication Services Framework, which uses the Boost's Thread library.
I'm compiling one of their test projects (CSF's) and i'm getting a huge errors
The errors are in the Boost Bind library in file bind/mem_fn_template.hpp
EDIT: I installed Boost through the Boost installers provided by BoostPro
Here are few of the errors
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(146) : error C2332: 'class' : missing tag name
        C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(193) : see reference to class template instantiation 'boost::_mfi::mf1<R,T,A1>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(146) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(146) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(146) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(146) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(151) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(151) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(151) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(151) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(151) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(210) : error C2332: 'class' : missing tag name
        C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(243) : see reference to class template instantiation 'boost::_mfi::cmf1<R,T,A1>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(210) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(210) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(210) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(210) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(215) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(215) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(215) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(215) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(215) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(258) : error C2332: 'class' : missing tag name
        C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(305) : see reference to class template instantiation 'boost::_mfi::mf2<R,T,A1,A2>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(258) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(258) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(258) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(258) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(263) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(263) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(263) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(263) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(263) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(320) : error C2332: 'class' : missing tag name
        C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(353) : see reference to class template instantiation 'boost::_mfi::cmf2<R,T,A1,A2>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(320) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(320) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(320) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(320) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(325) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(325) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(325) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(325) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(325) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(368) : error C2332: 'class' : missing tag name
        C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(415) : see reference to class template instantiation 'boost::_mfi::mf3<R,T,A1,A2,A3>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(368) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(368) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(368) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(368) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(373) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(373) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(373) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(373) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(373) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(430) : error C2332: 'class' : missing tag name
        C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(463) : see reference to class template instantiation 'boost::_mfi::cmf3<R,T,A1,A2,A3>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(430) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(430) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(430) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(430) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(435) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(435) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(435) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(435) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(435) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(478) : error C2332: 'class' : missing tag name
        C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(525) : see reference to class template instantiation 'boost::_mfi::mf4<R,T,A1,A2,A3,A4>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(478) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(478) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(478) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(478) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(483) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(483) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(483) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(483) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(483) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(540) : error C2332: 'class' : missing tag name
        C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(573) : see reference to class template instantiation 'boost::_mfi::cmf4<R,T,A1,A2,A3,A4>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(540) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(540) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(540) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(540) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(545) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(545) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(545) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(545) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(545) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(588) : error C2332: 'class' : missing tag name
        C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(635) : see reference to class template instantiation 'boost::_mfi::mf5<R,T,A1,A2,A3,A4,A5>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(588) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(588) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(588) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(588) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(593) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(593) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(593) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(593) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(593) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(650) : error C2332: 'class' : missing tag name
        C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(683) : see reference to class template instantiation 'boost::_mfi::cmf5<R,T,A1,A2,A3,A4,A5>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(650) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(650) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(650) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(650) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(655) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(655) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(655) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(655) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(655) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(698) : error C2332: 'class' : missing tag name
        C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(745) : see reference to class template instantiation 'boost::_mfi::mf6<R,T,A1,A2,A3,A4,A5,A6>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(698) : fatal error C1003: error count exceeds 100; stopping compilation

A: The offending line is
template<class U, class B1> R call(U & u, T const *, B1 & b1) const

Are you sure you don't have any macro named either U or B1? You can probably do search over all sources for '#define U' and '#define B1'.

A: The C++ Communication Services Framework hasn't been updated since 2005, whereas Boost::Thread has been updated frequently since then so it's possible that something's changed that has broken backwards compatibility. I'd suggest trying Boost 1.33 to see if it gives the same errors.


text:
Q: interp2d function in Python runtime error I have the following data which in MATLAB is easily being interpolated using the interp2 function. However in Python with the use of interp2d, the following error encounters:
RuntimeWarning: No more knots can be added because the number of B-spline
coefficients already exceeds the number of data points m.
Probable causes: either s or m too small. (fp>s)
    kx,ky=3,3 nx,ny=17,11 m=90 fp=0.000013 s=0.000000
  warnings.warn(RuntimeWarning(_iermess2[ierm][0] + _mess))

I have tried to use griddata, but no luck in that end either.
Any fix to these issues would be much appreciated.
CODE:
OF_S = np.array([[5, 5, 5, 5, 5, 5, 5,     5,     5,     5,     5,     5,     5,     5,     5,     5,     5,     5,     5,     5,     5,     5,     5,     5,     5,     5,     5,     5,     5,     5],
                 [6, 6, 6,     6,     6,     6,     6,     6,     6,     6,     6,     6,     6,     6,     6, 6,     6,     6,     6,     6,     6,     6,     6,     6,     6,     6,     6,     6,     6,     6],
                 [7, 7, 7,     7,     7,     7,     7,     7,     7,     7,     7,     7,     7,     7,     7,     7,     7,     7,     7,     7,     7,     7,     7,     7,     7,     7,     7,     7,     7,     7]])

FT_FTAVAIL_S = np.array([[0.198,     0.205,     0.214,     0.227,     0.237,     0.249,     0.26,     0.271,     0.285,     0.304,     0.332,     0.371,     0.405,     0.436,     0.464,     0.507,     0.548,     0.598,     0.649,     0.694,     0.746,     0.787,     0.822,     0.851,     0.879,     0.914,     0.951,     0.985,     0.999,     1],
                         [0.198,     0.205,     0.214,     0.227,     0.237,     0.249,     0.26,     0.271,     0.285,     0.304,     0.332,     0.371,     0.405,     0.436,     0.464, 0.507,     0.548,     0.598,     0.649,     0.694,     0.746,     0.787,     0.822,     0.851,     0.879,     0.914,     0.951,     0.985,     0.999,     1],
                         [0.198,     0.205,     0.214,     0.227,     0.237,     0.249,     0.26,     0.271,     0.285,     0.304,     0.332,     0.371,     0.405,     0.436,     0.464,     0.507,     0.548,     0.598,     0.649,     0.694,     0.746,     0.787,     0.822,     0.851,     0.879,     0.914,     0.951,     0.985,     0.999,     1.000]])

ISP_ISPAVAIL_S = np.array([[0.9845,     0.9867,     0.9867,     0.9867,     0.9867,     0.9889,     0.9889,     0.9889,     0.9889,     0.9911,     0.9911,     0.9933,     0.9933,     0.9956,     0.9956,     0.9956,     0.9978,     0.9978,     0.9978,     0.9978,     0.9978,     0.9978,     0.9978,     0.9978,     0.9978,     0.9978,     1,     1,     1,     1],
                           [0.9756,     0.9756,     0.9761,     0.9778,     0.9778,     0.9778,     0.9787,     0.9798,     0.98,     0.9804,     0.9827,     0.9844,     0.9855,     0.9867, 0.9889,     0.9892,     0.9911,     0.9927,     0.9933,     0.9942,     0.9956,     0.9956,     0.9978,     0.9978,     0.9978,     0.9978,     0.9988,     1,     1,     1],
                           [0.9662,     0.9662,     0.9662,     0.9679,     0.9685,     0.9697,     0.9707,     0.9709,     0.972,     0.9738,     0.9755,     0.9797,     0.9805,     0.982,     0.9842,     0.9863,     0.9873,     0.9887,     0.991,     0.992,     0.9932,     0.9943,     0.9955,     0.9955,     0.9966,     0.9977,     0.9978,     0.9986,     0.9999,     1]])

ISP_ISPAVAIL_interpGrid = interp2d(FT_FTAVAIL_S, OF_S, ISP_ISPAVAIL_S, kind='cubic')

A: I ended up using griddata instead. The key here is to have flattened data before any interpolation. Therefore I used the .ravel() to do so.
ISP_ISPAVAIL= griddata(
        (FT_FTAVAIL_S.ravel(), OF_S.ravel()), ISP_ISPAVAIL_S.ravel(), (XX, YY), method="nearest")

where XX and YY are some arbitrary bounds for FT_FTAVAIL_S and OF_S respectively.


text:
Q: Build a grouped JSON object I am building a Rails/Backbone app and I will show users in a table.
I want to create a JSON tree which is grouped on the user ID/Name.
This is how it looks now
[{
    "total_entries": 2
},
{
    "entries": [{
            "id": 21,
            "status": "pending",
            "starts_at_date": "2018-02-02",
            "starts_at_time": "12:00",
            "ends_at_date": "2018-02-02",
            "ends_at_time": "12:00",
            "description": "",
            "ttype": "vacation",
            "sum": 0,
            "user": {
                "id": 1,
                "fullname": "Marcus Lurem"
            },
            "timetype": null,
            "pause": 0,
            "can_manage": true
        },
        {
            "id": 22,
            "status": "pending",
            "starts_at_date": "2018-02-07",
            "starts_at_time": "12:00",
            "ends_at_date": "2018-02-07",
            "ends_at_time": "12:00",
            "description": "",
            "ttype": "doctor",
            "sum": 0,
            "user": {
                "id": 2,
                "fullname": "Anna Palmgren"
            },
            "timetype": null,
            "pause": 0,
            "can_manage": true
        }
    ]
}

]
I need it to be grouped on the name.
This is how I build the JSON object now.
json.array! [0,1] do |index|
  if index == 0
    json.total_entries @total
  else
    json.entries @events do |event|
      json.extract! event, :id, :starts_at_date, :starts_at_time, :ends_at_date, :ends_at_time, :description, :ttype
            json.sum event.sum
            json.user event.user, :id, :fullname
            json.can_manage true
        end
  end
end

Update
Should look like this more or less.

*

*Marcus Lurem

*

*Id

*Status

*starts_at_date

*description

*Anna Palmgren

*

*Id

*Status

*starts_at_date

*description

A: You can use something like this:
json.entries @events.group_by(&:user) do |user, events|
  json.user :id, :fullname
  json.events events do |event|
    json.extract! event, :id, :starts_at_date, :starts_at_time, :ends_at_date, :ends_at_time, :description, :ttype
  end
end


text:
Q: WCF Error "This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case" I'm having a problem using a WCF call from a Windows service to my WCF service running on my web server.  This call has been working for a number of weeks, but then stopped working all of a sudden, and has not worked since.
The exception I'm getting is:

General Error Occurred System.ServiceModel.CommunicationException: An error occurred while making the HTTP request

and then it says

This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server.

The security I'm using on both ends is wsHttpBinding, without any kind of encryption.  It also is just using HTTP - not HTTPS, so I'm not sure why it's complaining about HTTPS.
The rest of the inner exception stack is:

SystemNet.WebException: The underlying connection was closed: An unexpected error occurred on a send.
  ---> System.IO.IOException: Unable to write data to the transport connection: An invalid argument was supplied.
  ---> System.Net.Sockets.SocketException: An invalid argument was supplied at System.Net.Sockets.Socket.MultipleSend(BufferOffsetSize[] buffers, SocketFlags socketFlags) at System.Net.Sockets.NetworkStream.MultipleWrite(BufferOffsetSize[] buffers)

I should also note that the point in my program where this occurs is on the "Execute" line of the call to the web service - that is, right as soon as I call the web service and pass it the wrapped up DataContract object, it blows up.
All this service is doing is getting passed a large amount of XML (passed as a .NET object to the call on the client side), which it then does some work with.  Probably about 100-200k of XML is being transmitted.  I've raised the limits for the data sizes on both ends to over 6 megs, but that didn't seem to help.
Any ideas?

Some more information on this issue:
When we duplicate the client environment locally, we find that we cannot upload large amounts of XML unless we make the following changes:
1. On the server, set the "maxRequestLength" to 100 MB (way higher than we are sending)
2. On the client, we set the value of maxItemsInObjectGraph under the dataContractSerializer tag to "2147483646".
With these changes, our local installation uploads successfully.  However, the client's install on their server still fails.  What interesting to note is that once we made the maxRequestLength value change on the server, our test installation started throwing an error specifically relating to the maxItemsInObjectGraph setting.  Whereas on our client's server, still the original "HTTP.sys" error is happening.
As I noted before, we are not using SSL at all, and there are 2 other web services calls that execute and upload XML in the same way.  However, since the non-working service call transmits more data, this appears to be a size issue.
However, if the issue the client is having were the same one our test install had, I don't get why the client error message wouldn't be related to the ObjectGraph error.
Is it possible that we're just getting the generic "invalid parameter" "HTTP.sys" error for every possible error on the client (ie. it's really getting the objectGraph error too, but just isn't showing it?)

A: We had this issue as the host server had been updated to use TLS V1.2 and we were connecting using standard SSL. This was an update made as part of pen testing of the sites. We saw the issue in code connection, but not browsers going to the wsdl.
Below code resolved:
if (System.Net.ServicePointManager.SecurityProtocol == (SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls))
    System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls13;

Taken from here: Disable SSL fallback and use only TLS for outbound connections in .NET? (Poodle mitigation)

A: For us, this error was because the developer's computer running the service had IIS configured to bind port 443 on 127.0.0.1 only.
In IIS Manager, right-click the web site and choose Edit Bindings. If the entry for Port 443 has IP Address 127.0.0.1, change it to *.

A: Change your client application to 4.5 and above.
IF you are 4.5 then use : System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12 / Tls1.1 / Tls1.0 as needed or you can upgrade your application to above 4.6.1.

A: After a lot of searching and taking the lord's name in vain i finally got it.I have installed TLS 1.2 on the Server where my wcf service is running.My client was configured correctly but the it was built on .NET 4.5.1 whereas the wcf was on .NET 4.6.1. Both client and server must be at the same .NET Version if you are using TLS 1.2. I hope it helps someone someday:-)

A: We had nearly this exact same issue occur recently and it turned out to be caused by Microsoft update KB980436 (http://support.microsoft.com/KB/980436) being installed on the calling computer.  The fix for us, other than uninstalling it outright, was to follow the instructions at the KB site for setting the UseScsvForTls DWORD in the registry to 1.  If you see this update is installed in your calling system you may want to give it a shot.

A: I Had the same issue on a service running on IIS 7
the service connects to multiple suppliers servers (some SSL some not)
when adding a new one of these (this new supplier was TLS 1.2) I would get the error after a few requests were made to the original servers (SSL).
To confirm this I simply logged the System.Net.ServicePointManager.SecurityProtocol before each request to each supplier.
Low and behold after restarting the service (or restarting the application pool) I would get the output Ssl3, Tls but after a few requests to the original supplier servers this changed to Ssl3 and requests to the TLS service gave the error.
To fix I simply did what user369142 suggested.
Before each request to the new server:
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3;

and no more errors.

A: If your WCF service is using .net framework 4.0 and someone has disabled TLS 1.0 on the server then you will see this exception. Due to .net 4.0 not supporting the higher versions of TLS.
Supported protocols: https://msdn.microsoft.com/en-us/library/system.security.authentication.sslprotocols(v=vs.100).aspx

A: I had this issue when running older XP SP3 boxes against both IIS and glassfish on Amazon AWS.  Amazon changed their default load balancer settings to NOT enable the DES-CBC3-SHA cipher.  You have to enable that on amazon ELB if you want to allow older XP TLS 1.0 to work against ELB for HTTPS otherwise you get this error. Ciphers can be changed on ELB by going to the listener tab in the console and clicking on cipher next to the particular listener you are trying to make work.

A: Rather than explicitly setting the security protocol, a better way is to set the web.config <compilation targetFramework="4.5"> or higher.

A: I solved my problem by upgrading my .NetFramework version from 4.5.2 to 4.7.2.

A: In my case I had to enable SchUseStrongCrypto for .Net
This forces the server to make connection by using TLS 1.0, 1.1 or 1.2. Without SchUseStrongCrypto enabled the connection was trying to use SSL 3.0, which was disabled at my remote endpoint.
Registry keys to enable use of strong crypto:
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319]
"SchUseStrongCrypto"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319]
"SchUseStrongCrypto"=dword:00000001

A: Had this issue with a true HTTPS binding and the same exception with "This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case...".
After double checking everything in code and config, it seems like the error message is not so misleading as the inner exceptions, so after a quick check we've found out that the port 443 was hooked by skype (on the dev server). I recommend you take a look at what holding up the request (Fiddler could help here) and make sure you can reach the service front (view the .svc in your browser) and its metadata.
Good luck.

A: I've seen these particular exceptions related to Complex DataType issues, see the following post if you're passing around collections or enums:
Complex Data Types

A: If you are using transfer mode = streamed, try changing it to buffered.
If this is not the problem could you post your configuration.

A: Since everything was working fine for weeks then stopped, I doubt this has anything to do with your code.  Perhaps the error is occurring when the service is activated within IIS/ASP.NET, not when your code is called.  The runtime could just be checking the configuration of the web site and throwing a generic error message which has nothing to do with the service.
My suspicion is that a certificate has expired or that the bindings are set up incorrectly.  If the web site is mis-configured for HTTPS, whether your code uses them or not, you may be getting this error.

A: Try to browse the service in the browser and in the Https mode, if it is not brow-sable then it proves the reason for this error. Now, to solve this error you need to check :

*

*https port , check if it is not being used by some other resources (website)

*Check if certificate for https are properly configured or not (check signing authority, self signed certificate, using multiple certificate )

*check WCF service binding and configuration for Https mode

A: Our issue was simply the port number on the endpoint was incorrectly set to 8080.  Changed it to 8443 and it worked.

A: We got this error from outer API...
Nothing above helped us, at the end the issue was that the request was too big!!
So check the error massage from server side if nothing above helping...

A: Just recently experienced this:

System.ServiceModel.CommunicationException:
An error occurred while
making the HTTP request to http://example.com/WebServices/SomeService.svc. This could be due
to the fact that the server certificate is not configured properly
with HTTP.SYS in the HTTPS case. This could also be caused by a
mismatch of the security binding between the client and the server.
---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send.
---> System.IO.IOException: Unable to write data to the transport connection: An existing connection was forcibly closed by the remote
host.

I found out from an administrator that the IIS application pool that was hosting the web service recycled automatically after running out of memory. The error on the client occurred when the application pool recycled.
Increasing the memory available to the application pool resolved the immediate issue.

A: Our applications were recently forced off of SSL to TLS via a network appliance (F5) OS update. We fixed this error by re-generating the self-signed certs. Hope this helps someone in the future to resolve the issue as we spent multiple maintenance windows troubleshooting before arriving at the solution.

A: Just recently experienced this:
System.ServiceModel.CommunicationException:
An error occurred while making the HTTP request to http://example.com/WebServices/SomeService.svc. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server.
---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send.
---> System.IO.IOException: Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host.
Our license of the bluecoat proxy was expired! so it was not possible to to reach the external party (internet).

A: We had the same issue and, in our case, it was resolved by reinstalling the certificate and creating the binding again.
What lead us there was the fact that even getting a simple png image file on the site give the same error.


text:
Q: Assign Linux Command to Variable in Groovy I'm attempting to run a linux command, curl, through groovy, and would like the output to be assign to a variable. I'd like to do this, so I can extract specific data from the curl output, and use in in m y groovy script.
Any ideas, how I can do this.
I've tried,
def after = "curl \"https://test.com\"".execute()
def after = "curl \"https://test.com\"".execute().text

but the variable is always empty. Any help would be appreciated.

A: linux command with spaces needs to be separated.
["/bin/sh", "-o", "your_command"].execute()

In your case it would be something like below:
["curl", "https://test.com"].execute()

OR
def after = ["curl", "https://test.com"].execute().text

Try and see if it works.


text:
Q: Finding the contour of a pair of multi-variable functions I have two functions f[x,y,z,a,b] and g[x,y,z,a,b], where the variables are restricted to a set of values: x $\in$ [x0, x1], y $\in$ [y0, y1], z $\in$ [z0, z1], a $\in$ [a0, a1], b $\in$ [b0, b1]. I can find the minimum and maximum values within the restrictions using Minimize and Maximize.
These two functions are the X and Y coordinates of a point, I am using them to show some paths using ParametricPlot and to draw graphics using Graphics. The thing is, I need to know the boundaries which define the possible locations of the point.
How could I find the contour of the area for which the (X,Y) plot of these two functions is defined?
EDIT1:
I have tried to do it in two different ways.
1.
Using ParametricRegion:

R = ParametricRegion[{Xt[X2, Th3, La1, La2, La3, La4,
        La5] /. {X2 -> X2in,
        La3 -> La3in} /. {Th3 -> Th3in,
       La4 -> La4in, La5 -> La5in},     Yt[X2, Th3, La1, La2, La3, La4, La5] /. {X2 -> X2in,
        La3 -> La3in} /. {Th3 -> Th3in,
       La4 -> La4in, La5 -> La5in}}, {{La1, dA1min, dA1max}, {La2,
      dA2min, dA2max}}];

And trying to represent it by:

Region[R]

This is not able to give a result (it is still running after about 10h and 8GB of RAM).
2.
Using ParametricPlot

ParametricPlot[{{Xt[X2, Th3, La1, La2, La3, La4, La5],
      Yt[X2, Th3, La1, La2, La3, La4, La5]}} /. {X2 ->
      X2min, Th3 -> Th3min, La3 -> dA3min,     La4 -> dA4min, La5 -> dA5min}, {La1, dA1min, dA1max}, {La2, dA2min,    dA2max}, AspectRatio
  -> Automatic]

This is able to give a result relatively fast (40s and <2GB of RAM).

But unfortunately, ParametricPlot can't plot regions depending on more than 2 variables.
Just to give some insight into the problem, (Xt, Yt) give the position of a point from a body in a machine. I need to obtain the 'range of action' of this point. I need to find the contour of the area (or the area itself) in which the point can be located. The problem is that the point depends on 5 (6) variables.

A: The dark blue region is the place where different combinations of parameter values give the same (X,Y) combination. Maybe this superposition/overlap of points is the reason why ParametricRegion is not able to give an output.
I have more or less found the solution to this: plotting variables in pairs with the correct choice of maximum and minimum values and overlapping them.
The output is:

Once checked that this visual representation covers the whole region, it is now possible to identify the curves that define the edges and draw only them.


text:
Q: How to avoid hardcoding of colors in D3 I've taught myself d3 (still learning), and have a finished visualisation that I'm more than happy with.
But i think (know) that the code can be improved and made more efficient. For instance, use a csv file for the data (don't know where to begin with that). But more specifically, i'd like to know how the hard coded colours  can be used directly with d3, but categorised by cancer, diabetes, CHD (exactly how i've hardcoded them). Additionally, rather than use the messy html and css i have for the titles, is there anything that can be done via d3?
I believe i'm pretty good with html and css, but i was a little daunted by d3 and the html/css are inherently mess.
I've attached an image of what it looks like (please ignore the data under South England: I know it's duplicated; I have to replace them with the actual data).
@import url("https://fonts.googleapis.com/css?family=Lato:300");

rect {
  stroke: white;
}
text {
  font-family: "Lato";
  fill: white;
  font-size: 8px;
  text-anchor: middle;
}

svg {
  padding-left: 60px;
  padding-top:17px;
  position: fixed;
}

p {
  font-size: 14px;
}

.p1 {
  position: absolute;
  font-family: "Lato";
  font-size: 17px;
  padding-left: 60px;
}

.p2 {
  position: absolute;
  font-family: "Lato";
  font-size: 17px;
  padding-left: 550px;
}

.p3 {
  position: absolute;
  font-family: "Lato";
  padding-left: 60px;
  padding-top: 35px;
}

.p4 {
  position: absolute;
  font-family: "Lato";
  padding-left: 230px;
  padding-top: 35px;
}

.p5 {
  position: absolute;
  font-family: "Lato";
  padding-left: 380px;
  padding-top: 35px;
}

.p6 {
  position: absolute;
  font-family: "Lato";
  padding-left: 60px;
  padding-top: 390px;
}

.p7 {
  position: absolute;
  font-family: "Lato";
  padding-left: 283px;
  padding-top: 390px;
}

.p8 {
  position: absolute;
  font-family: "Lato";
  padding-left: 553px;
  padding-top: 35px;
}

.p9 {
  position: absolute;
  font-family: "Lato";
  padding-left: 723px;
  padding-top: 35px;
}

.p10 {
  position: absolute;
  font-family: "Lato";
  padding-left: 896px;
  padding-top: 35px;
}

.p11 {
  position: absolute;
  font-family: "Lato";
  padding-left: 552px;
  padding-top: 380px;
}

.p12 {
  position: absolute;
  font-family: "Lato";
  padding-left: 810px;
  padding-top: 380px;
}

<!DOCTYPE html>
<meta charset="utf-8">

  <title>TreeMap</title>
  <link rel="stylesheet" type="text/css" href="stylesheet.css" />

  <svg width="1200" height="720">
    <g></g>

 North England

 South England

 Bradford City

 Leeds

 Liverpool

 Manchester

 Sheffield

 Brighton

 Bristol

 Luton

 Milton Keynes

 Southampton

      <object class="Box" class="cancer"></object>

  </svg>

A: Normal way for d3 - it is a using ordinal color scale. You should associate names of disease with appropriate colors:
var namesOfDisease = ["Cancer", "CKD", "CHD", "Diabetes", "Stroke"];

var color = d3.scaleOrdinal()
  .domain(namesOfDisease)
  .range(["#A8A7A7", "#2F9599" , "#E8175D", "#474747", "#CC527A"]);

It returns appropriate color when you pass desease name as argument:
console.log(color("Cancer")) // ==> #A8A7A7
console.log(color("CHD")) // ==> #E8175D
console.log(color("Stroke")) // ==> #CC527A

And use this scale for color applying:
...
.attr('fill', function(d) {
    var result = null;

  if (namesOfDisease.indexOf(d.data.name) >= 0) {
    result = color(d.data.name);
  } else {
    result = 'white'
  }

  return result;
})
...

Check demo without hardcoded colors in the hidden snippet:

var data = {
  "name": "England",
  "children": [
    {
      "name": "North England",
      "children": [
        {
          "name": "Bradford City",
          "children": [
            {
              "name": "Cancer",
              "value": 1.18,
            },
            {
              "name": "CKD",
              "value": 3.21,
            },
            {
              "name": "CHD",
              "value": 2.57,
            },
            {
              "name": "Diabetes",
              "value": 11.92,
            },
            {
              "name": "Stroke",
              "value": 1.18,
            }
          ]
        },
        {
        "name": "Leeds",
        "children": [
          {
            "name": "Cancer",
            "value": 2.50,
          },
          {
            "name": "CKD",
            "value": 3.52,
          },
          {
            "name": "CHD",
            "value": 3.29,
          },
          {
            "name": "Diabetes",
            "value": 6.71,
          },
          {
            "name": "Stroke",
            "value": 1.82,
          }
        ]
      },
      {
        "name": "Liverpool",
        "children": [
          {
            "name": "Cancer",
            "value": 2.50,
          },
          {
            "name": "CKD",
            "value": 5.90,
          },
          {
            "name": "CHD",
            "value": 3.71,
          },
          {
            "name": "Diabetes",
            "value": 6.70,
          },
          {
            "name": "Stroke",
            "value": 1.88,
          }
        ]
      },
      {
        "name": "Manchester",
        "children": [
          {
            "name": "Cancer",
            "value": 1.78,
          },
          {
            "name": "CKD",
            "value": 2.95,
          },
          {
            "name": "CHD",
            "value": 2.61,
          },
          {
            "name": "Diabetes",
            "value": 7.05,
          },
          {
            "name": "Stroke",
            "value": 2.13,
          }
        ]
      },
      {
        "name": "Sheffield",
        "children": [
          {
            "name": "Cancer",
            "value": 2.54,
          },
          {
            "name": "CKD",
            "value": 4.57,
          },
          {
            "name": "CHD",
            "value": 3.85,
          },
          {
            "name": "Diabetes",
            "value": 7.08,
          },
          {
            "name": "Stroke",
            "value": 2.13,
          }
        ]
      },
    ]
  },
  {
    "name": "South England",
    "children": [
      {
        "name": "Brighton",
        "children": [
          {
            "name": "Cancer",
            "value": 1.18,
          },
          {
            "name": "CKD",
            "value": 3.21,
          },
          {
            "name": "CHD",
            "value": 2.57,
          },
          {
            "name": "Diabetes",
            "value": 11.92,
          },
          {
            "name": "Stroke",
            "value": 1.18,
          }
        ]
      },
      {
        "name": "Bristol",
        "children": [
          {
            "name": "Cancer",
            "value": 1.18,
          },
          {
            "name": "CKD",
            "value": 3.21,
          },
          {
            "name": "CHD",
            "value": 2.57,
          },
          {
            "name": "Diabetes",
            "value": 11.92,
          },
          {
            "name": "Stroke",
            "value": 1.18,
          }
        ]
      },
      {
        "name": "Luton",
        "children": [
          {
            "name": "Cancer",
            "value": 1.18,
          },
          {
            "name": "CKD",
            "value": 3.21,
          },
          {
            "name": "CHD",
            "value": 2.57,
          },
          {
            "name": "Diabetes",
            "value": 11.92,
          },
          {
            "name": "Stroke",
            "value": 1.18,
          }
        ]
      },
      {
        "name": "Milton Keynes",
        "children": [
          {
            "name": "Cancer",
            "value": 1.18,
          },
          {
            "name": "CKD",
            "value": 3.21,
          },
          {
            "name": "CHD",
            "value": 2.57,
          },
          {
            "name": "Diabetes",
            "value": 11.92,
          },
          {
            "name": "Stroke",
            "value": 1.18,
          }
        ]
      },
      {
        "name": "Southampton",
        "children": [
          {
            "name": "Cancer",
            "value": 1.18,
          },
          {
            "name": "CKD",
            "value": 3.21,
          },
          {
            "name": "CHD",
            "value": 2.57,
          },
          {
            "name": "Diabetes",
            "value": 11.92,
          },
          {
            "name": "Stroke",
            "value": 1.18,
          }
        ]
      },
      ]
    }
  ]
};

var treemapLayout = d3.treemap()
  .size([1000, 600])
  .paddingTop(20)
  .paddingInner(8);

var rootNode = d3.hierarchy(data)

rootNode.sum(function(d) {
  return d.value;
});

treemapLayout(rootNode);

var namesOfDisease = ["Cancer", "CKD", "CHD", "Diabetes", "Stroke"];

var color = d3.scaleOrdinal()
  .domain(namesOfDisease)
  .range(["#A8A7A7", "#2F9599" , "#E8175D", "#474747", "#CC527A"]);

var nodes = d3.select('svg g')
  .selectAll('g')
  .data(rootNode.descendants())
  .enter()
  .append('g')
  .attr('transform', function(d) {return 'translate(' + [d.x0, d.y0] + ')'})

  nodes
    .append('rect')
    .attr('width', function(d) { return d.x1 - d.x0; })
    .attr('height', function(d) { return d.y1 - d.y0; })
    .attr('opacity', function(d) { return 0.8 /* has to be like d.value / max or so */ })
    .attr('fill', function(d) {
     var result = null;

      if (namesOfDisease.indexOf(d.data.name) >= 0) {
       result = color(d.data.name);
      } else {
       result = 'white'
      }

      return result;
    })
  nodes
    .append('text')
    .attr('dx', 10)
    .attr('dy', 8)
        .text(function(d) {
      return d.data.value;
  });
rect {
  stroke: white;
}
text {
  font-family: "Lato";
  fill: white;
  font-size: 8px;
  text-anchor: middle;
}

svg {
  padding-left: 60px;
  padding-top:17px;
  position: fixed;
}

p {
  font-size: 14px;
}

.p1 {
  position: absolute;
  font-family: "Lato";
  font-size: 17px;
  padding-left: 60px;
}

.p2 {
  position: absolute;
  font-family: "Lato";
  font-size: 17px;
  padding-left: 550px;
}

.p3 {
  position: absolute;
  font-family: "Lato";
  padding-left: 60px;
  padding-top: 35px;
}

.p4 {
  position: absolute;
  font-family: "Lato";
  padding-left: 230px;
  padding-top: 35px;
}

.p5 {
  position: absolute;
  font-family: "Lato";
  padding-left: 380px;
  padding-top: 35px;
}

.p6 {
  position: absolute;
  font-family: "Lato";
  padding-left: 60px;
  padding-top: 390px;
}

.p7 {
  position: absolute;
  font-family: "Lato";
  padding-left: 283px;
  padding-top: 390px;
}

.p8 {
  position: absolute;
  font-family: "Lato";
  padding-left: 553px;
  padding-top: 35px;
}

.p9 {
  position: absolute;
  font-family: "Lato";
  padding-left: 723px;
  padding-top: 35px;
}

.p10 {
  position: absolute;
  font-family: "Lato";
  padding-left: 896px;
  padding-top: 35px;
}

.p11 {
  position: absolute;
  font-family: "Lato";
  padding-left: 552px;
  padding-top: 380px;
}

.p12 {
  position: absolute;
  font-family: "Lato";
  padding-left: 810px;
  padding-top: 380px;
}

<svg width="1200" height="720">
    <g></g>

 North England

 South England

 Bradford City

 Leeds

 Liverpool

 Manchester

 Sheffield

 Brighton

 Bristol

 Luton

 Milton Keynes

 Southampton

      <object class="Box" class="cancer"></object>

  </svg>


text:
Q: C# LinearGradientBrush glitch when minimizing screen I have the following code to create a blended background on my winform:
public partial class Aging : Form
{
    protected override void OnPaintBackground(PaintEventArgs e)
    {
        using (var brush = new LinearGradientBrush(this.ClientRectangle,
        Color.Transparent, Color.Transparent, LinearGradientMode.Vertical))
        {
            var blend = new ColorBlend();
            blend.Positions = new[] { 0, 3 / 10f, 1 };
            blend.Colors = new[] { Color.WhiteSmoke, Color.LightSteelBlue, Color.LightSteelBlue };
            brush.InterpolationColors = blend;
            e.Graphics.FillRectangle(brush, this.ClientRectangle);
        }
    }

The result is a color background that fades from LightSteelBlue to WhiteSmoke:

The problem is that if I minimize the screen and then, maximize, the application no longer shows the background:

This is the exception message I'm getting:
System.ArgumentException: Rectangle '{X=0,Y=0,Width=0,Height=0}' cannot have a width or height equal to 0.
at System.Drawing.Drawing2D.LinearGradientBrush..ctor(Rectangle rect, Color color1, Color color2, LinearGradientMode linearGradientMode)
at AgingStatusDb.Aging.OnPaintBackground(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
at System.Windows.Forms.Control.WmEraseBkgnd(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)

I'm not that savvy and I'm not been able to figure out the source of the glitch. Any help would be appreciated.

A: To resolve the exception, just follow what the exception message said:

Rectangle '{X=0,Y=0,Width=0,Height=0}' cannot have a width or height
  equal to 0.

So you can simply check if ClientRectangle.Width==0 or  ClientRectangle.Height==0 then do nothing and just return.
But after fixing the error you will have a black background after a minimize and restore.
If you want to draw background of a form, above code needs some corrections:

*

*You need to set control to redraw itself when resized. To do so, you should set this.SetStyle(ControlStyles.ResizeRedraw, true); in constructor.

*You need to enable double buffering to prevent flicker. So in constructor set this.DoubleBuffered = true;.
Code
public Form1()
{
    InitializeComponent();
    this.DoubleBuffered = true;
    this.SetStyle(ControlStyles.ResizeRedraw, true);
}
protected override void OnPaintBackground(PaintEventArgs e)
{
    if (ClientRectangle.Width == 0 || ClientRectangle.Height == 0) return;
    using (var brush = new LinearGradientBrush(this.ClientRectangle,
        Color.Transparent, Color.Transparent, LinearGradientMode.Vertical))
    {
        var b = new ColorBlend();
        b.Positions = new[] { 0, 3 / 10f, 1 };
        b.Colors = new[] { Color.WhiteSmoke, Color.LightSteelBlue, Color.LightSteelBlue };
        brush.InterpolationColors = b;
        e.Graphics.FillRectangle(brush, this.ClientRectangle);
    }
}

A: There is simplest way to do fading background.
Create an image with a gradient in a graphics editor or using your code, but save it:
protected override void OnLoad(EventArgs e)
{
    using (var brush = new LinearGradientBrush(this.ClientRectangle,
        Color.Transparent, Color.Transparent, LinearGradientMode.Vertical))
    {
        var blend = new ColorBlend();
        blend.Positions = new[] { 0, 3 / 10f, 1 };
        blend.Colors = new[] { Color.WhiteSmoke, Color.LightSteelBlue, Color.LightSteelBlue };
        brush.InterpolationColors = blend;

        using (var bmp = new Bitmap(ClientRectangle.Width, ClientRectangle.Height))
        {
            var g = Graphics.FromImage(bmp);
            g.FillRectangle(brush, ClientRectangle);
            bmp.Save("background.png", ImageFormat.Png);
        }
    }
}

Run and close the app. Then remove that code.
In the end, set the form background image, which was created in the previous step:
this.DoubleBuffered = true;
this.BackgroundImageLayout = ImageLayout.Stretch;
this.BackgroundImage = new Bitmap("background.png");


text:
Q: Using fft() in Matlab I have a function defined like:
$$x(t)=2e^{-\frac{r}{2}t}\sin\left(\frac{1}{2}\sqrt{16\pi^2-r^2}\cdot t\right)\left(\frac{\Theta(t)}{\sqrt{16\pi^2-r^2}}\right)
$$ Where $\Theta(t)$ is the Heaviside Theta funcion. If I perform the Fourier Transform of x(t) I have:
$$X(\omega)=\frac{2 \sqrt{\frac{32 \pi -\frac{1}{2 \pi }}{16 \pi
   ^2-\frac{1}{4}}}}{-4 \omega^2-2 i \omega+16 \pi ^2}$$
Now I define on Matlab $t=linspace(0,10,2^8)$, and $y=fft(x(t))$ and try to plot the analytical $X(\omega)$ with the coefficient by fft but but they are differnt. Can someone suggest me a good way to do?
Here is my code :
  x=@(t)2*e.^(-r/2*t).*sin(1/2*sqrt(16*pi^2-r.^2).*t).*...
  (1*heaviside(t))./(sqrt(16*pi^2-r.^2));
  e=exp(1); M=1; K=4*pi^2; C=1/2;
  om=sqrt(4*K-C^2)/2; t=linspace(0,10,2^7);
  punti=x(t); N=length(punti); FFT=fft(punti);
  pseudoperiodo=2*pi/om;
  dw=(2*pi)/pseudoperiodo;
  N=length(punti); FFT=FFT/N; % calculate coefficient
  w=dw*[[0:N/2],-[N/2-1:-1:1]]';
  figure
  plot(w(1:N/2+1),abs(FFT(1:N/2+1)),'o')
  figure
  G=tf(1,[M C K]); bode(G)


text:
Q: Diferença entre datas Sempre que passo a diferença de datas no mesmo mês, dá certo, mas quando é entre meses diferentes, vem um valor negativo. Como eu faço uma diferença entre datas? Veja o meu código. O erro está em total
Código
if (($("#txtDateStart").val().split("/") == "") && ($("#txtDateEnd").val().split("/") == "")) {
    data1 = new Date();
    data2 = new Date();
}
else {
    var dtInicio = $("#txtDateStart").val().split("/");
    var dtFim = $("#txtDateEnd").val().split("/");
    data1 = new Date(dtInicio[2] + "/" + dtInicio[1] + "/" + dtInicio[0]);
    data2 = new Date(dtFim[2] + "/" + dtFim[1] + "/" + dtFim[0]);
}
var total = data2.getDate() - data1.getDate();

A: Exemplo:
date1 = new Date('2014/01/01');
date2 = new Date('2014/04/01');
var diferenca = Math.abs(date1 - date2); //diferença em milésimos e positivo
var dia = 1000*60*60*24; // milésimos de segundo correspondente a um dia
var total = Math.round(diferenca/dia); //valor total de dias arredondado

A: Me baseei numa das melhores respostas do SO em inglês e apliquei ao seu caso concreto:
if ( ($("#txtDateStart").val().split("/") == "") &&
     ($("#txtDateEnd").val().split("/") == "") ) {
   data1 = new Date();
   data2 = new Date();
}
else {
   var dtInicio = $("#txtDateStart").val().split("/");
   var dtFim = $("#txtDateEnd").val().split("/");
   data1 = new Date(dtInicio[2] + "/" + dtInicio[1] + "/" + dtInicio[0]);
   data2 = new Date(dtFim[2] + "/" + dtFim[1] + "/" + dtFim[0]);
}
var total = dateDiferencaEmDias( data1, data2 );

// a e b são objetos Date do JS
function dateDiferencaEmDias(a, b) {
   // Descartando timezone e horário de verão
   var utc1 = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate());
   var utc2 = Date.UTC(b.getFullYear(), b.getMonth(), b.getDate());

   return Math.floor((utc2 - utc1) / ( 1000 * 60 * 60 * 24) );
}

A: var total = (((Date.parse(data2)) - (Date.parse(data1))) / (24 * 60 * 60 * 1000));


text:
Q: function sending a null value to php file I've got a function which sends the "id" value to a php file but all it's send is null.. can anyone spot why?
(the value of id is not null)
function send(point, name, message, type, file, id, lat, lng) {
var html = "" + name + "
" + message + '' + '
 id = ' + id + "<a href=delete.php?id="+ <?php echo "\"".$nt['id']."\""?> +">Delete Entry";
}

A: you appear to use a javascript argument id and php variable $nt['id'] in your code, I'd assume you either need to use one or the other - logic dictates that if the js argument id is not null then you use that, if the PHP variable $nt['id'] is not null then use that.
If they are both null then you need to be checking more of the script that just this little snippet :)
function send(point, name, message, type, file, id, lat, lng) {
  var html = '' + name + '
'
   + message
   + ''
   + '
 id = <?php echo $nt['id']; ?>">'
   + '<a href="delete.php?id=<?php echo $nt['id']; ?>">Delete Entry';
}

or
function send(point, name, message, type, file, id, lat, lng) {
  var html = '' + name + '
'
   + message
   + ''
   + '
 id = ' + id
   + 'Delete Entry';
}

may also be worth pointing out you really shouldn't be using GET params for a script such as 'delete.php' - what happens if they have a link checker, anti virus, or internet speeder which pre requests links? and technically, GET is a 'safe' HTTP method (a client should expect no action to be taken and no change to any resources to be made in response to a gET on an URL).


text:
Q: Moving non-writeable files vs moving non-writeable directories I'm a bit puzzled about the following behavior (Linux, Debian 8.3, ext2 filesystem)
test@linux:~$ ls -ld directory/ file
drwxr-xr-x 2 root root 4096 Mar 10 18:51 directory/
-rw-r--r-- 1 root root    8 Mar 10 18:51 file
test@linux:~$ ls -ld target_directory/
drwxr-xr-x 2 test test 4096 Mar 10 18:47 target_directory/
test@linux:~$ mv file target_directory/
test@linux:~$ mv directory/ target_directory/
mv: cannot move 'directory/' to 'target_directory/directory': Permission denied

And that's even the case if directory/ is empty. Funny: rmdir directory/ works in that case.  Why? It would be nice to know why mv behaves so differently for a file and a directory, that both don't have write permissions.

Actually in the vein of "give a man a fish...", don't hesitate to point me to a book which explains this and the permissions system correctly because (mini-rant) I constantly see stuff like that (from a well-known Linux book):

$ ls -ld ch3 test
-rw-rw-r-- 1 joe sales 4983 Jan 18 22:13 ch3
drwxr-xr-x 2 joe sales 1024 Jan 24 13:47 test

The first line shows that the ch3 file has read and write permission for the owner and the group. All other users have read permission, which means they can view the file but cannot change its contents or remove it.

PS/Warning: Yes, the description in the passage above is factually wrong. Don't tell me that or "correct" the post. I just quoted it here to illustrate how much half-knowledge about this issue is floating around.

A: Removing a directory or a file has only to do with permissions on the directory which contains the file/dir to be removed.  Permissions on the file/dir itself are irrelevant.  Hence why you can remove directory using rmdir even though it's owned by root: you didn't show it in your output, but you clearly have read, write and execute permissions on the directory which contains directory.
I've written more elsewhere on what exactly each individual permission on a directory lets you accomplish.
As for why you can't move directory into target_directory, I'm not sure.  I'm unable to reproduce this on my box.  There are a host of reasons that could be causing this, ranging from extended attributes being set on directory, to the possibility that target_directory could be a mount point for a separate filesystem than that which contains directory.  Permissions alone aren't the reason, however.
(P.S.: Next time pick better example names; using the names "directory" and "file" make it really annoying to try to describe what's happening.)

A: Might it be because moving the directory into target directory changes the .. entry inside directory and since you're not allowed to write in directory, it is not permitted?
I experienced the same (and was puzzled similarly as OP) with a directory that was mine, but the owner-write permission wasn't set. Simply setting chmod u+w on the directory made me allow the move (on the same partition, no copying and deleting). After reading this thread, it made me realize the above situation. It fully explains why with files there is no such problem.


text:
Q: for searching between specific lines in a file with only FIND command in linux command i want to use only FIND command in linux and search between specific lines in a file for example find a word "hello" between lines 2 and 4 of a file named test.txt,please help.

A: By this way you can use grep command but not using find for sure.
grep -w "hello" test.txt

A: The following example uses find to display all .txt files containing the word "hello":
find -name '*.txt' -exec grep -q hello \{\} \; -a -exec echo \{\} \;

You might be able to modify the grep expression to only match where the targeted word is between certain lines.
If your teacher is asking you not to find files which have this match but is instead asking you to match within a specific known file then they have misinformed you - find is most certainly not the command for that job, making your question unanswerable.


text:
Q: Not able to change the Service StartMode I am automating an application deployment.
After installing and starting the service via Choco, I am trying to change the Service StartMode to Auto, but I am getting 21 as the returnvalue and hence the mode is not changed.
PS C:\Windows\system32> $appservice = Get-WmiObject -Class Win32_Service -Filter "Name='<app_name>'"

PS C:\Windows\system32> $appservice.ChangeStartMode("Auto")

__GENUS          : 2
__CLASS          : __PARAMETERS
__SUPERCLASS     :
__DYNASTY        : __PARAMETERS
__RELPATH        :
__PROPERTY_COUNT : 1
__DERIVATION     : {}
__SERVER         :
__NAMESPACE      :
__PATH           :
ReturnValue      : 21
PSComputerName   :

PS C:\Windows\system32> Get-WmiObject -Class Win32_Service -Filter "Name='<app_name>'"

ExitCode  : 0
Name      : <app_name>
ProcessId : 3180
StartMode : Manual
State     : Running
Status    : OK

Kindly help.
TIA

A: Try
Get-Service -Name 'TheServiceName' | Set-Service –StartupType Automatic


text:
Q: Angular 4 : Cannot read property 'nativeElement' of undefined I am trying to click an accordion manually when a component gets loaded .But in my case I got the console error as I mentioned in the title and the accordion also not get clicked .
accordion :

                {{data?.CAMD_ENTITY_DESC}}

                                {{group?.CAMD_PRGRP_DESC}}

                                {{subgroup?.CAMD_PRSGRP_DESC}}

Here I have given #accordion to get the elementRef.
component
export class TwoComponent implements OnInit, AfterViewInit {
  dropdownData: any;
  id: number = 0;

  @ViewChildren('accordion') a: QueryList<ElementRef>;

  constructor(private route: ActivatedRoute, private CartdataService: CartdataServiceService) { }

  ngOnInit() {
    this.CartdataService.get_New_Products().subscribe(
      data => {
        this.dropdownData = data;
      });
  }

  ngAfterViewInit() {
    this.a.changes.subscribe(() => {
      let elementRef = this.a.toArray()[this.id];
      $(elementRef.nativeElement).trigger("click");
    });
  }

}

Can anyone help me to fix this issue .

A: If you want trigger click without clicking you have use nativeElement.click
ngAfterViewInit() {
    this.a.changes.subscribe(() => {
      let elementRef = this.a.toArray()[this.id];
       this.a.nativeElement.click;
    });
  }
}


text:
Q: Universal iteration over all elements of: nested list, numpy array, pandas dataframe I am trying to write a function that applies to each element of the argument provided, whether the argument is a nested python list, a numpy array or a pandas dataframe or series.
Example: (not working)
import numpy as np
import pandas as pd

a = [[1,2,3,4,5], [6,7,8,9,10]]
b = np.array(a)
c = pd.DataFrame(a)

def printElement(x):
    print x

def iterateOverElements(arg):
    for element in arg:
        printElement(element)

iterateOverElements(a)
iterateOverElements(b)
iterateOverElements(c)

Desired output: printing 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 in new lines for each of the three calls. (Order is unimportant.)
True output:
[1, 2, 3, 4, 5]
[6, 7, 8, 9, 10]
[1 2 3 4 5]
[ 6  7  8  9 10]
0
1
2
3
4

As expected, the nested list iterates over its sub-lists, the numpy array over its rows and the pandas dataframe over its column labels.
Is there a concise way to achieving my goal, or do I need to check the instance of the argument and construct different iteration codes for different types? If I need to type-check, is there a way of importing e.g. pandas just to type-check and find out that it was a nested list after all?
Again, I do not care about the order in which I iterate over the elements, just that it is really the "basic" elements rather than some sub-collection.

A: I would suggest something like this:
def printElements(arg):
    x = arg.iterrows() if isinstance(arg, pd.DataFrame) else arg

    try:
        for element in x:
            printElements(element)
    except:
        print x

A: Turn everything into a NumPy array and use the flat iterator:
def iterateOverElements(arg):
    for element in np.asarray(arg).flat:
        printElement(element)


text:
Q: Using R while loop to generate random variables I want to generate a random variable X by continuing generating U(0,1) random variables as long as their product falls below exp(-2). Then my random variable X would be equal to the number of U(0,1) random variables that was generated minus 1.
I tried using the while loop to do it but not sure why the code does not return anything in my console. Please help me point out what I did wrong?
p <- 1
counter <- 0

while(p < exp(-2)) {
  u <- runif(1)
  p <- p*u
  counter <- counter+1

  X <- counter - 1
  print(X)
}

A: update
If you want to replicate the process by 100 times, you can use replicate
replicate(
    100,
    {
        p <- 1
        counter <- 0
        repeat {
            p <- p * runif(1)
            counter <- counter + 1
            if (p < exp(-2)) {
                break
            }
        }
        counter
    }
)

I guess you could use repeat with condition p < exp(-2)
p <- 1
counter <- 0
repeat {
    print(counter)
    p <- p * runif(1)
    counter <- counter + 1
    if (p < exp(-2)) {
        print(counter)
        break
    }
}


text:
Q: Opencv solvepnp not returning the center of the object I'm learning opencv and I need to find the distance and angle from the camera to a ball in a picture. My steps so far to do this are:

*

*Get a contour surrounding the ball

*Use minEnclosingCircle to turn the contour into a perfect circle

*Use solvePnP with 5 points on the circle to find the actual location of the ball

The issue I'm having is that tvec[0][0], the x distance from the center of the camera returned from solvePnP, is taken from the leftmost point on the circle, not the center of the circle. This causes my angle calculations to get the angle between the center of the camera and the leftmost point of the ball, instead of the center of the ball.
The code that runs the calculations on the contour is below:
def process_circle_cnt(cnt):
    obj_p = np.array([
        [5.5, 5.5, 0],
        [0, 5.5, 0],
        [11, 5.5, 0],
        [5.5, 0, 0],
        [5.5, 11, 0]
    ])

    (x, y), radius = cv.minEnclosingCircle(cnt)
    img_p = np.array([
        (x, y),
        (x - radius, y),
        (x + radius, y),
        (x, y - radius),
        (x, y + radius)
    ])

    _, rvec, tvec = cv.solvepnp(obj_p, img_p, camera_matrix, dist_matrix)
    x = tvec[0][0]
    z = tvec[2][0]
    distance = math.sqrt(x**2 + z**2)
    angle = math.degrees(math.atan2(x, z))

Thanks for your help!

A: You can measure the distance between the left-most point (where the translation vector falls) and the center of the circle, then apply the Pythagorean theorem to calculate the distance from camera center to circle center.


text:
Q: How to set Android button inside dialog that was called from listview? I have code that goes like this:
public class Screening extends ListActivity implements OnClickListener{
...
Button screeningOK, set, cancel;
...
@Override
protected void onListItemClick(ListView l, View v, int position, long id)
{
    super.onListItemClick(l, v, position, id);
    int listPosition = position;

    switch(listPosition){
    case _AGESELECTION:
        Dialog d = new Dialog(Screening.this);
        d.setTitle(R.string.ageselector_title);
        set = (Button)d.findViewById(R.id.bSet);
        cancel = (Button)d.findViewById(R.id.bCancel);
        //set.setOnClickListener(this);

        cancel.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                finish();
            }
        });
        d.setContentView(R.layout.agedialog);
        d.show();

    break;

So short explanation, I have a list that opens dialog.
Dialog has NumberPicker, set and cancel buttons.
Now, on Set, I'd like to save NumPicker value, and cancel to cancel dialog. (finish(); will most likely finish activity but that's not the issue, issue is that no matter if I set new on click listener like:
set.setOnClickListener(this);

or
cancel.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            finish();
        }
    });

It crashes my app with Null pointer exception.
There is onClick function within main class because original activity consists of list, radio buttons and Save Button.
I assume something with the fact that I already have onClickListener is giving me hard time here, but can't figure out what.
Please Advise.
tnx.