text:
Q: React project simple import doesn't work This is my module.
src/components/Experiment.jsx

import React from 'react';

class Experiment extends React.Component {

  render() {
    if (Array.isArray(this.props.children)) {
      const activeVariant = this.props.children.filter((c) => {
        return c.props.id === this.props.activeVariant;
      });

      return (

          {activeVariant}

      );
    }
    return (

        {this.props.children}

    );
  }
};

export default Experiment;

It's a simple module and it works on its own repository. Like I have a test and everything is working fine.
However, once I published the project to a private npm and started using it. I get this error.
SyntaxError: Unexpected reserved word
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:414:25)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/Users/ncharass/MyProjects/CN/project/lib/app/views/pages/app/views/pages/article.js:16:1)

And this is the import line
import Experiment from '@organization/project/src/components/Experiment.jsx';

If I changed the path to just Experiment without jsx I get Cannot find module so I know that it found the module but I'm not sure why it would error out like that.
I use webpack and this is the config.
'use strict';

var path = require('path');
var webpack = require('webpack');
var env = process.env.NODE_ENV || 'development';

module.exports = {
  devtool: env === 'development' ? '#cheap-inline-source-map' : '',
  module: {
    loaders: [
      {
        test: /\.json$/,
        loader: 'json-loader'
      },
      {
        test: /\.(js|jsx)$/,
        loader: 'babel-loader',
        include: [
          /config/,
          /src/
        ],
        query: {
          babelrc: false,
          presets: [
            'es2015-webpack',
            'react'
          ]
        }
      },
      {
        test: /\.(js|jsx)$/,
        loader: 'transform?envify',
        cacheable: true
      }
    ]
  },
  resolve: {
    extensions: ['', '.js', '.jsx'],
    modules: [
      path.resolve('./src'),
      './node_modules'
    ]
  },
  plugins: env !== 'development' ? [
    new webpack.optimize.DedupePlugin(),
    new webpack.LoaderOptionsPlugin({
      minimize: true,
      debug: false
    }),
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        warnings: false,
        unused: true,
        dead_code: true //eslint-disable-line camelcase
      },
      output: {
        comments: false
      },
      sourceMap: true
    })
  ] : null
};

A: Sounds like you're not parsing your module with Babel. The webpack config right now only parses modules in config and src.
Sounds like you're trying to execute a ES6 module, and your browser is stalling on an ES6 it doesn't support yet (my best bet is the import statement)


text:
Q: How does NumPy compute the inverse of a matrix? Given a square matrix A as a NumPy array, like
import numpy as np

A = np.array(
     [
         [1, 2, 3],
         [3, 4, 6],
         [7, 8, 9],
    ]
)

which algorithm does NumPy's linalg.inv use internally when
np.linalg.inv(A)

is invoked to compute the matrix inverse of A?
Particularly, as matrix inversion may be numerically unstable (depending on the condition number of the matrix), are there any special cases considered depending on certain matrix properties?

A: Following @projjal 's comment, all of these are equivalent to compute the inverse of a square matrix:
import numpy as np
from scipy.linalg import lu_factor, lu_solve

A = np.array([[1, 2, 3],[3, 4, 6],[7, 8, 9]])

A_inv_1 = np.linalg.inv(A)

A_inv_2 = np.linalg.solve(A,np.eye(A.shape[0]))

A_LU = lu_factor(A) # this way, you can potentially reuse the factorization for different RHS
A_inv_3 = lu_solve(A_LU,np.eye(A.shape[0]))

# check
np.allclose(A_inv_1,A_inv_2)
>>> True
np.allclose(A_inv_1,A_inv_3)
>>> True

A: You should probably note that, buried deep inside the numpy source code (see https://github.com/numpy/numpy/blob/master/numpy/linalg/umath_linalg.c.src) the inv routine attempts to call the dgetrf function from your system LAPACK package, which then performs an LU decomposition of your original matrix.
You can look at the comment in the code at line no 1036 which states:

/* As in the linalg package, the determinant is computed via LU factorization
 * using LAPACK.
 * slogdet computes sign + log(determinant).
 * det computes sign * exp(slogdet).
 */
/**begin repeat
   #TYPE = FLOAT, DOUBLE, CFLOAT, CDOUBLE#
   #typ = npy_float, npy_double, npy_cfloat, npy_cdouble#
   #basetyp = npy_float, npy_double, npy_float, npy_double#
   #cblas_type = s, d, c, z#
*/

Thus and as @Yacola demonstrated that results of numpy inverse on matrix and LU decomposition are the same. This again proves the fact.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to Delete multiple ListID from database using this query I wish to remove any duplicate listings from my database, I have trawled the internet and found a simple query, however I am unsure how to implement it into my own code
DELETE e.*
FROM employee e
WHERE id IN (SELECT id
             FROM
                 (SELECT MIN(id) as id
                  FROM employee e2
                  GROUP BY first_name, last_name
                  HAVING COUNT(*) > 1) x);

I wish to run the above query stripping all rows with the same listID found
How would I code the above query to do this?
I do not understand what the e.* and the employee e represents
My table is called listings.
I wish for the query to use the above but to DELETE all where listID=?
Could I use
DELETE *
FROM listings
WHERE listID IN (SELECT listID
                 FROM
                     (SELECT MIN(listID) AS listID
                      FROM listings
                      HAVING COUNT(*) > 1) x);

A: The last thing you ever want to do is to run a delete without knowing exactly what it's going to delete!
So the first step is to craft the part that determines which ones will be chosen to delete:
SELECT MIN(id) AS lowestid
FROM listings
GROUP BY listid
HAVING COUNT(Listid) > 1

Given the following data,
ID   ListID
 1    100
 2    110
 3    100
 4    120
 5    110

It will group them by list id, so the first grouping is on 100. This grouping has two ids, 1 & 3.  So it fulfills the "having" clause because the count of ids is > 1. It selects the minimum id, 1, as the first row.
Next it groups on 110. It finds two records. This passes the "having" requirement and it selects 2 as the next row.
Next it groups on 120. It finds only one record. This fails the "having" test and is not included in the results.
So the result of this query is [1,2]
(sort order is not guaranteed unless you include sort by; but that isn't needed here)
You can, and should, run/modify this query until you are absolutely sure you are getting the results you want.
Only then should the word delete come into play!
All you have to do now is enclose this query with parentheses, and incorporate it into the where of a delete query.
Here's a hint "delete from" should be the last thing you type. Imagine hitting the enter key at the wrong time:
Delete from listings <enter>

And as you type where... you realize you just deleted the entire thing!
I always type select * and then when I see the results are correct, go back and replace with "delete"
Delete
From listings
Where id in(
    SELECT MIN(id) AS lowestid
    FROM listings
    GROUP BY listid
    HAVING COUNT(Listid) > 1
)


text:
Q: Internal user or community user for partners? In the current project I am working on, I found that client has created internal users for partner and any partner can directly login to salesforce org and has access to almost every object and data.
Is it a correct approach to create Internal users for partners? Instead there must be a Partner community for partners and partners should be allowed to access data only through community?

A: No, it's not a best way to open up a partner to internal salesforce org. I would prefer salesforce community:

*

*They will consume salesforce license which is costly and partner community login license is cheaper.

*Data security - by making it only relevant data available in community.

*A customized company oriented user experience and theme using community - Mobile Friendly.

*Easy multi-lingual translation.


text:
Q: expression builder in BPEL hello i am a newbie in oracle BPEL and also newbie in xpath, constantly i stuck at this if condition
if (strNOREF == null || (strNOREF != null && strNOREF.trim().length() == 0))
return Response.status(HttpStatus.FORBIDDEN.value()).entity("No. Ref is empty").build();

i wonder how do i translate into BPEL expression?
i tried this with this expression
$inputVariable.payload/ns2:strNOREF = "" or ($inputVariable.payload/ns2:strNOREF != "" and string-length($inputVariable.payload/ns2:strNOREF) = 0)

but it end up at else. i want to end up at my error message

A: Assuming this is Oracle BPEL.
You can easily do conditional logic like below.
  <if name="NameYourCondition">
     <condition>$inputVariable.payload/ns2:strNOREF = ""</condition>
           <assign name="Assignment">
              <copy>
                 <from>$someVar</from>
                 <to>$someOtherVar</to>
              </copy>
           </assign>
  <else>
           <assign name="DoDifferentAssignment">
               <copy>
                 <from>$someOtherVar</from>
                 <to>$someVar</to>
              </copy>
           </assign>
  </else> </if>


text:
Q: Help deploying C# application connected to an Access database I made a small application that connects to an Access database (a .mdb file). Do other users who want to use my application also need to have Microsoft Access installed? If this is the case, are there ways to get around this requirement through the user installing some free package?
I've researched this for a while and can't seem to get any answers. Any help is much appreciated.

A: No one has clearly answered your question. If you're using MDB format, no, you don't need to distribute Access, as Jet 4 is installed on all copies of Windows starting with Windows 2000.
However, if you're compiling for something other than 32-bit, you'll have problems, in which case you'd need to download the 64-bit version of Jet/ACE that was created for Access 2010 64-bit and include it with your app.

A: Depending on the version of MS Access you're using, you need to install an appropriate version of the Microsoft Jet Engine. For older Access databases, the Jet Engine came with MDAC, but lately, it was removed from the MDAC distribution. Here is a blog that includes a link for the MS Access 2007 redistributable: Access Database Engine Redistributable. If you use a different version of Access, look for a different redistributable.

A: Try Downloading the new 2010 Access database redistributable from MS. Will work on 64 bit as well.


text:
Q: Getting 400 bad request in Axios but in Postman status 200 I'm trying to request a Power BI API using axios.
var configReportInfos = {
    method: 'get',
    url: `https://api.powerbi.com/v1.0/myorg/groups/${process.env.GROUP_ID}/reports/${process.env.DASHBOARD_ID}`,
    headers: {
        'Content-Type': 'multipart/form-data',
        'Authorization': 'Bearer ' + tokenResponse.accessToken
    },
    data: {}
};

let reportinfos
try {
    reportinfos = await axios(configReportInfos)
    tokenResponse['reportInfos'] = reportinfos
}

catch (error) {
    console.log(error);
};

Actually I'm getting this error

Request failed with status code 400"

But strangely in Postman I'm getting 200 status.

I'm using same token.

A: I had the same problem. When l switched content-type in my app to  application.json everything worked.

A: I faced the same issue (not in Axios) and struggled for a few hours.
I was able to make the API call from postman but from my java code I was getting a 400.
Turns out, this was a content issue. My request body had some Cyrillic content and it needed to be encoded before sending.
Postman was doing it by default and hence the requests were going through and responding with 200

A: I recommend to check your Request Header options in most cases some option is configured wrong.
In your case content-type seems wrong, did you try application/json in both calls.
To configure properly you can check the documentation
Content Type Configuration


text:
Q: Highchart Pie Chart Drill Down Not Working My pie chart will go to the drilldown, but only a few connector lines appear. When I go back to the original chart, only one slice appears and the connectors and labels are messed up. I can't put up a fiddle because my data is being pulled from behind a firewall. My code and a pic of the chart are below. Using the fade in method solves the drillup view, but not the drilldown.

$(document).ready(function() {
  $().SPServices({
        operation: "GetListItems",
        CAMLQuery: "<Query><OrderBy><FieldRef Name='Business_x0020_Unit'/><FieldRef Name='Session_x0020_Status'/></OrderBy></Query>",
        CAMLViewFields: "<ViewFields><FieldRef Name='Business_x0020_Unit'/></ViewFields>",
        listName: "{C6673173-9AC5-4A6B-9401-15D0F38EFCB8}",
        completefunc: function(xData, status) {

                 var spc1Data = [];
                 var dev = [];
                 var ops = [];

                //console.log(xData.responseXML);
                $(xData.responseXML).SPFilterNode("z:row").each(function() {
                    var bu = $(this).attr('ows_Business_x0020_Unit');

                    //YTD Requests by ATO data
                    if (bu === "Global Connections Management"){
                        spc1Data.push({
                            BU: "GCM"
                        });
                    }else if(bu === "Technology Design & Architecture"){
                         spc1Data.push({
                            BU: "TD&A"
                        });
                    }else if(bu === "Global Customer Service"){
                         spc1Data.push({
                            BU: "GCS"
                        });
                    }else{
                         spc1Data.push({
                            BU: bu
                        });

                        if (String(bu).indexOf('Dev') > -1) {

                            dev.push({
                            BU: bu.slice(11)

                            //Org: ""
                            });
                        }
                        else if (String(bu).indexOf('Ops') > -1){
                            ops.push({
                            BU: bu.slice(11)

                            //Org: ""
                            });
                        }
                   }
               });

                    var spcData = [];
                    for (var i = 0; i < spc1Data.length; i++) {
                    if (String(spc1Data[i].BU).indexOf('-') > -1) {
                        var bu = String(spc1Data[i].BU);
                        spc1Data[i].BU = bu.slice(0, 8);
                        spcData[i] = spc1Data[i];
                    } else {
                        spcData[i] = spc1Data[i];
                    }
                }

                drilldownSeries = [];
                 var devTemp = _.groupBy(dev, 'BU');
                 _.each(devTemp, function(row) {
                    var buCount = row.length;
                        drilldownSeries.push({
                        id: "tech dev",
                        name: row[0].BU,
                        data: [row[0].BU, buCount]
                       });
                    });

                   var chartDataDrillOps = [];
                    var devOps = _.groupBy(ops, 'BU');
                     _.each(devOps, function(row) {
                        var buCount = row.length;
                        drilldownSeries.push({
                        id: "tech ops",
                        name: row[0].BU,
                        data: [row[0].BU, buCount]

                        });
                    });

                var chartData = [];
                var buData = _.groupBy(spcData, 'BU');
                _.each(buData, function(row) {
                    var buCount = row.length;
                    if (row[0].BU === "Tech Dev"){
                        chartData.push({
                            name: row[0].BU,
                            y: buCount,
                            drilldown: row[0].BU.toLowerCase()
                            //drilldown: chartDataDrillDev
                       // drilldown: row[0].BU
                        });
                    }else if(row[0].BU === "Tech Ops"){
                        chartData.push({
                            name: row[0].BU,
                            y: buCount,
                           drilldown: row[0].BU.toLowerCase()
                            //drilldown: chartDataDrillOps
                       // drilldown: row[0].BU
                        });
                    }else{
                        chartData.push({
                            name: row[0].BU,
                            y: buCount
                        });
                    }
                });

               // CREATE A FADE-IN METHOD FOR 3D-ARCS
               Highcharts.wrap(Highcharts.SVGRenderer.prototype, 'arc3d', function (proceed) {
                    var result = proceed.apply(this, [].slice.call(arguments, 1));
                    result.fadeIn = result.show;
                    return result;
                });

                var chart = new Highcharts.Chart({
                    chart: {
                        type: 'pie',
                        plotBorderColor: '#0574AC',
                        borderWidth: .5,
                        options3d: {
                            enabled: true,
                            alpha: 55,
                            beta: 0
                        },
                        renderTo: 'buRequests',
                        plotShadow: false
                    },
                    credits: {
                        enabled: false
                    },
                    title: {
                        text: 'YTD Requests by ATO'
                    },
                    tooltip: {
                        pointFormat: '{point.y}' + ' Requests' + '
' + '{point.percentage:1.0f}%'
                            //percentageDecimals: 1
                    },
                    plotOptions: {
                        pie: {
                            size: '80%',
                            allowPointSelect: true,
                            cursor: 'pointer',
                            depth: 35,
                            dataLabels: {
                                softConnector: true,
                                useHTML: true,
                                enabled: true,
                                padding: 0,
                                fontWeight: 'medium',
                                //format: '{point.name}'+ '
' + '{point.y}' +' Requests' + '
' + '{point.percentage:1.0f}%',
                                formatter: function() {
                                    var req;
                                    if (this.point.y === 1) {
                                        req = " Request";
                                    } else {
                                        req = " Requests";
                                    }
                                    return '' + this.point.name + '
' + this.point.y + req + '
' + Math.round(this.percentage) + '%' + '';
                                }
                            },
                        }
                    },
                    series: [{
                        type: 'pie',
                        name: 'BU Count',
                        data: chartData,
                        colors: ['#0472A9', '#F9B112', '#42C5F1', '#EB6E00', '#4AA70A', '#C1D52C']
                    }],
                   drilldown:{
                    series: drilldownSeries
                   }
               });console.log(chart);
              }
           });
        });


text:
Q: User defined objects in Javascript ok, so below is the code that creates a user defined object with two properties. Runs fine but the values gets over-written. How do i display all the values that the user enters in the object "objOrg"
const size = Number(prompt("Enter the number of employees to be registered"));
const orgObj = {};
    for (let i = 0; i<=size; i++){
        Object.defineProperties(orgObj, {
              empName: {
                 value: prompt("Enter employee name"),
                 writable: true
        },
              empId: {
                 value: prompt("Enter employee id"),
                 writable: true
        }
    })

}
console.log(orgObj);

A: Sounds like you just want to create an array of orgs and add each one to it?

const size = Number(prompt("Enter the number of employees to be registered"));
const orgs = [];
for (let i = 0; i < size; i++){
    const orgObj = {};
    Object.defineProperties(orgObj, {
        empName: {
            value: prompt("Enter employee name"),
            writable: true,
            enumerable: true
        },
        empId: {
            value: prompt("Enter employee id"),
            writable: true,
            enumerable: true
        }
    });
    orgs.push(orgObj);
}
console.log(JSON.stringify(orgs));

A: You can use a class Employee to achieve this

const size = Number(prompt("Enter the number of employees to be registered"));

class Employee {
  constructor(name, id) {
    this.name = name;
    this.id = id;
  }
}

let employees = [];

for (let i = 0; i < size; i++) {
    let value = prompt("Enter employee name");
    let id = prompt("Enter employee ID");
    employees[i] = new Employee(value, id);
    console.log(employees[i]);
}

console.log(employees);

A:

const size = Number(prompt("Enter the number of employees to be registered"));
const orgObj = {};
    for (let i = 1; i<=size; i++){
        Object.defineProperties(orgObj, {
              ['empName'+i]: {
                 value: prompt("Enter employee name"),
                 writable: true,
                 enumerable:true,
        },
              ['empId'+i]: {
                 value: prompt("Enter employee id"),
                 writable: true,
                   enumerable:true,
        }
    })

}
console.log(orgObj);

A: You could push the objects to an array

const size = Number(prompt("Enter the number of employees to be registered"));
const arr=[]
const orgObj = {};
    for (let i = 0; i<=size; i++){
        Object.defineProperties(orgObj, {
              empName: {
                 value: prompt("Enter employee name"),
                 writable: true
        },
              empId: {
                 value: prompt("Enter employee id"),
                 writable: true
        }
    })
arr.push(orgObj)
}
console.log(arr);


text:
Q: Does Symfony2 detect cyclical dependencies between services? Say you need to build a complex service relying on other services in Symfony2. One way to create these services is to create factories.
Yet, is it possible to create services with cyclical dependencies to other services in Symfony2 or not? I know this is not a good coding practice, but that is not my question.
Should one implement service setter methods as mentioned in the documentation to enable this? Else, how does Symfony2 deals with these chicken and egg issues? Does it throw an error?

A: The best way to find out is to try it:
1). Install a Symfony standard edition application
I installed Symfony 2.8.1 for this example.
2). In the default AppBundle add the following files in Services folder:
ServiceA.php:
namespace AppBundle\Services;

class ServiceA
{
    private $service;

    public function __construct(ServiceB $service)
    {
        $this->service = $service;
    }
}

ServiceB.php:
namespace AppBundle\Services;

class ServiceB
{
    private $service;

    public function __construct(ServiceA $service)
    {
        $this->service = $service;
    }
}

3). Add an extension subclass in DependencyInjection folder:
AppExtension.php:
namespace AppBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader;

class AppExtension extends Extension
{
    public function load(array $configs, ContainerBuilder $container)
    {
        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources'));
        $loader->load('services.yml');
    }
}

4). And declare the circular-dependent services in Resources folder:
services.yml:
services:
    service_a:
        class: AppBundle\Services\ServiceA
        arguments:
            - @service_b

    service_b:
        class: AppBundle\Services\ServiceB
        arguments:
            - @service_a

After all this, if you run php app/console --version, you will get the following error:
[Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException]
Circular reference detected for service "service_a", path: "service_a -> service_b -> service_a".


text:
Q: Neo4j Java APOC query I have my java app using Neo4j API. Everything works fine, except when I pass by args the path of my file to process.
This is the code working fine:
session.run("call
apoc.xml.import(\"http://www.example.com/myfile.xml\") YIELD node
RETURN node");

Since I need to create an app which is general purpose, I need to pass the file from the user input. When I pass by args the URL, I got the error because there must be something wrong in the string.
This is the code with problem:
session.run("call apoc.xml.import(\" "  + file  + " \" ) YIELD node RETURN node");

where file is the variable containing http://www.example.com/myfile.xml
Am I doing something wrong?

A: Try to pass the variable through the parameters:
Map<String, Object> params = new HashMap<>();
params.put( "file", file );
session.run("call apoc.xml.import($file) YIELD node RETURN node", params);

[ https://neo4j.com/docs/java-reference/3.4/tutorials-java-embedded/#tutorials-cypher-parameters-java ]


text:
Q: Propagating a Tiles attribute down the include chain I'm using Tiles and I'd like an attribute defined for a page to be readable inside of one of the included subpages as follows:
tiles-definitions.xml:
<definition name="page" template="/WEB-INF/tiles/layout/page.jsp">
  <put-attribute name="header" value="/WEB-INF/jsp/_include/header.jsp"/>
  <put-attribute name="footer" value="/WEB-INF/jsp/_include/footer.jsp"/>
</definition>

<definition name="tutorial" extends="page">
  <put-attribute name="title" value="Tutorial"/>
  <put-attribute name="body" value="/WEB-INF/jsp/tutorial.jsp"/>
</definition>

The page.jsp represents a simple page structure:
<html>
  <head><title><tiles:getAsString name="title"/></title></head>
  <body>
      <tiles:insertAttribute name="header"/>
      <tiles:insertAttribute name="body"/>
      <tiles:insertAttribute name="footer"/>
  </body>
</html>

I'm trying to read the title also inside the "header" subpage but I get the following error:

org.apache.tiles.template.NoSuchAttributeException: Attribute 'title' not found.

Here is how I'm trying to access the attribute in header.jsp:
<tiles:getAsString name="title"/>

A: Take care to upgrade the Tiles definition file to 2.1 min, as cascade is available since 2.1.
<!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 2.1//EN" "http://tiles.apache.org/dtds/tiles-config_2_1.dtd">

A: To propagate the title attribute to inner templates you need to add cascade="true" attribute to the title's <put-attribute> tag, like this:
<definition name="tutorial" extends="page">
  <put-attribute name="title" cascade="true" value="Tutorial"/>
  <put-attribute name="body" value="/WEB-INF/jsp/tutorial.jsp"/>
</definition>


text:
Q: Как в excel сделать автоматическое форматирование? jQuery Есть HTML таблица, по кнопке экспортируется в Excel документ.
Как сделать перенос строк в ячейках ?
Использую библиотеку tableexport
Вот так данные попадают в excel файл:

Как сделать вот такой перенос?

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

         Кол 1
         Кол 2
         Кол 3
         Кол 4
         Кол 5
         Кол 6
         Кол 7
         Кол 8

         -
         ТОО USER COMPANY
         Hello
 World

               Номер 1
               Hello
 World

               Номер 1
               Hello
 World

         -

Hello World

Hello World

Hello World

Hello World

Hello World

A: Не нашел как это сделать с подобными библиотеками.
Реализовал через PHP, получилось проще.
Создал файл export_xls.php в него с помощью jQuery и HTML передал таблицу и скачал.
<?php
 $table = $_POST['HTMLTABLE'];

 $xls_file="Export table.xls";

 header("Content-type: application/vnd.ms-excel; charset=utf-8'");
 header("Content-Disposition: attachment; filename=$xls_file");

 echo $table;
?>

Результат:


text:
Q: Unable to upload file to Orthanc server from C# application I am trying to upload a DICOM file to local Orthanc server but I get the error that:
Unknown Tag & Data (2d2d,6664) larger (1647393075) than remaining bytes (76) in file, premature end of stream
E0424 16:02:20.786940 FromDcmtkBridge.cpp:1925] Cannot parse an invalid DICOM file (size: 84 bytes)

I have wrote the following code to upload the file on the server:
DicomFile dicomfile = new DicomFile(dataset);
dicomfile.Save("dicomfile.dcm");

////finally uploading the file to Orthanc
String dcm = File.ReadAllText("./test9signedLimited.dcm");

HttpClient client = new HttpClient();

client.DefaultRequestHeaders.Add("ContentType", "multipart/form-data");
HttpContent content = new MultipartFormDataContent();

content.Headers.ContentType= new MediaTypeHeaderValue("multipart/form-data");

var response = client.PostAsync("http://localhost.:18888/instances", content).Result;

response.EnsureSuccessStatusCode();
var r = response.Content.ReadAsStringAsync().Result;

Note I have tried to upload the same file using POSTMAN and it was successfully uploaded there.
Thanks for your help in advance.

A: Not knowing anything about C#, but I see two problems in the code at the moment.

*

*You read in the DICOM file from disk, but I don't see any code to actually attach the DICOM data to the POST request. It seems, that You are posting an empty request with only headers.

*You use File.ReadAllText to read the DICOM file from disk, which returns a String. This does not seem right, since DICOM is a binary format and converting to it to a string is more than likely to break it. You more likely need a byte array with the DICOM data to attach to the POST request.

A: Although this answer does not cover a C# solution, you have a python option that might help you. The Orthanc Server [1] has a solution for sending DICOM images to the server. Instructions are as follows.
python ImportDicomFiles.py localhost 8042 ~/DICOM/

[1] Jodogne, S., 2018. The orthanc ecosystem for medical imaging. Journal of digital imaging, 31(3), pp.341-352.


text:
Q: how to get access_token from content response laravel I have this response content from api response:
{"token_type":"Bearer","expires_in":31535919,"access_token":"eyJ0eXa99e760ef4e468d17198f9fa6be9d67c36240a9bf9bb74d76b18e18ca2661706e33d1bc80cdAiOiJKV1QiLCJhbGciOiJSU.......

How I can get the access_token value? So I can use it.

A: You can use json_decode function to conver that into object and access it there.
$response = '{"token_type":"Bearer","expires_in":31535919,"access_token":"eyJ0eXa99e760ef4e468d17198f9fa6be9d67c36240a9bf9bb74d76b18e18ca2661706e33d1bc80cdAiOiJKV1QiLCJhbGciOiJSU.......';

$response = json_decode($response, true);
echo $response['access_token'];

Hope this helps.


text:
Q: Sistema de redirecionamento com PHP Olá, como eu poderia fazer um sistema redirecionamento de página com PHP?
Sendo mais especifico, seria o seguinte, tenho uma página de testes com apenas 2 inputs, um para enviar e outro para inserir um texto. Caso ele digite um determinado código corretamente ele é redirecionado para alguma página, do contrario aparece uma mensagem de erro para ele (mas nada como um alert no meio da tela, sou mais para fazer aparecer uma pequena caixa estilizada contendo algum texto, por exemplo "Código inexistente").
 Exemplificando mais, vamos supor tenho esses 4 códigos: teste1 teste2 teste3 teste4
Eles seriam como senhas, caso o usuário digite o teste1 ele é redirecionado para a página1.php caso digite o teste2 é redirecionado para a página2.php e por ai vai..
 Mas caso ele não digite nada, aparece o tal do erro que eu citei.

A: Você pode fazer algo como no exemplo abaixo:
<?php
var $campo = $_POST["campo"];
switch($campo) {
    case "teste1":
        header("Location: teste1.php");
    // mais casos
    case "testeN":
        header("Location: testeN.php");
    default:
        echo "
Código inválido
";
}

Porém se forem códigos que são cadastrados dinamicamente, ou se forem muitos, recomendo fazer uma tabela em banco e verificar lá se existe esse código, daí se existir, faz o redirecionamento, se não, exibe a mensagem.


text:
Q: Por que se cicla un programa cuando mandó a llamar un método? El siguiente programa no marca errores de compilación pero solo le funcionan los metodos darDeAlta(),darDeBaja(), los otros métodos consultas(),modificacion() no funcionan bien pues cuando los mando a llamar, me aparece el menú de opciones: System.out.println("[a]ltas" + "\n" + "[b]ajas" + "\n" + "[c]onsultas" + "\n" + "[m]odificaciones" + "\n" + "[s]alir");
        System.out.println("\n Seleccione una opcion");
y si vuelvo a seleccionar alguna de estas opciones (m,c,s), me vuelve a mostrar dicho menu, es decir se cicla el código. Por que?
Como puedo solucionar este problema?
class Alumno {

private String nombre;
private int matricula;
private double calificaciones[];

Alumno() {
}

Alumno(String nombre, int matricula, double calificaciones[]) {

    this.calificaciones = calificaciones;

}

String getNombre() {
    return nombre;
}

int getMat() {
    return matricula;
}

double[] getCalif() {
    return calificaciones;
}

void setCalif(double calif[]) {
    calificaciones = calif;
}

}

public class Ejercicio{

Map<Integer, Alumno> alumnos = new TreeMap<>();

public boolean darDeAlta() {
    Scanner y = new Scanner(System.in);
    boolean b=false;

    double d[] = new double[5];

    System.out.println("Introduzca el nombre del estudiante");
    String n = y.nextLine();
    System.out.println("Introduzca su matricula (de 5 digitos)");
    int m = y.nextInt();
    System.out.println("Introduzca las calificaciones: \n");
    for (int i = 0; i < 5; i++) {
        System.out.println("Introduzca la calificacion");
        d[i] = y.nextDouble();

    }

    if (alumnos.containsKey(m)) {
        System.out.println("Esa matricula ya existe, ingrese otra matricula");

    } else {
        alumnos.put(m, new Alumno(n, m, d));
        System.out.println("Se han dado de alta los datos :)");
        System.out.println("Desea ingresar mas alumnos?");
        String s = y.next();
        if (s.compareTo("si")==0 || s.compareTo("no")==0)
            b = true;

    }

    return b;

}

 public boolean darDeBaja() {
    Scanner y = new Scanner(System.in);
    boolean c;

    System.out.println("Introduzca la matricula del alumno");
    int m = y.nextInt();
    c = alumnos.containsKey(m);
    if (c) {
        alumnos.remove(m);
        System.out.println("Se ha dado de baja al alumno");
    } else {
        System.out.println("No existe esa matricula");
    }
 return true;
}

public boolean consultas() {
    Scanner y = new Scanner(System.in);
    boolean c;
    Alumno al = new Alumno();
    System.out.println("Introduzca la matricula del estudiante a buscar");
    int k = y.nextInt();
    c = alumnos.containsKey(k);
    if (c) {
        System.out.println("Los datos son:\n" +"Nombre del alumno: "+ alumnos.get(k) + "Calificaciones: " + al.getCalif());
    } else {
        System.out.println("El alumno no se encuentra");
    }
 return true;
}

public boolean modificaciones() {
    Scanner y = new Scanner(System.in);
    boolean c;
    Alumno al = new Alumno();
    double calificacionesNvas[] = new double[5];
    System.out.println("Introduzca la matricula del estudiante");
    int k = y.nextInt();
    c = alumnos.containsKey(k);

    if (c) {

        System.out.println("Cuales son las nuevas calificaciones? \n");
        for (int i = 0; i < 4; i++) {
            System.out.println("Introduzca la calificacion");
            double calif = y.nextDouble();
            calificacionesNvas[i] = calif;
        }
        al.setCalif(calificacionesNvas);
        System.out.println("Se han modificado las calificaciones correctamente");
    } else {
        System.out.println("No existe esa matricula");
    }
return true;
}

public static void main(String[] args) {

    Scanner x = new Scanner(System.in);
    boolean bandera = false;

    Ejercicio e = new Ejercicio();

    do {

        System.out.println("[a]ltas" + "\n" + "[b]ajas" + "\n" + "[c]onsultas" + "\n" + "[m]odificaciones" + "\n" + "[s]alir");
        System.out.println("\n Seleccione una opcion");
        String opcion = x.next();
        if (opcion.compareTo("a") == 0) {
            bandera = e.darDeAlta();
        }
        if (opcion.compareTo("b") == 0) {
            e.darDeBaja();
            if (opcion.compareTo("c") == 0) {
                e.consultas();
                if (opcion.compareTo("m") == 0) {
                    e.modificaciones();
                    if (opcion.compareTo("s") == 0) {
                        bandera = false;

                    }
                }
            }
        }
    } while (bandera);
}

}

A: Por que lo estás metiendo dentro del if
 if (opcion.compareTo("a") == 0) {
        bandera = e.darDeAlta();
    }
    if (opcion.compareTo("b") == 0) {
        e.darDeBaja();
        if (opcion.compareTo("c") == 0) {
            e.consultas();
            if (opcion.compareTo("m") == 0) {
                e.modificaciones();
                if (opcion.compareTo("s") == 0) {
                    bandera = false;

                }
            }
        }
    }

así solo hará la comparación cuando opcion.compareTo("b") sea 0 y por lo tanto ya no entrará, deben estar afuera
if (opcion.compareTo("a") == 0) {
        bandera = e.darDeAlta();
}
 else if (opcion.compareTo("b") == 0) {
        e.darDeBaja();
}
else if (opcion.compareTo("c") == 0) {
        e.consultas();
}
else if (opcion.compareTo("m") == 0) {
        e.modificaciones();

}
else if (opcion.compareTo("s") == 0) {
      bandera = false;
}

como nota extra nunca igualas a  bandera como en los primeros procesos, no sé si eso sea necesario en tu código, ya depende eso de ti

A: En tu caso yo usaría un bloque switch, el código queda mucho más claro que tantos if ... else if.
    Scanner x = new Scanner(System.in);
    boolean bandera = false;

    Ejercicio e = new Ejercicio();

    do {

        System.out.println("[a]ltas" + "\n" + "[b]ajas" + "\n" + "[c]onsultas" + "\n" + "[m]odificaciones" + "\n" + "[s]alir");
        System.out.println("\n Seleccione una opcion");
        String opcion = x.next();

    switch (opcion) {

        case "a":
            System.out.println("código para a");
            break;

        case "b":
            System.out.println("código para b");
            break;

        case "c":
            System.out.println("código para c");
            break;

        case "m":
            System.out.println("código para m");
            break;

        default:
            System.out.println("lo que quieras, si ninguna condición se cumple");
            break;
    }


text:
Q: How to allow resending form when Sequelize validation error is thrown in AngularJS? I've got a following SignUp controller for registering users to my system. I've got a problem with form.$valid property, which is frozen to false, when the validation error from Sequelize is thrown...What should I add/change in my controller? I think, it should erase false $valid value for specific input on ng-change event maybe? But I don't know, how to achieve this...
class SignupController {
  //start-non-standard
  user = {};
  errors = {};
  submitted = false;
  //end-non-standard

  constructor(Auth, $state) {
    this.Auth = Auth;
    this.$state = $state;
  }

  register(form) {
    this.submitted = true;
    console.log(this.errors);
    if (form.$valid) {
      console.log("clikc");
      this.Auth.createUser({
        nickname: this.user.nickname,
        email: this.user.email,
        password: this.user.password
      })
      .then(() => {
        // Account created, redirect to home
        this.$state.go('main');
      })
      .catch(err => {
        err = err.data;
        this.errors = {};

        // Update validity of form fields that match the sequelize errors
        if (err.name) {
          angular.forEach(err.fields, function(value, key) {
            form[key].$setValidity('sequelize', false);
            this.errors[key] = err.message;
          }, this);
        }
      });
    }
  }
}

angular.module('batnApp')
  .controller('SignupController', SignupController);

A: I've figured it out with ng-change function, which has got a following functionality:
resetValidation(form, field) {
  if(this.submitted && !form.$valid) { //validation is on server side
    form[field].$setValidity('sequelize', true);
  }
}


text:
Q: Mechanic of how observing function works in SWIFT I believe everyone is familiar with
open func didAddSubview(_ subview: UIView)

This function is called whenever a new subView is added to the UIView.
I am wondering on how to achieve? Like, what is the underlying codes to achieve this?
Thanks
Edit:
what i mean in the question is the codes to achieve a non-objective-c observing function. For example, we can build a notification, so that whenever addSubView is called, the didAddSuView is called correspondently, but apparently, in this case. It is not an object-c selector which we see in normal implementation. So i am asking how do we achieve something like this, which means, how do i trigger a function when another function is called without it being an objc function.
Btw, just to clarify further. The function is implemented as function of UIView (Extension UIView), so it is not a protocol, which means it wasn't  elegantly achieved as delegate.
So again, i am asking.. How can i replicate something like this?

A: "The underlying codes" is that you just call the "observing function" when it needs to be called. There's no magic in how UIKit calls didAddSubview. It doesn't use any features specific to Objective-C.
The iOS SDK has four methods for adding a subview to a view:

*

*addSubview:

*insertSubview:atIndex:

*insertSubview:aboveSubview:

*insertSubview:belowSubview:
All of these methods are wrappers for a private method, _addSubview:positioned:relativeTo:. You can check this using a disassembler, or by putting a breakpoint in didAddSubview: and looking at the stack trace to see who calls it.
The private method calls [self didAddSubview:subview] using a normal Objective-C message. It does not "build a notification". The source code probably looks something like this:
- (void)_addSubview:(UIView *)newSubview position:(UIViewSubviewPosition)position relativeTo:(UIView *)sibling {
    // Lots of bookkeeping related to first responder status,
    // gesture recognizers, auto layout, visual effects,
    // and private implementation details…

    [newSubview removeFromSuperview];

    switch (position) {
        case UIViewSubviewPositionAtEnd:
            [self.layer addSublayer:newSubview.layer];
            break
        case UIViewSubviewPositionBelowSibling:
            [self.layer insertSublayer:newSubview.layer below:sibling.layer];
            break;
        case UIViewSubviewPositionAboveSibling:
            [self.layer insertSublayer:newSubview.layer above:sibling.layer];
            break;
        default:
            [self.layer insertSublayer:newSubview.layer atIndex:(unsigned int)position];
            break;
    }

    [newSubview didMoveToSuperview];
    [newSubview didMoveToWindow];
    [self didAddSubview:newSubview];

    // Lots more bookkeeping related to first responder status,
    // gesture recognizers, auto layout, visual effects,
    // and private implementation details…
}

In Swift, it could look like this:
enum SubviewPosition {
    case atEnd
    case below(UIView)
    case above(UIView)
    case atIndex(UInt32)
}

func _addSubview(_ newSubview: UIView, position: SubviewPosition) {
    // Lots of bookkeeping related to first responder status,
    // gesture recognizers, auto layout, visual effects,
    // and private implementation details…

    newSubview.removeFromSuperview()

    switch position {
        case .atEnd: layer.addSublayer(newSubview.layer)
        case .below(let sibling):
            layer.insertSublayer(newSubview.layer, below:sibling.layer)
        case .above(let sibling)):
            layer.insertSublayer(newSubview.layer, above:sibling.layer)
        case .atIndex(let index):
            layer.insertSublayer(newSubview.layer at:index)
    }

    newSubview.didMoveToSuperview()
    newSubview.didMoveToWindow()
    didAddSubview(newSubview)

    // Lots more bookkeeping related to first responder status,
    // gesture recognizers, auto layout, visual effects,
    // and private implementation details…
}


text:
Q: Understanding parameters in an anonymous function (callback example) There is an example in JavaScriptIsSexy for a simple callback that I'd like to understand a bit better:
var friends = ["Mike", "Stacy", "Andy", "Rick"];

friends.forEach(function (eachName, index){
console.log(index + 1 + ". " + eachName); // 1. Mike, 2. Stacy, 3. Andy, 4. Rick
});

In this case, how are the parameters eachName and index understood to mean the elements of the array (people's names as strings) and index numbers, respectively? Would that have to be specified via arguments in the call that just isn't shown here, but is expected if you want the output shown in the comment?

A: Because that is how the forEach function is defined, as per https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach :

callback is invoked with three arguments:

*

*the element value

*the element index

*the array being traversed

Obviously, the names eachName and index don't mean anything specially by themselves.  They're meaning is purely positional.  You can call them and use them as whatever you want.  Whatever name you put first will be used as the parameter name for the element value, the 2nd as the element index, and the 3rd as the array.
Even though you're not yet using it, there is also a 3rd parameter that you could declare and use - the entire array - if you want it.  Similarly, if you don't care about the index, you don't need to define it either.

A: This is how forEach works.
You give it a function to call for each element of the array.
That function will be called with the following arguments (in order):

*

*the current element

*the index of the current element

*the whole array

In your case, you have
function (eachName, index)

So this means that eachName is the current element, index is the index and you don't make use of the third parameter.
In addition to these three parameters, you also have the option of having a this appear inside of your function. That is specified by an optional second argument to forEach (after your callback function).


text:
Q: Get description from ExceptionCode Is there an API for translating ExceptionCode:s in an ExceptionRecord to a readable message like FormatMessage for regular errors.

A: There is no built-in function for this.
Many people are doing it manually:
fostlib::exceptions::structured::structured in:
http://svn.felspar.com/public/fost-base/tags/4.12.12.44490/fost-base/Cpp/fost-core/exception-win.cpp
MyUnHandledExceptionFilter in:
http://openholdembot.googlecode.com/svn/trunk/ManualMode/debug.cpp
GetExceptionString in:
http://subversion.assembla.com/svn/ub-source113/Standard%20Gaming%20Platform/ExceptionHandling.cpp


text:
Q: Failure in Calling a Function in R I'm trying to create a function that compares two matrices. It will compare the element of both matrices at a certain position, and returns "greater than" "equal to" or "less than". Below is the code I have right now. However, when I tried calling the function, R does not return anything, not even an error message. I'm wondering why that is the case. Any suggestions would be helpful. Thanks.
fxn <- function(x, y) {
  emptymatrix <- matrix( , nrow = dim(x)[1], ncol = dim(x)[2])
  for (i in 1:dim(emptymatrix)[1]) {
    for (j in 1:dim(emptymatrix)[2]) {
      if (x[i, j] < y[i, j]) {
        emptymatrix[i, j] <- "Less Than"
      }else if (x[i, j] == y[i, j]) {
        emptymatrix[i, j] <- "Equal to"
      }else {
        emptymatrix[i, j] <- "Greater than"
      }
    }
  }
}

#trying to test the function
vecc1 <- c(1, 2, 3, 4, 5, 6, 7, 8, 9)
vecc2 <- c(4, 5, 2, 3, 1, 1, 8, 9, 10)
matrix1 <- matrix(vecc1, nrow = 3, byrow = T)
matrix2 <- matrix (vecc2, nrow=3, byrow = T)
fxn(matrix1, matrix2)

A: Hi as SamR pointed out in his comment, your function doesn't return anything, because it has no return function / object in the end. He is also right about the loop thing, because R is mainly designed for tabular data and matrices it can do a lot of stuff for you under the hood. This is a great examples about some design principles R has. First we don't need to use a for loop because we can just evaluate larger equal less, on all indices (vectorized). The output will be a matrix of size M with TRUE / FALSE. we can use this matrix to index our new matrix at all TRUE position. than we just need to assign a single string "equal", "larger", or "less" that gets recycled to the length of the longer vector(/list).
vecc1 <- c(1, 2, 3, 4, 5, 6, 7, 8, 9)
vecc2 <- c(4, 5, 2, 3, 1, 1, 8, 9, 10)
matrix1 <- matrix(vecc1, nrow = 3, byrow = T)
matrix2 <- matrix (vecc2, nrow=3, byrow = T)

# run this to see how the comparision works
matrix1 == matrix2

foo <- function(x,y) {
  m_new<-matrix(NA,nrow=dim(x),ncol=dim(x))
  m_new[x==y]<-"Equal"
  m_new[x<y]<-"Less Than"
  m_new[x>y]<-"Greater Than"
  m_new # faster
  #return(m_new) is not as efficent
}

foo(matrix1,matrix2)

A: You missed returning emptyMatrix from your function.
In R, the result of the last statement in a function is returned automatically. In the original function, the last statement was the for loop, whose value is NULL. It was returned, marked "invisible", so it didn't print.
The usual convention in R is to type the name of the object you want to return when it isn't already the last value produced.  So just add one line to your function, containing emptyMatrix.
You can also call return(emptyMatrix), but that's actually less efficient.
And if you like returning things invisibly like for loops do, you can call invisible(emptyMatrix) as the last line.  Then it won't automatically print, but you can still assign it to another variable.


text:
Q: _frozen_importlib._DeadlockError: deadlock detected by _ModuleLock('django.test.signals') at 140668266856120 I am getting this error when I go for python manage.py runserver
error -
    _frozen_importlib._DeadlockError: deadlock detected by _ModuleLock('django.test.signals') at 140668266856120

Please help me out.
I saw other questions but it says that same model is called multiple times or same database table has been called multiple times.

A: You can fix this by upgrading your Django version to 2.2.24 like this:
pip install --upgrade django==2.2.24

A: So this issue is likely as a result of a circular import - that is, in one module you have imported one module, and in that module you have imported the other.
Such as:
Inside notifications/serializers.py:
from books.serializers import BookSerializer

And inside books/serializers.py:
from notifications.serializers import NotificationSerializer

Hence, this causes a deadlock error...and it is very hard to pinpoint the circular import because it won't tell you where this circular import has occured.


text:
Q: Why isn't $f(z)=\bar{z}$ complex differentiable It is quite easy to see why $f(z)=\bar{z}$ isn't complex differentiable.
$\frac{\partial{u}}{\partial{x}}=1\neq-1=\frac{\partial{v}}{\partial{y}}$
But I struggle to see why this is the case.
Visualization of the conjugate function in my head is simply flipping the complex plane upside down. I don't see how this creates any discontinuities.
Am I having the wrong visualization or have I misunderstood complex differentiability?

A: $f$ does not create any discontinuities ! $f$ is continuous, but not complex differentiable.
Let $z_0 \in \mathbb C$ and $t \in \mathbb R$. Then:
$\frac{f(z_0+t)-f(z_0)}{t}=1 \to 1 $ for $t \to 0$,
but
$\frac{f(z_0+it)-f(z_0)}{it}=-1 \to -1 $ for $t \to 0$.

A: Of course it doesn't satisfy one of the possible definitions (Cauchy-Riemann equations, the specific limit does not exist), but in my opinion that doesn't give you much intuition - at least of the geometric kind. Hopefully the following will compensate for that.
TL;DR:

If $f$ is differentiable at a point $z_0$, then there's the linear
  function $$(Df)(z_0)\colon \mathbb C \to \mathbb C;\quad z \mapsto f'(z_0)z
 $$ that approximates $f$ well around $z_0$. Multiplication by a
  complex number is a rotation or a scaling of the complex plane, thus
  it keeps orientation.
These imply that $f$ has to keep
  orientation locally, around $z_0$. Conjugation is a reflection so it flips
  orientation, therefore it cannot be differentiable at any point in the complex
  sense.

If $f\colon \mathbb C \to \mathbb C$ is complex-differentiable, then it is differentiable as an $\mathbb R^2 \to \mathbb R^2$ function, and it locally almost keeps angles and circles. To see this, look at one equivalent version of the complex-differentiability:
$$f(z_0 + re^{it}) = f(z_0) + re^{it}f'(z_0) + \omicron(r), $$
where $z_0 \in \mathbb C, 0 \leq r, 0 \leq t \leq 2\pi$.
In fact, as a demonstration have a picture of the image of two circles around $1 + i$ by $\operatorname{id_{\mathbb C}}^2$.
The black,$\{z_0 + re^{it} \mid t \in [0,2\pi]\}$ ones are our original circles ,
the reds, $\,\,\color{red}{f(\{z_0 + re^{it} \mid t \in [0,2\pi]\})}$  are the blacks' images by $f$, and
the blues, $\color{blue}{\{f(z_0) + re^{it}f'(z_0) \mid t \in [0,2\pi] \}}$ are the first order approximation of the red ones.
If we pick $z_0 = 1 + i, r=0.1$ and $0.2$, then we get, in order:

As you can see in the $r=0.1$ case the red and blue circles are almost equal. As $r \to 0$, the difference becomes smaller and smaller. That's what I meant by locally almost keeping circles.
Here's another picture, displaying the image of a point from each of the two black circles. The black and blue circles represent the same as before, the green circles are due to the $\omicron(r)$ part.
Look for the points $\color{red}{a}, \color{blue}{a'}, \color{red}{f(a)}$ and $\color{purple}{b},\color{blue}{b'}, \color{purple}{f(b)}$.

 In fact, in the $r=0.1$ case the green circle is so small, you can barely see any of it (this is why the red and blue circles from a moment ago were almost equal).
As you can see, the image of a circle is essentially the sum of multiple circles, in this case, two; however, if $f$ has lots of non-zero derivatives, then there'll be lots of circles, and each "new" circle will have smaller radius, but higher frequency than the previous one (assuming $r < 1$).
If you know about Fourier-series, then this concept might sound familiar. By the way, if you haven't already, read this answer.
Anyway, this is not so surprising: if you consider the Taylor series of a holomorphic $f$ at a point, and plug in a point from a circle around that point, you'll get
$$ f(z_0 + re^{it}) = \sum\limits_{n=0}^\infty \frac{f^{(n)}(z_0)}{n!}r^ne^{int}.$$
Here the $n$th term will correspond to the circle $\left\{\frac{f^{(n)}(z_0)}{n!}r^ne^{int} \mid t \in [0,2\pi]\right\}$.
OK, back to the original question.
Hopefully I've convinced you that the $\omicron(r)$ part is not significant. (Of course only so if the first derivative is non-zero, but in the other cases we can say something similar too.)
Let's say a word about locally almost keeping angles. Remember
$$f(z_0 + re^{it}) = f(z_0) + re^{it}f'(z_0) + \omicron(r).$$
Picking two numbers, $z_0 + re^{it}, z_0 + re^{is}$ the angle between them that is kept locally is $(t-s)$. Their images are
$$ f(z_0) + re^{it}f'(z_0) + \omicron(r), \text{and } f(z_0) + re^{is}f'(z_0) + \omicron(r). $$
As you can see, the local (i.e. looking from the point $f(z_0)$) angle between them is again, approximately $(t-s)$.
Now let's really get back to your original question.
For $f(z) = \bar z$, assuming differentiability at $z_0$, the following would be true for all $t\in [0,2\pi]$:
\begin{align}
f(z_0 + re^{it}) &= f(z_0) + re^{it}f'(z_0) + \omicron(r) \\
\iff re^{-it} &= re^{it}f'(z_0) + \omicron(r).
\end{align}
This is absurd. Of course we could also note that conjugation locally flips angles. Going back to our points $z_0 + re^{it}, z_0 + re^{is}$, the angle is still $(t-s)$. Their images now are $$\bar{z_0} + re^{-it}, \text{ and } \bar{z_0} + re^{-is}, $$ meaning that the appropriate angle is $-(t-s)$. Thus again, conjugation can not be complex-differentiable.

A: Viewed as a real map the complex conjugation map $z \mapsto \bar z$ is differentiable (in fact, linear): Under the usual identification $\Bbb R^2 \leftrightarrow \Bbb C$, $(x, y) \leftrightarrow x + iy$, it is given by $(x, y) \to (x, -y)$.
On the other hand, it is not complex-differentiable, which is a much stronger property. By definition, $f$ is complex-differentiable at $z_0$ if the usual limit
$$\lim_{h \to 0} \frac{f(z_0 + h) - f(z_0)}{h}$$
of the difference quotient of $f$ exists, in which case we define $f'(z_0)$ to be its value. Critically, $h$ is here a complex variable: In the case of the conjugation map, the limit simplifies to
$$\lim_{h \to 0} \frac{\bar h}{h},$$
and for real $h$ we have $\frac{\bar h}{h} = \frac{h}{h} = 1$, but for imaginary $h$ we have $\frac{\bar h}{h} = \frac{-h}{h} = -1$. Thus, the limit does not exist for any $z_0$, and the map is not complex-differentiable anywhere.

A: To be complex differentiable (holomorphic) require more than differentiability for a real function (that, anyway, is more than continuity) because we need that the limit of the incremental quotient have to be the same ''from any direction'' in the Argand Plane. You can see a good illustration of the case $f(z)=\bar z$ here.


text:
Q: MEF, creating Import's tree when a branch is requested Using MEF I want to do the following.
I have a WPF Shell. To the shell I want to Import from another DLL a UserControl that is also a View of my MVP triad.
The way the MVP triad works, is that in presenter I have a constructor that takes both IModel and IView and wires them up.
So, in order for this to work, I need MEF to do the following:

*

*Create IView implementation

*Create IModel implementation

*Create Presenter and pass IModel and IView to its constructor

*Import IView implementation into my shell when it gets displayed

Instead what it does, is it only creates the type Exporting IView and passes it to the shell, basically skipping steps 2 and 3. Its pretty logical, when you think about it, but how can I tell MEF to also create the whole triad when I ask for a IView.
I don't need to reference Presenter nor model anywhere else in my Shell .dll so puting it as an Import as well is not an option (and it would be quite ugly anyway :).
I'm using the latest drop of MEF (Preview 2 Refresh).
Anyone?
==Update==
I have found a solution and I blogged about it here:
Krzysztof Koźmic's blog - Creating tree of dependencies with MEF
However, I'd be more than happy if someone came up with a better solution.**

A: Check my answer here.
http://codebetter.com/blogs/glenn.block/archive/2008/11/12/mvp-with-mef.aspx
EDIT: (Added from the link, to prevent not being flagged as low quality / LOA)
   1: using System.ComponentModel.Composition;
   2: using System.Reflection;
   3: using Microsoft.VisualStudio.TestTools.UnitTesting;
   4:
   5: namespace MVPwithMEF
   6: {
   7:     /// <summary>
   8:     /// Summary description for MVPTriadFixture
   9:     /// </summary>
  10:     [TestClass]
  11:     public class MVPTriadFixture
  12:     {
  13:         [TestMethod]
  14:         public void MVPTriadShouldBeProperlyBuilt()
  15:         {
  16:             var catalog = new AttributedAssemblyPartCatalog(Assembly.GetExecutingAssembly());
  17:             var container = new CompositionContainer(catalog.CreateResolver());
  18:             var shell = container.GetExportedObject<Shell>();
  19:             Assert.IsNotNull(shell);
  20:             Assert.IsNotNull(shell.Presenter);
  21:             Assert.IsNotNull(shell.Presenter.View);
  22:             Assert.IsNotNull(shell.Presenter.Model);
  23:         }
  24:     }
  25:
  26:     [Export]
  27:     public class Shell
  28:     {
  29:         private IPresenter _presenter = null;
  30:
  31:         public IPresenter Presenter
  32:         {
  33:             get { return _presenter; }
  34:         }
  35:
  36:         [ImportingConstructor]
  37:         public Shell(IPresenter presenter)
  38:         {
  39:             _presenter = presenter;
  40:         }
  41:     }
  42:
  43:     public interface IModel
  44:     {
  45:     }
  46:
  47:     [Export(typeof(IModel))]
  48:     public class Model : IModel
  49:     {
  50:
  51:     }
  52:
  53:     public interface IView
  54:     {
  55:     }
  56:
  57:     [Export(typeof(IView))]
  58:     public class View : IView
  59:     {
  60:     }
  61:
  62:     public interface IPresenter
  63:     {
  64:         IView View { get;}
  65:         IModel Model { get; }
  66:     }
  67:
  68:     [Export(typeof(IPresenter))]
  69:     public class Presenter : IPresenter
  70:     {
  71:
  72:         private IView _view;
  73:         private IModel _model;
  74:
  75:         [ImportingConstructor]
  76:         public Presenter(IView view, IModel model)
  77:         {
  78:             _view = view;
  79:             _model = model;
  80:         }
  81:
  82:         public IView View
  83:         {
  84:             get { return _view; }
  85:         }
  86:
  87:         public IModel Model
  88:         {
  89:             get { return _model; }
  90:         }
  91:
  92:     }
  93: }

So what's going on here?
Shell gets injected with Presenter. Presenter gets injected with View and Model. Everything here is singletons, but doesn't have to be.
The difference between our two examples is that the Presenter is getting injected into the shell rather than the View. If the Presenter is creating the View then you can't just grab the View first (as he was doing), or the Presenter will not get created. Well you can do it, but you end up hacking it to bits. Cleaner is to just inject the Presenter and have it expose an IView. We did this in Prism and it worked quite well.

A: The way you outlined in your blog post is the perfectly valid way for utilizing MEF. This is nested composition, and while designing it is always good to keep in mind that Container is the decider, so as a plug-in / extender vendor you will focus on your services that you are "exporting" and as an important, you shouldn't worry about what you need to be serviced, or "importing" (this point has some issues in the last drop, but I hear good enough to be optimistic about it).
So in nested composition, you may need some external services but at the time you can also be providing some. When you do a compose, it will plug everything together.
I have a blog post containing 2 examples illustrating this way of thinking :
http://www.sidarok.com/web/blog/content/2008/09/26/what-is-this-managed-extensibility-framework-thing-all-about.html
Also, to drop the dll and watch the types in it, you can use DirectoryPartCatalog to watch that folder.
You will also need to watch out the scenarios where there are multiple exports for the same contract, and determine the right one from metadata provided.


text:
Q: Long Enumerate in Long Table I would like to have a LONG enumerated list inside a (long)table and have the long list wrapped to the next page.  However, the longtable clips the enumerated list instead of wrapping it.  Here is a minimal example:
\documentclass{article}
\usepackage{longtable}
\pagestyle{empty}
\begin{document}
    \begin{longtable}{p{0.2\linewidth}p{0.8\linewidth}}
        Some text &
            \begin{enumerate}
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
            \end{enumerate}
    \end{longtable}
\end{document}

A: Here is a workaround with enumitem and its resume* key:
\documentclass{article}
\usepackage{longtable, array}
\usepackage{enumitem}

\pagestyle{empty}

\begin{document}%

    \begin{longtable}{p{0.2\linewidth}p{0.8\linewidth}}
        Some text & \begin{enumerate}[topsep= 0pt, partopsep=0pt, before=\vspace*{-\baselineskip}, after=\vspace*{-\baselineskip}, series=TE]
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
\end{enumerate} \\
    Some more text & \begin{enumerate}[resume*=TE]
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
                \item An enumerated item
            \end{enumerate}
    \end{longtable}

\end{document}

A: You can create multiple tables, one per page, and change the number of the first item on each page.
\documentclass{article}
\usepackage{longtable}
\pagestyle{empty}
\begin{document}
\begin{longtable}{p{0.2\linewidth}p{0.8\linewidth}}
Some text &
\begin{enumerate}
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\end{enumerate}
\end{longtable}

\newcommand\setItemnumber[1]{\setcounter{enumi}{\numexpr#1-1\relax}}

\begin{longtable}{p{0.2\linewidth}p{0.8\linewidth}}
Some text &
\begin{enumerate}
\setItemnumber{31}
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\item An enumerated item
\end{enumerate}
\end{longtable}
\end{document}

Source: How can I change the number of enumerate items?


text:
Q: Do browsers read/store everything in a Javascript file or only the stuff they need? Here's what I'm asking:
Suppose I have on my site
<script type="text/javascript" src="global.js"></script>
<script type="text/javascript">
    someFunction();
    someOtherFunction();
</script>

and suppose someFunction and someOtherFunction are the only functions used on the page and are 2 of 10,000 functions in global.js. Clearly the browser would be better off in this situation looking only for those 2 functions in global.js and skipping everything that doesn't depend on them, but which of the following ways is actually how the browser parses JS?

*

*JS engine takes every function definition it comes across and makes it into machine code and then uses it if it ever needs to

*JS engine looks for use of functions and then looks for their definitions and builds machine code and uses the function whenever needed (including the use case it found)

A: 1.

<script type="text/javascript" src="global.js"></script>

Load entire text source of global.js into memory. Parse and execute any JavaScript code there in the current global environment.
2.

<script type="text/javascript">
 someFunction();
 someOtherFunction();
</script>

Look in the current global environment for the function named someFunction() and call it. Next look in the current global environment for the function named someOtherFunction() and call it. Has absolutely no clue about where or how they were defined.

All in all, browsers will take the entire file and parse and execute all of the contained code there up front because that is the design of the language. It will not look forward or "compile" all of the JavaScript code in a page at once.

A: This is a great question!
As an answer to your question, #1 is the most correct, as indeed all functions are parsed by the interpreter during script load, rather than just those referenced by your containing script.
First off, as soon as the include statement executes the entire JS file is loaded into the client's browser cache. At that point global.js is parsed, interpreted and executed by your browser's Javascript engine. Any global functions and variables declared in global.js will then be able to be used by the containing script.
It is important to note, however, that no Javascript is ever compiled into machine code, rather it is lexically parsed and interpreted according to ECMA standards.

For more information on script loading, check out this great resource on html5rocks: Script Loading


text:
Q: How to find the cause of an "internal application error" At a customer's site, our application sometimes shows an "internal application error".
I was able to get a dumpfile of such a situation; unfortunately, this file is not very helpful: It effectively only contains the information, in which event handler an exception occured. Since this event handler calls many other functions, I was not able to track down the root cause of the exception.
When I can reproduce such an error on my PC, I just have to catch first chance exceptions in the debugger and the problem is easily found.
I also don't have problems finding the cause of hard crashes (e.g. access violation), because the resulting call stack points directly to the cause of the crash.
How can I find the cause of this error (installing small tools at the customer's site is an option)?

A: 1) Use Windebugger installed on the client machine.
2) Then get the Pdb files that belongs to the release at your customer end.
3) Open Windebugger, under file menu select the Symbol Path menu item, from the displayed window - Place the path to your symbol file.
4) Open your dump file
5) Issue the command at the bottom "!Analyze -v"
The debugger will give you the stack trace, current Instruction pointer location, last thrown (Unhandled?) exception or other bug cause


text:
Q: Disable word based suggestion in Visual Studio Code I want to disable word based suggestion, it's annoying and useless in my opinion. For example Brackets will offer suggestion for variables, methods and language and will not pollute the suggestion list with all similar words written in file.
I just want code suggestion. I tried  "editor.wordBasedSuggestions": false, but no luck. How to change that ? Thanks.
Example:

A: // Controls if suggestions should be accepted 'Enter' - in addition to 'Tab'. Helps to avoid ambiguity between inserting new lines or accepting suggestions.
"editor.acceptSuggestionOnEnter": "off"

from here

A: You can use this setting:
"editor.wordBasedSuggestions": false

A: Try adding:
"javascript.nameSuggestions": false

A: You can use this one as I had problems with javascript function snippet not being on top
  "editor.suggest.filteredTypes": {
     "keyword": false
  },

A: In UI it's:
Edit -> Perferences -> Settings -> Text Editor -> Suggestions -> Javascript > Suggest: Names


text:
Q: Problem with deleting a "Page" My developer/designer is being a problem and won't tweek changes to my site... changes I can't do myself because I don't have FTP level ability (if that's the word?). I can only make basic changes within the dashboard, like "deleting" and adding content, photo to existing "projects".
I'm a newbie so bear with me.
My question is... If I delete an entire "page" (one listed on the Navi bar of my site) will that screw up any other pages on the navi bar or anthing else on the site?
This navi bar "page" I want to delete contains items and prices of things, but I don't have ability to change pictures and prices myself. SO... I want to delete the entire page, then use an existing "project" (one of many that exists within a different page on the navi bar) to upload new images and prices. It's a ghetto way to resolve the issue but the developer is ignoring me.
So, in summary, will deleting a navi-bar "page" result in anything other than removing it from the site? I don't want to screw up anything.
Thanks. Hope I have explained myself well enough.

A: I'm sorry you're having trouble with you developer.
I recommend unpublishing the page (saving it to draft) rather than deleting it right away. This will allow you to restore the content if any issues arise.
No one can say for certain whether removing this page will cause issues or not since no one can see how the site was developed. This is important.
For most typical sites, removing a page would only be a problem in two ways:

*

*Any links to this page on your site or from any other site would no longer work. This effects your site's listing on search engines as well.

*Any child pages of this page will no longer live at the same url. This may not be an issue for you. It depends on your site's hierarchy.

There could be a lot more to it, so be careful.


text:
Q: Trying to load a partial view with Ajax.ActionLink After reading a few other posts on here I've got this far with attempting to load a partial view on the click of a link (the text link may actually change to be an image once I get past this proof of concept stage). The problem is I am being directed to the partial view on click instead of it populating a div within the view I am clicking the link on:
The layout:

The View:
 @Ajax.ActionLink("Item 1 Ajax", "Details", "Portfolio", new { name = "test" }, new AjaxOptions
                        {
                            HttpMethod = "Post",
                            InsertionMode = InsertionMode.Replace,
                            UpdateTargetId = "row1Content",
                            OnComplete = "portfolioItemLoaded"
                        })

The controller:
public class PortfolioController : Controller
    {
        public ActionResult Details(string name)
        {
            return PartialView(name);
        }
    }

The partial (obviously named test.cshtml):

Item 1 test

Have I missed something obvious? It's the first time I have attempted to use AJAX in MVC, so there might be a school boy error or two.
I am planning on having several different Ajax Action Links that call different partial views, hence the reason I am passing the name in to the controller.

A: Code fixed
Do you wanna try this, you have a better control, if error, etc....
HTML with helper
@Html.ActionLink("Item 1 Ajax", "Details", "Portfolio", Nothing, New With {.Id = "myLink"})

JavaScript


text:
Q: Jake on Node.js? From what I have understood Jake (Rake equivalent for Javascript) is based on Rhino.
Does this mean that I cannot use it with Node.js?

A: Actually Jake (https://github.com/mde/jake) is designed to work especially with nodejs. You shouldn't get any problems with running it.

A: There's even an npm package; https://www.npmjs.com/package/jake .Jake and nodejs is a great combination for automation.


text:
Q: Format-Table in PowerShell: dynamically configure columns I try to format two dimensional table in PowerShell:
$ContentServeres.Keys | Sort-Object | Foreach-Object {
    $Columns += @{Label=$_; Alignment='right'}
}

$ClientServeres.Keys | Sort-Object | Foreach-Object {
    PROCESS {
        $obj = $ClientServeres.Get_Item($_)

        $serverOutObj = New-Object PSObject
        $serverOutObj | Add-Member NoteProperty Client ("$($_)`t`t")

        $ContentServeres.Keys | Sort-Object | Foreach-Object {
            $serv = $obj.Get_Item($_)
            $serverOutObj | Add-Member NoteProperty $_ ("{0:N0}" -f $serv.SumLength)
        }
        Write-Output $serverOutObj
    }
} | Format-Table $Columns -AutoSize

But it doesn't work. I get error with $Columns:
InvalidArgument: (:) [Format-Table], NotSupportedException

I've found a Sample https://technet.microsoft.com/de-de/library/ee692794.aspx
$a = @{Label="ColA"; Alignment='right'}, @{Label="ColB"; Alignment='right'}
...
Format-Table @a ...

How can I dynamically create such $a list?

A: I think you're trying to pipe data into Format-Table and also give columns as parameters.
Put the Format-Table on a new line w/o piping data.

A: I've found the problem. I've collected columns definition with += and got hashtable instead of array. It should be += , used. I.e.
    $Columns += ,@{Label=$_; Alignment='right'}

But there is another problem, Expression should be defined and I've not found yet how to do it dynamically...


text:
Q: Find the partial deriavtive with respect to x and y $$f(x,y)=\ln \frac{x-y}{(x+y)^2}$$
Use log properties
I started with this
$$\ln(x-y)-2\ln(x+y)$$
I got this for $x$:
$$\frac{1}{x-y}-\frac{2}{x-y}$$
I got this for $y$:
$$-\frac{1}{x-y}-\frac{2}{x+y}$$
would this be the final answers or am I missing something with my work?

A: No, this is not true.
$$\frac{\partial}{\partial x} f(x,y) = \frac{1}{x-y}-\frac{2}{x+y}$$
$$\frac{\partial}{\partial y} f(x,y) = -\frac{1}{x-y}-\frac{2}{x+y}$$
Small mistake in the derivative with respect to $x$. The derivative with respect to $y$ is okay.
To see this, note that the partial derivative with respect to $x$ of $\ln(x-y)$ is $\frac{1}{x-y}$ by the chain rule, and the partial derivative with respect to $y$ of $\ln(x-y)$ is $-\frac{1}{x-y}$ by the chain rule. For the other two the chain rule can be used as well.


text:
Q: Java cache objects to disk I have a collection of rather large objects (one complex class, can be made serializable) and an algorithm operating on it. The algorithm has to work on each object several times, and only needs a few objects of the collection at once.
To save RAM, I'd like to cache objects that weren't used for a while by the algorithm to disk if there isn't enough memory anymore. The algorithm needs to know which objects are on disk so it can avoid them as long as possible.
How do I achieve this? Do I have to implement this on my own or are there existing libraries?
Edit:
I probably won't have more than a few hundred of those objects since I discard them as soon as possible. Each object (simplified description) contains a 2D-array with up to 256x256 elements. Consider an average load of the main Array around about 30% and the child array being nearly full most of the time. Each object in the array contains some smaller data: A few array lists with vectors in it, a properties HashMap and so on. I outsourced most of the data with instancing so that it is fairly small.

A: Thanks to a nice guy on GitHub who mentioned MapDB, which fits the use-case pretty well. It has memory/count and time based item eviction. The documentation even has an example (section "Expiration Overflow"):
DB dbDisk = DBMaker
        .fileDB(file)
        .make();

DB dbMemory = DBMaker
        .memoryDB()
        .make();

// Big map populated with data expired from cache
HTreeMap onDisk = dbDisk
        .hashMap("onDisk")
        .create();

// fast in-memory collection with limited size
HTreeMap inMemory = dbMemory
        .hashMap("inMemory")
        .expireAfterGet(1, TimeUnit.SECONDS)
        //this registers overflow to `onDisk`
        .expireOverflow(onDisk)
        //good idea is to enable background expiration
        .expireExecutor(Executors.newScheduledThreadPool(2))
        .create();


text:
Q: Create a webhook between my front end and back end So from what I understand about webhooks, I keep looking up "How to create a webhook from my API" but the results keep giving me how to add a webhook (From say GitHub) from different sites. I'm not sure if this is possible but currently, my react native app polls my node js backend for information every minute. Instead, I want my node js backend to detect a change in my database for a specific user, and then send that updated information to my react native app user. Is this possible, does anyone have any guidance or direction, even a link because all the information I find online is not what I want? Are there any third-party apps that could help in this process? What would I need to do exactly?

A: No, you won't be able to have a webhook call back to the react app. The app runs within a secure browser, on a secure operating system, on a secure network. At least, hopefully, it runs in a secure environment.
Your in-browser app does not run a web server so even if there was a network route to your machine, how would you receive it? You'd need to bind to a network port somehow. Not gonna happen.
Instead, look into WebSockets or HTTP2 Server-Sent Events (SSE). They allow the servers to push data to a frontend web app running in the browser. It's not technically webhooks, but the same concept.


text:
Q: Android: getting different bssid for the same access point The point of my app is to limit actions based on the network that I am connected to. I chose to define the network by the access point's mac address or BSSID. I'm using WifiInto's getConnectionInfo() and getBSSID() to get the BSSID of the access point.
I'm under the impression that BSSIDs are unique for an access point. However, across different devices, I am getting a slightly different BSSID (last 4 digits are different but the first 8 are the same). And even in the same device, on connect, the BSSID can be a little different.
My question is, is there a way to reliably uniquely identify an access point? People have told me that MAC address is the only way to do so but as you see here, the BSSID returned is slightly different.

A: Before giving an answer to your question, i would like to explain little bit about BSSID, SSID and Access Point.
An access point can announce multiple SSIDs. So for uniquely announcing an SSID, separate BSSID will be used.
SSID announced by multiple access points will be announced by separate BSSID (by each access point). So, if you want to see how many access points are announcing the said SSID, you can figure how many BSSID you are getting for the same SSID.
An access point of dual band (i.e., 2.4 GHz and 5 GHz) will announce 2 BSSID for same SSID; One for 2.4 GHz band and other one for 5 GHz band.
For example, if you have 10 dual band access points in your network and each one announcing the same SSID; you will have 20 BSSID in total announcing same SSID.
(Although 10 access points are not needed at one place and they are generally placed in a manner that only 3 or 4 are able to listen to each other. So you will not find 20 BSSID at any single place as per above example).

Now, to answer your question, about uniquely identifying an access points.
BSSID is creating using the MAC address of the access point, having first 8 digits are same as the MAC of the access point and last 4 digits are unique per BSSID.
So by looking the BSSID, you can do some guess for uniquely identifying an access point.

A: yes BSSID are unique , but you can have multiple BSSIDs in a RF aream for a single ESSID , that is multiple access points announcing same SSID
so its quite possible that the different client device will show different BSSID ,this seems to be happenning in your case


text:
Q: True Or not: Compact iff every continuous function is bounded Let $X$ be a topological space. My question is:
If $f:X\to \mathbb{R}$ is bounded for all such continuous $f$, then is $X$ compact. Is is really?
If $X$ is the subset of $\mathbb{R}^d$, then it is clear, beacause with Heine-Borel we get what we want (closed and bounded (with the help of the norm)), but is it true in general? I really hope there exists a non-compact space with the property above.

A: Let $X =  [0,\omega_1)$. Then $X$ is non-compact as the $[0,\alpha)$, $\alpha < \omega_1$ form an open cover without even a countable subcover.
On the other hand, let $f \colon X \to \mathbb R$ continuous. Suppose $f%$ were unbounded. Then there is a sequence $\alpha_n < \omega_1$ such that $f(\alpha_n) \ge n$. As $[0,\alpha]$ is compact for $\alpha < \omega_1$ and $f$ is continuous, $f([0,\alpha])$ is bounded. So we may arrange that $\alpha_{n+1} > \alpha_n$ for $n < \omega$. Let $\alpha^* = \sup_n \alpha_n$. By continuity $f(\alpha^*) = \lim_n f(\alpha_n)$. But $f(\alpha_n) \ge n$ for each $n$. Contradiction, hence $f$ is bounded.

A: To complement Martini's answer, one may add that if the space $X$ is $metrizable$, then the answer is "yes".
Indeed, assume that $X$ is metrizable and not compact. Then one can find a sequence $(x_n)_{n\in\mathbb N}\subset X$ with $x_n\neq x_m$ if $n\neq m$, such that the set $C=\{ x_n;\; n\in\mathbb N\}$ is discrete in the topology induced by $X$. Then the function $f_0=C\to\mathbb R$ defined by $f_0(x_n)=n$ is continuous and unbounded. Moreover, $C$ is closed in $X$, so by Tietze's extension theorem $f_0$ can be extended to a continuous (and unbounded!) function $f:X\to\mathbb R$.
Apologies: I did not notice that Davide Giraudo gave the same answer in a comment above.


text:
Q: firebase "clang: error: linker command failed" with ios and xcode Trying to use firebase with iOS and never dealt with pods before
1) I create a project in ios with swift for iPhone.. called stupid
2) Here is where the project is located and the files created:
~/Documents/swift/stupid$ ls
stupid          stupid.xcodeproj

3) This is what firebase says to do:
Move the GoogleService-Info.plist file you just downloaded into the root of your Xcode project and add it to all targets.

~/Documents/swift/stupid/stupid$ ls
AppDelegate.swift       GoogleService-Info.plist    stupid.xcdatamodeld
Assets.xcassets         Info.plist
Base.lproj          ViewController.swift

4) I run the below in the ~/Documents/swift/stupid dir
     ~/Documents/swift/stupid$ pod init
Google services use CocoaPods to install and manage dependencies. Open a terminal window and navigate to the location of the Xcode project for your app.

Create a Podfile if you don't have one:

pod init
Open your Podfile and add:

pod 'Firebase/Core'
includes Analytics by default help_outline
Save the file and run:

pod install

5) I build the project
And now I get this error. Who can tell me why?
clang: error: linker command failed with exit code 1 (use -v to see invocation)

A: Double check that you open workspace instead of xcodeproj.


text:
Q: Updating EJS Partial view data works, but data is not displayed I am using NodeJS and EJS to build my application.
As the post title suggests, I have an index view into which I have inserted a modal partial view as such:
<%- include ./hint-modal %>

Initially, the hints variable I am trying to display in hint-modal is an empty array. Once the hints are computed, at the press of a button, I am sending a PUT request to Index, to update hints.
app.put(function (req, res) {
  res.render('index', { hints: req.body.hints });
});

The code in hint-modal is:
<% for (var i = 0; i < hints.length; i++) { %>
  <% console.log(hints[i]) %>

<%= hints[i] %>

<% } %>

The console.log outputs each hint into the terminal. However, no paragraph is added to the view, and as such, not hint either.
I've been trying to figure out what's going on for the past couple of hours and have been looking at various solutions, but nothing worked. If anyone has any idea about it, it'd be greatly appreciated.
Update:
The click handler is something along these lines, abstracting irrelevant calls to the issue at hand:
$('#hint-button').click(function() {

    $.ajax({
        url: '/hints',
        type: "POST",
        contentType: 'application/json',
        data: JSON.stringify({
            in    : inLab,
            out   : outLab,
            undec : undecLab,
            unlab : unlab,
            sol   : solutions
        }),
        success: function(data) {
            var ret   = JSON.parse(data);
            var hints = ret.hints
            $.ajax({
                url         : '/',
                type        : "PUT",
                contentType : 'application/json',
                data        : JSON.stringify({ hints: hints})
            });
        }
    })
});


text:
Q: Public Wi-Fi with Individual Authentication and Time limit for Internet Access I would like to change the way that my costumers access to the internet. I would like to enable two ways for sharing my internet:

*

*With my wireless network as public, I would like to give a
username and password to a user, this way he can access to the
Internet for a limited time (determined by him). Just users with a
username, password and "credit" can access to the internet. The
authentication must be over a web page.

*As #1, with public wireless network, I would to share temporary
codes (generated by a my server) that allows users to access
internet in their devices for a limited time (determined by the
server). Authentication must be over web, and all users need to have
a specific temporary "ticket" (that loses its capability to
provide internet after it was used).

It is important to say, that each user need to have a time control. When it expires, the user needs to be redirected to the Auth page.
I know that it is possible, I just want some specific names for this approach, may be some tools, tutorials, guides...
Anybody can help me? :)
THANKS A LOT

A: What you are looking for is essentially a "Captive Portal" server for your wireless networks.
I would suggest you look at pfSense, it is an open source Firewall/Unified Threat Management system and has Captive Portal functionality built in.
You can also do time restrictions based on VLAN, IP, MAC, Route, etc. Very powerful platform. Even lets you produce vouchers


text:
Q: Do i need vCenter Server for vGPU? i have been digging around every corner of the internet and spoken to both vmware (who only spoke enough to tell me they can't talk to me) and dell, but i can't find the answer to a simple question: do i need a vCenter Server License to use Nvidia GRID vGPU?
vSphere Enterprise Plus is required to run Nvidia GRID. that's fine. i have created a setup with an evaluation license and everything is running. but where i'm confused is, i can't assign a vGPU profile in the ESXi host; i need to do that in vCenter instead. so will i then need to license vCenter Server on top of vSphere Enterprise Plus? i feel like it's an important question, since the vCenter Server license costs more than the Enterprise Plus vSphere license. i would really appreciate if someone could answer that for me.
jared


text:
Q: Problems to get jquery to work in json rendered html format I run a "strip out" version of FB bigPipe and it's working perfect, except the jquery. When I parse the jquery in json format and append to a div tag, the jquery stop working.
You can see the "bigPipe" jquery code I use  here
The code to get this working is pretty simple. In PHP:
$data = array(
        'id' =>  {div tag ID},
        'content' => {html content},
        'title' => {document title},
        'css' =>  {...},
        'js' => {...}
        );

$output = '';

I think the problem is that I have to add window.addEventListener not to the window itself, but to the div tag I append the content.
And here I'm stuck. How do I do this?  How do I get this jquery to work in this appended html?
Here is a example on how it should work:
If you try to run this code from a php file problems occur.Do this:

*

*Put the js code from jsFiddle in a js file and include normaly in the .php file. Make a div tag in the php file and call it "not_working"- Save

*Make a empty .html document and add a div tag like
Click me
 and save.

*

*Make a new js file and name it test.js.
Put in this code:

$(function() {
$("body").on("click","#test",function(){
    alert("You clicked me!!");
});

});
Save.

*

*In the PHP file, add this: $data = array(
        'id' =>  "not_working",
        'content' => {LINK and NAME to the HTML file you created!!},
        'title' => "Test",
        'css' =>  "",
        'js' => {LINK and NAME to the JS file you created!!},
        );

*Run the .php file, click on the Click me!.

A: Problem solved. It was a error in the way the js files was inserted into the body element. After fixing that code. I solved it, and now everything work perfect.
If someone try to use this code, here is the changes:
function _addJsFile(filename) {
  var blody = document.getElementsByTagName("body")[0],
  script = document.createElement('script'),
  done = false;

  script.src = filename;
  script.type='text/javascript';
  script.onload = function() {
      if (!done && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete")) {
        done = true;
        // Handle memory leak in IE
        script.onload = script.onreadystatechange = null;
        if (blody && script.parentNode) {
          blody.removeChild(script);
        }
     }
  };

  blody.appendChild(script);
}