text:
Q: How can I recover 1 year of chat history from skype (My PC has formatted recently) I recently formatted my system and in the process reinstalled Skype. I want to recover the previous one year's Skype call history that I had before formatting. Is it possible to restore it in any way?

A: You can't.
If your computer got formatted, the files needed to fetch the history are no longer there unless you use some forensics tools to "undelete" the files. This may not work since it's possible the files have already been overwritten. You can try using such a tool to restore your Skype db files located in the %userprofile%\appdata\ folder.
You can also send the drive to a data recovery specialist (usually starts at around $500-$700) to see if the data can be professionally recovered.
Skype does not keep conversation history on their own servers, so there is no way to contact them to get it back.


text:
Q: How to get my org's IP address? and I want to make sure that each organization has only a unique IP? My org has some callouts to another server. but the server requires to add IP address to whitelist. So I need to know how many IP addresses does each org have and how can I get it through coding or something else.

A: Salesforce's IP ranges can be found on this page - https://help.salesforce.com/articleView?id=000003652&type=1.  Your particular org can possibly attempt external connections from any IP address in that range, although as the answer linked in comments notes, you can use nslookup to find the IP range of your particular pod, at the risk of that range being subject to change without notice.

A: How to check your SF IP address:
Add remote site setting - This endpoint https://salesforcelwc.herokuapp.com
Use this script to access to that endpoint:
HTTP h = new HTTP();
HTTPRequest req = new HTTPRequest();
req.setEndPoint('https://salesforcelwc.herokuapp.com/myip');
req.setMethod('GET');
HTTPResponse res = h.send(req);
System.debug(res.getBody());

In the debug log you'll see the IP in this format:

redpajama_set_name: RedPajamaStackExchange


text:
Q: What is the reporting function? When dealing with an enterprise application, I often heard the requirement of "reporting function" "run reports", "generate reports", etc. What is it referring to?

A: Reports in an enterprise application context usually refer to Business Intelligence reports. A broad definition of Business Intelligence, from Forester Research is:

Business intelligence (BI) is a set of methodologies, processes, architectures, and technologies that transform raw data into meaningful and useful information. It allows business users to make informed business decisions with real-time data that can put a company ahead of its competitors. Traditionally, core features like reporting and analytics have been the focus of BI technology choices, but as those features get commoditized, a whole new set of possibilities has emerged. Forrester's BI research shows that the technology is evolving and that enterprises on the cutting edge of these new trends can gain competitive advantage in their industries.

So, reporting mostly refers to the visualization and quering of Business Intelligence data. From a technical perspective, enterprise reporting usually involves (but is not limited to):

*

*Data visualization,

*Analytics (General, Statistical and Predictive),

*Online analytical processing,

*Data mining,

*Process mining,

*Benchmarking
Apart for a few common reports that are relevant for almost every business (basic statistics, common ERP / CRM operational reports), it's impossible to predict what a client requires when asking for reports, as every business and market has quite different operations and needs. Reports may range from simple charts to extremely complex multi-dimensional queries.

A: Reporting is the activity of applying transformations to stored data so that the end user can get information or satisfy business needs such as invoicing, control, planning, etc.
Some examples of basic reports:

*

*In a retail system, you get a receipt after making a payment. This recipt is a type of report.

*In a retail system, the manager may want to pull all the items that will expire in a given data.

*In an HR system, an HR manager may want to list people who's salaries > 100K

*Stock items shortage report, shewing items that reached re-order level and must be ordered to satisfy expected customer demand.

*System failure analysis reports showing time of system failure and associated messages

*In a banking system, a monthly statement is a report.
The above reports are referred to as 'operational reports' - They are built and used to control the operation of day-to-day business operations. Another type of reports exist to better control the business and make decisions about performance of the business in general and in particular against per-defined KPIs. Such reports pull information from one or more system and produce a 360-view to the management about a subject area or more.  These reports are usually refereed to as Business Intelligence Reports For example:

*

*Inventory across Regions, states, stores

*Sales of different goods across Regions, states, stores

*Customer consumption of goods from organization
There are still more types of reports such as Data Mining reports, I will leave that for you to research if you want.
The report may be as simple as a list or as an aggrigated format with controls and calculations. See for example
Group View Report
Reports, as you can imagine, may be consumed by customer, end-user, analyst, manager, etc. The business analyst defines the suitability of each type of report to each type of users. Managers usually use high level views of information structured in an appealing visual display commonly referred to as Dash Boards.
See this for example:
Dash-1
Dash-3
Dash-2
Reports are not only text. A report can display information in both text and graphical format as a chart or maps.
Reports can be the result of a simple query or the result of a series of integration operations (as is the case of large BI and data warehousing environments).
Tools exist to generate reports using either programming language or specific reporting tools or languages.
End-user tools such as Excel can be used for reporting. In fact Excel provides an advanced type of reporting called pivot tables reports.
See: Pivot Tables in Excel
More advanced tools exist such as:
Advanced Analytics
Reporting can be performed in an on-linen environment or in batch. The subject is so wide to cover here, but I think you get the picture.

A: Usually such requirements are about generating some sort of statistical report(s) from the data gathered in the DB. Such as

*

*hourly/daily/monthly sales volume

*most purchased goods during last day/week/...

*most active users during last day/week/...

*who modified a given contract, when and how

etc. The exact kind of report is largely dependent on the business domain and the type of application in question. Usually such reports are backed by (SQL) queries to the DB, but the source may also be server logs etc. The results may be generated as an Excel/CSV file, visualized as a diagram, etc.


text:
Q: openpyxl: writing large excel files with python I have a big problem here with python, openpyxl and Excel files. My objective is to write some calculated data to a preconfigured template in Excel. I load this template and write the data on it. There are two problems:

*

*I'm talking about writing Excel books with more than 2 millions of cells, divided into several sheets.

*I do this successfully, but the waiting time is unthinkable.

I don't know other way to solve this problem. Maybe openpyxl is not the solution. I have tried to write in xlsb, but I think openpyxl does not support this format. I have also tried with optimized writer and reader, but the problem comes when I save, due to the big data. However, the output file size is 10 MB, at most. I'm very stuck with this. Do you know if there is another way to do this?
Thanks in advance.

A: The file size isn't really the issue when it comes to memory use but the number of cells in memory. Your use case really will push openpyxl to the limits at the moment which is currently designed to support either optimised reading or optimised writing but not both at the same time. One thing you might try would be to read in openpyxl with use_iterators=True this will give you a generator that you can call from xlsxwriter which should be able to write a new file for you. xlsxwriter is currently significantly faster than openpyxl when creating files. The solution isn't perfect but it might work for you.


text:
Q: How to properly set the divs in an article
So i need to convert this image to html and css and I was wondering the proper way to do this as im still confused when to use div and span.
So, first of all i made a list and then two divs inside it, one for the image and the article.
In the article, i thought putting on divs would be too much and just didnt put any and started putting span. :/
Should i put div for every element like the date then heading and the paragraph?
Can someone suggest a good method for this?

            October 9,2015.
            4 Comments

TAKE A BREAK

Lorem ipsum dolor sit amet, consec tetuer adip iscing elit. Aenean commodo ligula eget dolor. Aenean mas- sa. Cum sociis natoque penatibus  ...

          READ MORE

A: I would only get rid of the useless ul/li here.
You can also use the article tag for your article :-).

body {
  box-sizing: border-box;
  font-family: Arial;
  font-size: 10px;
}

.posts {
  display: inline-block;
}

.post-image {
  display: inline-block;
}

.post-image img {
  display: block;
  width: 200px;
}

.post-content {
  display: inline-block;
  padding: 2em;
  vertical-align: top;
  width: 200px;
}

.post-comment {
  margin-left: 1em;
}

      October 9, 2015

      4 Comments

TAKE A BREAK

Lorem ipsum dolor sit amet, consec tetuer adip iscing elit.

      READ MORE


text:
Q: Embedded Signing View Docusign returning 404 I am trying to get the embedded signing view to redirect my user so they can sign the document. Everytime I make the request I get a 404 with no message. There is nothing with the response other than the HTTP code. Sending the envelope works completely fine, I get an email everytime I try to test this.
$data = json_encode(array(
  "returnUrl" => base_url() . "dashboard/home",
  "authenticationMethod" => "email",
  "email" => $this->userEmail,
  "userName" => "seller",
  "clientUserId" => $this->user,
  'recipientId' => '1'
));

$ch = curl_init($this->baseUrl . "/envelope/$this->envelopeId/views/recipient");

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  'Content-Type: application/json',
  'Content-Length: ' . strlen($data),
  'X-DocuSign-Authentication: ' . $this->header
  )
);

$resp = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  $headers = curl_getinfo($ch, CURLINFO_HEADER_OUT);

if ($status != 201) {
  error_log($resp);
  die();
}

$response = json_decode($resp, true);
return $response['url'];

I have followed the examples on Docusign's documentation and even have this working in another section, this just uses composite templates instead. I tried searching for the Embedded Signing returning a 404 but found nothing. I would attach the error message but all it gives is that its receiving a 404. Thank you in advance!

A: You have misspelled envelopes
$ch = curl_init($this->baseUrl . "/envelope/$this->envelopeId/views/recipient");

should be
$ch = curl_init($this->baseUrl . "/envelopes/$this->envelopeId/views/recipient");

The url for the EnvelopeViews:createRecipient should be of the following format.

POST /v2/accounts/{accountId}/envelopes/{envelopeId}/views/recipient

For example, if you are using the Sandbox environment then you will have to do a HTTP POST to the following url
https://demo.docusign.net/restapi/v2/accounts/{accountId}/envelopes/{envelopeId}/views/recipient


text:
Q: How to convert rows into column in sql I have a table,

and need to convert it as

I have tried pivot but can't figure out please help me out .

A: Pivot does not work with more than one column out-of-the-box There are several approaches to solve this:
Use this table variable for all tests and please state your sample data always copy'n'pasteable. Best was a MCVE (Minimal Complete Verifyable Example) where you set up some code like mine here.
DECLARE @tbl TABLE(ID INT, Code INT,EmployeeName VARCHAR(100),ExamName VARCHAR(100),Board VARCHAR(100),Result VARCHAR(100));
INSERT INTO @tbl VALUES
 (11537,12984,'TheName','SSC','b04','1st')
,(11537,12984,'TheName','HSC','b04','2nd')
,(11537,12984,'TheName','BA(H)','u33','2nd');

This is code to first concatenate your data to one single column. This allows PIVOT:
SELECT p.*
FROM
(
    SELECT tbl.ID
        ,tbl.Code
        ,tbl.EmployeeName
        ,'Exam_' + CAST(ROW_NUMBER() OVER(PARTITION BY tbl.ID ORDER BY tbl.Code) AS VARCHAR(100)) AS ColName
        ,ExamName + ' (' + Board + '): ' + Result AS Concatenated
    FROM @tbl AS tbl
) AS t
PIVOT
(
    MIN(Concatenated) FOR ColName IN(Exam_1,Exam_2,Exam_3 /*add as many as you need*/)
) AS p

The result:
11537   12984   TheName SSC (b04): 1st  HSC (b04): 2nd  BA(H) (u33): 2nd

The next code does quite the same, but creates XML instead of plain text, which allows to separate your data afterwards:
SELECT p.ID
      ,p.Code
      ,p.EmployeeName
      ,E1
      ,E1.value('(/exam/@ExamName)[1]','varchar(100)') AS ExamName1
      ,E1.value('(/exam/@Board)[1]','varchar(100)') AS Board1
      ,E1.value('(/exam/@Result)[1]','varchar(100)') AS Result1
      ,E2
      ,E2.value('(/exam/@ExamName)[1]','varchar(100)') AS ExamName2
      ,E2.value('(/exam/@Board)[1]','varchar(100)') AS Board2
      ,E2.value('(/exam/@Result)[1]','varchar(100)') AS Result2
      ,E3
      ,E3.value('(/exam/@ExamName)[1]','varchar(100)') AS ExamName3
      ,E3.value('(/exam/@Board)[1]','varchar(100)') AS Board3
      ,E3.value('(/exam/@Result)[1]','varchar(100)') AS Result3
FROM
(
    SELECT tbl.ID
        ,tbl.Code
        ,tbl.EmployeeName
        ,'Exam_' + CAST(ROW_NUMBER() OVER(PARTITION BY tbl.ID ORDER BY tbl.Code) AS VARCHAR(100)) AS ColName
        ,(SELECT ExamName AS [@ExamName],Board AS [@Board],Result AS [@Result] FOR XML PATH('exam')) AS AsXML
    FROM @tbl AS tbl
) AS t
PIVOT
(
    MIN(AsXML) FOR ColName IN(Exam_1,Exam_2,Exam_3 /*add as many as you need*/)
) AS p
OUTER APPLY
(
    SELECT CAST(p.Exam_1 AS XML) AS E1
          ,CAST(p.Exam_2 AS XML) AS E2
          ,CAST(p.Exam_3 AS XML) AS E3
) AS CastedToXml

The result:
11537   12984   TheName <exam ExamName="SSC" Board="b04" Result="1st" />    SSC b04 1st <exam ExamName="HSC" Board="b04" Result="2nd" />    HSC b04 2nd <exam ExamName="BA(H)" Board="u33" Result="2nd" />  BA(H)   u33 2nd

This is old-fashioned-pivot which is quite often better then normal pivot:
;WITH Numberd AS
(
    SELECT *
          ,ROW_NUMBER() OVER(PARTITION BY tbl.ID ORDER BY tbl.Code) AS Number
    FROM @tbl AS tbl
)
SELECT ID,Code,EmployeeName
      ,MAX(CASE WHEN Number=1 THEN ExamName END) AS ExamName1
      ,MAX(CASE WHEN Number=1 THEN Board END) AS Board1
      ,MAX(CASE WHEN Number=1 THEN Result END) AS Result1
      ,MAX(CASE WHEN Number=2 THEN ExamName END) AS ExamName2
      ,MAX(CASE WHEN Number=2 THEN Board END) AS Board2
      ,MAX(CASE WHEN Number=2 THEN Result END) AS Result2
      ,MAX(CASE WHEN Number=3 THEN ExamName END) AS ExamName3
      ,MAX(CASE WHEN Number=3 THEN Board END) AS Board3
      ,MAX(CASE WHEN Number=3 THEN Result END) AS Result3
FROM Numberd
GROUP BY ID,Code,EmployeeName

The last option was dynamic SQL...

A: Thnak you all , But My purpose is solved with this
SELECT
      he.Id,he.Code,he.Name EmployeeName,en.Name [ExamName],bu.Name
      [Board],[Result] = CASE WHEN
             ac.GPA IS NULL THEN ac.Result ELSE CAST(ac.GPA AS VARCHAR) END,
      ac.PassingYear
INTO #Temp
FROM H_Employee AS he
INNER JOIN
      H_AcademicQualification AS ac ON ac.H_EmployeeId = he.Id
INNER JOIN
      ExamName AS en ON en.Id = ac.ExamNameId
INNER JOIN
      GroupSubject AS gs ON gs.Id = ac.GroupSubjectId
INNER JOIN
      BoardUniversity AS bu ON bu.Id = ac.BoardUniversityId

Then
SELECT
     a.id, a.Code, a.EmployeeName, a.ExamName, a.Board, a.Result, a.Passingyear,
     b.ExamName, b.Board, b.Result, b.Passingyear,
     c.ExamName, c.Board, c.Result, c.Passingyear,
     d.ExamName, d.Board, d.Result, d.Passingyear
FROM
    (SELECT
          Id, Code, EmployeeName ,ExamName = CASE WHEN
               ExamName LIKE 'S.S.%' THEN 'S.S.C' END,
          Board=Board ,[Result]=CASE WHEN
               Result IS NULL THEN Result ELSE CAST(Result AS VARCHAR) END,
          Passingyear
     FROM #temp
     WHERE ExamName LIKE 'S.S.%') AS a
LEFT JOIN
        (SELECT Id, Code, EmployeeName ,ExamName = CASE WHEN
            ExamName LIKE 'H.S.%' THEN 'H.S.C' END,
         Board=Board,[Result] = CASE WHEN
            Result IS NULL THEN Result ELSE CAST(Result AS VARCHAR) END,
         Passingyear
         FROM #temp
         WHERE ExamName LIKE 'H.S.%') AS b
     ON a.Id=b.Id
LEFT JOIN
        (SELECT Id, Code, EmployeeName ,ExamName = CASE WHEN
             ExamName LIKE 'B.%' THEN 'Graduate' END,
         Board=Board, [Result] = CASE WHEN
             Result IS NULL THEN Result ELSE CAST(Result AS VARCHAR) END,
         Passingyear
         FROM #temp
         WHERE ExamName LIKE 'B.%') AS c
     ON a.Id=c.Id
LEFT JOIN
        (SELECT Id, Code, EmployeeName, ExamName = CASE WHEN
             ExamName LIKE 'M.%' THEN 'Post-Graduate' END,
         Board=Board,[Result] = CASE WHEN
             Result IS NULL THEN Result ELSE CAST(Result AS VARCHAR) END,
         Passingyear
         FROM #temp
         WHERE ExamName LIKE 'M.%') AS d
     ON a.Id=d.Id

Above query serve me purposes but will try @Shnugo Sample , Any way thank you all .


text:
Q: How to write set methods of custom Views I have written a subclass of View and I have included a method to set a field. The value of the field affects the the size of the View and the contents of the View.
What do I have to write in the set method to ensure that the view will be properly updated with immediate effect? I am asking because when I use my own custom views as part of a layout of a ListView item, I find that when I try to recycle my own views by using the convertView argument of an ArrayAdapter's getView method, sometimes the set method doesn't seem to work.
Here is a contrived example of the kind of thing I am trying to do. I have only just started learning how to extend View, so there may be other problems with this code.
public final class SpotsView extends View {

    private final MyActivity activity;
    private int numberOfSpots;

    public SpotsView(MyActivity activity) {
        super(activity);
        this.activity = activity;
    }

    public void setNumberOfSpots(int numberOfSpots) {
        this.numberOfSpots = numberOfSpots;
        // What do I have to write here?? invalidate()? forceLayout()?
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        Resources resources = activity.getResources();
        setMeasuredDimension(
            (int) (numberOfSpots * resources.getDimension(R.dimen.block_width)),
            (int) resources.getDimension(R.dimen.spots_view_height)
        );
    }

    @Override
    protected void onDraw(Canvas canvas) {
        int height = getHeight();
        int width = getWidth();
        float radius = activity.getResources().getDimension(R.dimen.network_outer_radius);
        for (int i = 0; i < numberOfSpots; i++)
            canvas.drawCircle((i + 0.5F) * (width / numberOfSpots), height * 0.5F, radius, activity.spotPaint());
    }
}

A: It seems you have to call
invalidate();
requestLayout();

according to the source code of TextView#setCompoundDrawablePadding(), a method which affects content and size of the view.


text:
Q: Defer the selection of a child validator depending on the property type/value In FluentValidation is there an extension or some other way to defer the selection of a child validator depending on the type/value of the property being validated?
My situation is that I have a Notification class that I want to validate. This class has a Payload property, which can be one of a number of Payload types e.g. SmsPayload, EmailPayload etc. Each of these Payload subclasses has their own associated validator e.g. SmsPayloadValidator and EmailPayloadValidator respectively. In addition to the above, there is no references from the core library(ies) to the individual notification providers. Essentially, this means I can add providers on an as needed basis and wire everything up using IoC.
Consider the following classes:
public class Notification
{
    public Payload Payload { get; set; }
    public IEnumerable<string> Details { get; set; }
}

public abstract class Payload
{
    public string Message { get; set; }
    public abstract string Type { get; }
}

public class SmsPayload : Payload
{
    public List<string> Numbers { get; set; }
    public string Region { get; set; }
    public string Provider { get; set; }
}

There is a Notification validator and SmsPayloadValidator as follows:
public class NotificationValidator : AbstractValidator<Notification>
{
    public NotificationValidator(IValidator<Payload> payloadValidator)
    {
        RuleFor(notification => notification.Payload).NotNull().WithMessage("Payload cannot be null.");
        RuleFor(notification => notification.Payload).SetValidator(payloadValidator);
    }
}

public class SmsPayloadValidator : AbstractValidator<SmsPayload>
{
    public SmsPayloadValidator()
    {
        RuleFor(payload => payload.Provider)
            .Must(s => !string.IsNullOrEmpty(s))
            .WithMessage("Provider is required.");
        RuleFor(payload => payload.Numbers)
            .Must(list => list != null && list.Any())
            .WithMessage("Sms has no phone numbers specified.");
        RuleFor(payload => payload.Region)
            .Must(s => !string.IsNullOrEmpty(s))
            .WithMessage("Region is required.");
    }
}

As I mentioned the assembly where the NotificationValidator is does not reference the assemblies where the individual Payload validator classes live. All the wiring is taken care of by Ioc (Simple-Injector for this project).
Basically I want to do something like the following - first by registering a factory callback in Simple Injector:
container.Register<Func<Payload, IValidator<Payload>>>(() => (payload =>
{
    if (payload.GetType() == typeof(SmsPayload))
    {
        return container.GetInstance<ISmsPayloadValidator>();
    }
    else if (payload.GetType() == typeof(EmailPayload))
    {
        return container.GetInstance<IEmailPayloadValidator>();
    }
    else
    {
        //something else;
    }
}));

Such that I can select the appropriate validator as follows:
public class NotificationValidator : AbstractValidator<Notification>
{
    public NotificationValidator(Func<Payload, IValidator<Payload>> factory)
    {
        RuleFor(notification => notification.Payload).NotNull().WithMessage("Payload cannot be null.");
        RuleFor(notification => notification.Payload).SetValidator(payload => factory.Invoke(payload));
    }
}

Any suggestions? or is there a better way to do what I'm proposing?
If none, I'll fork the FluentValidation repository and submit a PR.

A: You might make your intentions a little more clear by avoiding the factory. While the end result is probably the same with this approach, you can at least end up injecting IValidator<Payload> directly instead of Func<Payload, IValidator<Payload>>.
Create a class called PolymorphicValidator. This will allow you to repeat this pattern in a consistent manner, as well as provide a fallback base validator if you so desire. This is essentially the recommended "composite pattern" described here in the Simple Injector documentation.
public class PolymorphicValidator<T> : AbstractValidator<T> where T : class
{
    private readonly IValidator<T> _baseValidator;
    private readonly Dictionary<Type, IValidator> _validatorMap = new Dictionary<Type,IValidator>();

    public PolymorphicValidator() { }

    public PolymorphicValidator(IValidator<T> baseValidator)
    {
        _baseValidator = baseValidator;
    }

    public PolymorphicValidator<T> RegisterDerived<TDerived>(IValidator<TDerived> validator) where TDerived : T
    {
        _validatorMap.Add(typeof (TDerived), validator);
        return this;
    }

    public override ValidationResult Validate(ValidationContext<T> context)
    {
        var instance = context.InstanceToValidate;
        var actualType = instance == null ? typeof(T) : instance.GetType();
        IValidator validator;
        if (_validatorMap.TryGetValue(actualType, out validator))
            return validator.Validate(context);
        if (_baseValidator != null)
            return _baseValidator.Validate(context);
        throw new NotSupportedException(string.Format("Attempted to validate unsupported type '{0}'. " +
            "Provide a base class validator if you wish to catch additional types implicitly.", actualType));
    }
}

You can then register your validator like this (optionally providing a base class fallback and additional child class validators):
container.RegisterSingle<SmsPayloadValidator>();
//container.RegisterSingle<EmailPayloadValidator>();
container.RegisterSingle<IValidator<Payload>>(() =>
    new PolymorphicValidator<Payload>(/*container.GetInstance<PayloadValidator>()*/)
        .RegisterDerived(container.GetInstance<SmsPayloadValidator>())
      /*.RegisterDerived(container.GetInstance<EmailPayloadValidator>() */);

This will create a singleton PolymorphicValidator which contains singleton child validators (Singletons are recommended by the FluentValidation team). You can now inject IValidator<Payload> as shown in your first NotificationValidator example.
public class NotificationValidator : AbstractValidator<Notification>
{
    public NotificationValidator(IValidator<Payload> payloadValidator)
    {
        RuleFor(notification => notification.Payload)
            .NotNull().WithMessage("Payload cannot be null.")
            .SetValidator(payloadValidator);
    }
}

A: I agree with Taylor's answer about using a Composite (so definitely +1 for that), but his implementation not that practical. I therefore suggest a slightly different implementation, while still using the composite.
If I'm not mistaken, your composite should look as follows:
public class CompositeValidator<T> : AbstractValidator<T> where T : class
{
    private readonly Container container;

    public CompositeValidator(Container container)
    {
        this.container = container;
    }

    public override ValidationResult Validate(T instance)
    {
        var validators = this.container.GetAllInstances(instance.GetType());

        return new ValidationResult(
            from IValidator validator in validators
            from error in validator.Validate(instance).Errors
            select error);
    }
}

The registration should be as follows:
// Simple Injector v3.x
container.RegisterCollection(typeof(IValidator<>),
    AppDomain.CurrentDomain.GetAssemblies());

container.Register(typeof(IValidator<>),
    typeof(CompositeValidator<>),
    Lifestyle.Singleton);

// Simple Injector v2.x
container.RegisterManyForOpenGeneric(
    typeof(IValidator<>),
    container.RegisterAll,
    AppDomain.CurrentDomain.GetAssemblies());

container.RegisterOpenGeneric(
    typeof(IValidator<>),
    typeof(CompositeValidator<>),
    Lifestyle.Singleton);

What happens here is the following:

*

*The RegisterCollection call ensures that all validators are registered as collections. This means that for each T, there can be multiple validators in it. For instance, if your system has a PayloadValidator and a SmsPayloadValidator, resolving GetAllInstances<IValidator<SmsPayload>> will return both validators, because IValidator<in T> contains the in keyword (is contravariant).

*The Register registration will register the CompositeValidator<T> to be returned for each IValidator<T> that is requested. Since Simple Injector differentiates registrations of collections with one-to-one registrations, injecting an IValidator<T> will always result in the composite validator to be injected. Since the composite validator only depends on the container, it can be registered as singleton.

*Consumers get injected with the CompositeValidator<T> (when they depend on IValidator<T>) and the composite validator will ask for a collection of validators based on the exact type. So in case a consumer uses a IValidator<Payload>, the composite validator will determine the real type (SmsPayload for instance) and request all assignable validators for this exact type and will forward the validations to these types.

*If there are no validators for a specific type, the composite validator will automatically return a valid ValidationResult.


text:
Q: Looping over elements of Json Array Hi I am new to Json strings and found a lib Jackson that I use to build and process Json strings. How would I loop elements of a Json array in Java the following example:
String jsonStr = "[{\"foo\": \"bar\"},{\"foo\": \"biz\"}]";

The Jar's that I am using is jackson-mapper-asl-1.9.12.jar and jackson-core-asl-1.9.12.jar.
I did try the following:
JsonFactory f = new JsonFactory();
JsonParser jp = f.createJsonParser(jsonStr);
ObjectMapper mapper = new ObjectMapper();
// advance stream to START_ARRAY first: jp.nextToken();
// and then each time, advance to opening START_OBJECT
while (jp.nextToken() == JsonToken.START_OBJECT)
{

}

The class Foo:
public class Foo
{
    public String foo;
}

Please could any one give me an example how I would loop all the elements. Thank you.

A: You should be able to do:
Foo[] foos = objectMapper.readValue(json, Foo[].class);

Then just loop it as a regular array.


text:
Q: Want to access a class property(field) directly from the object I've written a class that I want to use as a global data interface for interacting with data coming in from a web-based API. As such, the class is able to take in a value of virtually any base-type and work as if it was that base-type.
Under the hood I store the "value" of the object as a string, and, for the most part, the class acts as a clone of the String object, except that it can try to impersonate any other base class in-context.
This is all kind of superfluous though, my problem / question is, how can I make it so that fields of this type are able to interact with it directly instead of through an Accessor?
For Example:
public class PolyVar
{
   protected string _myValue;

   public PolyVar() { this._myValue = ""; }

   public PolyVar(string value) { this._myValue = value; }

   public string Value { get => this._myValue; set => this._myValue = value; }
}

Then, somewhere in the project I want do this:
string temp = "";
PolyVar work = ""; // in lieu of "PolyVar work = new PolyVar();"

temp = "Some string data here. " + work; // using just "work" instead of "work.Value"

So can you construct the class in such a way that accessing/modifying
one of its properties (in this case, "_myValue") directly through the class itself is possible in lieu of necessitating the use of an accessor? (as the base classes already all support?)

A: You have to 1) create an implicit conversion from string to PolyVar, and 2) override ToString() so it is converted properly to a simple string when needed.
public class PolyVar {
   protected string _myValue;

   public PolyVar() { this._myValue = ""; }

   public PolyVar(string value) { this._myValue = value; }

   public string Value { get { return this._myValue; } set { this._myValue = value; } }

   // Override ToString() so "" + polyVar1 is correctly converted.
   public override string ToString()
   {
    return this.Value;
   }

   // Create an implicit cast operator from string to PolyVar
   public static implicit operator PolyVar(string x)
   {
    return new PolyVar( x );
   }
}

class Ppal {
    static void Main()
    {
        PolyVar work = "data"; // in lieu of "PolyVar work = new PolyVar();"
        string temp = "Some string data here: " + work;

        System.Console.WriteLine( temp );
    }
}

Hope this helps.

A: Modify your PolyVar class so that it overrides the ToString() method:
public class PolyVar
{
    protected string _myValue;

    public PolyVar() { this._myValue = ""; }

    public PolyVar(string value) { this._myValue = value; }

    public string Value { get => this._myValue; set => this._myValue = value; }

    public override string ToString()
    {
        return this.Value.ToString();
    }
}

That allows you to do the following ...
PolyVar work = new PolyVar();
string temp = "Some string data here. " + work.ToString();

... or as Corak mentioned below, just leave out .ToString() as it gets called automatically ...
string temp = "Some string data here. " + work;

As your explanation states that you are using multiple objects of PolyVar I don't really see a way which allows you to skip using the constructor.

A: You don't need to use string here, you can go with generics:
public class PolyVar<T>
{
    public PolyVar()
    {
    }

    public PolyVar(T value)
    {
        Value = value;
    }

    // note: no reason to explicitly declare the backing field
    public T Value { get; set; }

    // return the string representation of the current value
    public override string ToString() => Value.ToString();

    // allow any type to be implicitly a PolyVar
    public static implicit operator PolyVar<T>(T value) => new PolyVar<T>(value);
}

You would then use this as:
PolyVar<string> work = "";
string data = "Some data: " + work;

This would allow you to use any type without having to parse from and convert back to string.
As mentioned by @Corak, if you don't know T before-hand, you can use a Factory approach for creating PolyVar<T>s :
public static class PolyVarFactory
{
    public static PolyVar<T> FromValue<T>(T value) => value;
}

Notice that this has to be in a non-generic class for you to be able to call the method without explicitly passing-in a type.

A: Okay, so, in the event that anyone else wanted to do something like this, here's what I ultimately ended up with:
It basically acts like a string, but it also facilitates direct addition, multiplication, subtraction and division with all base numeric types, numeric quantity evaluation (>, <, ==, <= and >=) and the ability to seemlessly act as one of the supported subtypes through appropriately named accessors (i.e. ".AsInt", "AsFloat", "AsDecimal", "AsULong" etc.). It also incorporates the most common String functions (Substring, PadLeft, PadRight) as well as some extensions I use frequently (".UCWords" and ".Filter"). Adding more string functions is obviously pretty easy. It supports char-based ForEach enumeration, as well as index-based character access / assignment. Substring has also been extended to support negative "start position" values (indicating "start x places back from the end"). I'm posting it in case such a class is ever useful for anyone else, either for what it is/does, or how I addressed the problem posed with the bits of help supplied here. Oh, and although I went back and forth on it, I also implemented local error capture whenever a conversion is attempted. So a value is always returned by calls to alternate types. You can check the ".HasError" (and ".Error") accessors afterwards to see if there were problems. Obviously this may not be the preferred method for dealing with conversion errors in all (or even most) circumstances, but it's how I went with it for mine. Suggestions, and comments welcomed.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Xml;

namespace PolyVar
{
    class PolyVar : IEnumerator<char>
    {
        protected string _value = "";
        protected string _error = "";
        protected int _position = 0;

        #region Constructors
        public PolyVar() { }

        public PolyVar(string value) => this._value = value;

        public PolyVar(XmlDocument data) => this._value = data.OuterXml;

        public PolyVar(XmlElement data) => this._value = data.OuterXml;

        public PolyVar(bool value) => this.AsBool = value;

        public PolyVar(PolyVar data) => this._value = data._value;

        public PolyVar(object data) => this._value = data.ToString();
        #endregion

        #region Operators
        public static PolyVar operator +(PolyVar left, string right) => new PolyVar(left._value + right);
        public static PolyVar operator +(string left, PolyVar right) => new PolyVar(left + right._value);

        public static PolyVar operator +(PolyVar left, PolyVar right) => new PolyVar(left._value + right._value);

        public static bool operator ==(string left, PolyVar right) => (right == left);
        public static bool operator ==(PolyVar left, string right)
        {
            if (left is null) return (right is null) || (right.Length == 0);
            if (right is null) return false;
            return right.Equals(left._value, StringComparison.InvariantCultureIgnoreCase);
        }

        public static bool operator !=(PolyVar left, string right) => !(left == right);
        public static bool operator !=(string left, PolyVar right) => !(right == left);

        public static bool operator ==(PolyVar left, PolyVar right)
        {
            if (left is null) return (right is null) || (right._value.Length == 0);
            if (right is null) return false;
            return left == right._value;
        }

        public static bool operator !=(PolyVar left, PolyVar right) => !(left == right);

        public static bool operator ==(bool left, PolyVar right) => right == left;
        public static bool operator ==(PolyVar left, bool right)
        {
            if (left is null) return false;
            return left.AsBool == right;
        }

        public static bool operator !=(PolyVar left, bool right) => !(left == right);
        public static bool operator !=(bool left, PolyVar right) => !(right == left);

        public static bool operator ==(XmlDocument left, PolyVar right) => (right == left);
        public static bool operator ==(PolyVar left, XmlDocument right)
        {
            if (left is null) return (right is null);
            if (right is null) return false;
            return String.Equals(left._value, right.OuterXml, StringComparison.InvariantCultureIgnoreCase);
        }

        public static bool operator !=(PolyVar left, XmlDocument right) => !(left == right);
        public static bool operator !=(XmlDocument left, PolyVar right) => !(right == left);

        public static bool operator ==(XmlElement left, PolyVar right) => (right == left);
        public static bool operator ==(PolyVar left, XmlElement right)
        {
            if (left is null) return (right is null);
            if (right is null) return false;
            return String.Equals(left._value, right.OuterXml, StringComparison.InvariantCultureIgnoreCase);
        }

        public static bool operator !=(PolyVar left, XmlElement right) => !(left == right);
        public static bool operator !=(XmlElement left, PolyVar right) => !(right == left);
        #endregion

        #region Accessors
        public string Value { get => this._value; set => this._value = value; }

        public int Length
        {
            get => _value.Length;
            set { if (value < _value.Length) this._value = this._value.Substring(0, value); }
        }

        public string[] Words => ((this._value.Trim().IndexOf(' ') > 0) ? this._value.Trim().Split(new string[] { " ", "\r", "\n", "\t" }, StringSplitOptions.RemoveEmptyEntries) : new string[] { this._value.Trim() });

        protected string FirstWord => this.Words[0];

        public char this[int index]
        {
            get
            {
                if ((index < 0) || (index >= _value.Length))
                    throw new ArgumentOutOfRangeException();

                return this._value[index];
            }
            set
            {
                if ((index < 0) || (index >= _value.Length))
                    throw new ArgumentOutOfRangeException();

                string work = this._value.Substring(0, index) + value;
                if (index < _value.Length - 1)
                    work += this._value.Substring(index + 1);

                this._value = work;
            }
        }

        public bool HasError => (this._error.Length > 0);
        public string Error { get { string e = this._error; this._error = ""; return e; } }

        protected bool AsBool
        {
            get
            {
                if ((this._value.Length == 0) || (this._value == string.Empty) || (this._value == null)) return false;
                return (this._value.ToLowerInvariant()[0] == 'y') ||
                       (this._value.ToLowerInvariant()[0] == 't') ||
                       ((int)this != 0);
            }

            set => this._value = (value ? "true" : "false");
        }

        public XmlDocument AsXmlDocument
        {
            set => this._value = value.OuterXml;
            get
            {
                XmlDocument doc = new XmlDocument();
                this._error = "";
                try { doc.LoadXml(this._value); }
                catch (Exception e) { this._error = e.Message; }
                return doc;
            }
        }

        public XmlElement AsXmlElement
        {
            set => this._value = value.OuterXml;
            get
            {
                XmlDocument doc = new XmlDocument();
                this._error = "";
                XmlElement result = null;
                try
                {
                    doc.LoadXml(AsXmlDocument.CreateXmlDeclaration("1.1", "UTF-8", "yes").ToString() + this._value);
                    result = (XmlElement)doc.FirstChild;
                }
                catch (Exception e)
                {
                    this._error = e.Message;
                    result = doc.CreateElement("error");
                    result.InnerText = e.Message;
                }
                return result;
            }
        }

        protected object Set { set => this._value = value.ToString(); }

        char IEnumerator<char>.Current => this._value[this._position];

        object IEnumerator.Current => this._value[this._position];
        #endregion

        #region Methods
        // Generic number conversion function: Attempts to convert the internal _myValue
        // string into the numeric type specified by the "T" designator:
        protected T ConvertToNbr<T>()
        {
            try { return (T)Convert.ChangeType(this._value, typeof(T)); }
            catch (Exception e)
            {
                this._error = e.Message;
                return default(T);
            }
        }

        public string Substring(int start, int length) =>
            (start >= 0) ? this._value.Substring(start, length) : this._value.Substring(_value.Length + start, length);

        public string Substring(int start) =>
            (start >= 0) ? this._value.Substring(start) : this._value.Substring(_value.Length + start);

        public string PadLeft(int toWidth, char with) => this._value.PadLeft(toWidth, with);

        public string PadLeft(int toWidth) => this._value.PadLeft(toWidth);

        public string PadRight(int toWidth, char with) => this._value.PadRight(toWidth, with);

        public string PadRight(int toWidth) => this._value.PadRight(toWidth);

        public char[] ToCharArray() => this._value.ToCharArray();

        public char[] ToCharArray(int startIndex, int Length) => this._value.ToCharArray(startIndex, Length);

        /// Removes all instances of a specified character from the string.
        /// <param name="value">A Char value to remove all instances of from this string.</param>
        /// <returns>The current string with all of the specified characters removed.</returns>
        public string Remove(char value) => this._value.Replace(value.ToString(), "");

        /// Removes all instances of a specified string from the string.
        /// <param name="value">A string value to remove all instances of from this string.</param>
        /// <returns>The current string with all of the specified string removed.</returns>
        public string Remove(string value) => this._value.Replace(value, "");

        /// Removes all instances of each element in a specified character array from the string.
        /// <param name="value">An array of Char value to remove all instances of from this string.</param>
        /// <returns>The current string with all of the specified characters removed.</returns>
        public string Remove(char[] values)
        {
            string result = this._value;
            foreach (char c in values) result = result.Remove(c);
            return result;
        }

        /// Extends the string class to add a UCWords function.
        /// <returns>A string with the initial letter of all words in it capitalised with any existing capitalized letters left as found.</returns>
        public string UCWords()
        {
            System.Globalization.TextInfo ti = System.Globalization.CultureInfo.InvariantCulture.TextInfo;
            return ti.ToTitleCase(this._value.ToLowerInvariant());
        }

        /// Extends the string class to add a UCWords function.
        /// <param name="strict">If set to true, all letters in the string are converted to lowercase, then the words are capitalised.</param>
        /// <returns>A string with all individual words in it capitalised.</returns>
        public string UCWords(bool strict)
        {
            if (strict) return this._value.UCWords();

            PolyVar result = new PolyVar(this._value);
            if (!(result is null) && (result.Length > 0))
                for (int i = 0; i < result.Length; i++)
                    if (((i == 0) || ("> .\t\r\n".IndexOf(result[i - 1]) > 0)) && (">abcdefghijklmnopqrstuvwxyz".IndexOf(result[i]) > 0))
                        result[i] = char.ToUpperInvariant(result[i]);

            return result;
        }

        /// Given a string of valid characters, filters all non-matching characters out of a string.
        /// <param name="validChars">A string of valid (permitted) characters to retain.</param>
        /// <param name="ignoreCase">Specifies whether case should be ignored.</param>
        /// <returns>A string containing only the permitted characters.</returns>
        public string Filter(string validChars, bool ignoreCase)
        {
            string result = this._value;
            if ((result.Length == 0) || (validChars.Length == 0)) return "";
            if (ignoreCase)
            {
                validChars = validChars.ToLowerInvariant();
                foreach (char c in validChars)
                    if (" abcdefghijklmnopqrstuvwxyz".IndexOf(c) > 0) validChars += (char)(c & 223);
            }

            int i = 0;
            while (i < result.Length)
                if (validChars.IndexOf(result.Substring(i, 1)) < 0)
                    result = result.Remove(result.Substring(i, 1));
                else i++;

            return result;
        }

        /// Given a string of valid characters, filters all non-matching (case-insensitive) characters out of a string.
        /// <param name="validChars">A string of valid (permitted) characters to retain.</param>
        /// <returns>A string containing only the permitted characters.</returns>
        public string Filter(string validChars) => this.Filter(validChars, true);

        /// Given an array valid characters, filters all non-matching (case-insensitive) characters out of a string.
        /// <param name="validChars">An array of valid (permitted) characters to retain.</param>
        /// <returns>A string containing only the permitted characters.</returns>
        public string Filter(char[] validChars) => this.Filter(new string(validChars), true);

        /// Given an array valid characters, filters all non-matching characters out of a string.
        /// <param name="validChars">An array of valid (permitted) characters to retain.</param>
        /// <param name="ignoreCase">Specifies whether case should be ignored.</param>
        /// <returns>A string containing only the permitted characters.</returns>
        public string Filter(char[] validChars, bool ignoreCase) => this.Filter(new string(validChars), ignoreCase);

        public static implicit operator string(PolyVar data) => data.Value;
        public static implicit operator PolyVar(string data) => new PolyVar(data);

        public static implicit operator int(PolyVar data) => data.ConvertToNbr<int>();
        public static implicit operator PolVar(int data) => new PolyVar(data);

        public static implicit operator sbyte(PolyVar data) => data.ConvertToNbr<sbyte>();
        public static implicit operator PolyVar(sbyte data) => new PolyVar(data);

        public static implicit operator short(PolyVar data) => data.ConvertToNbr<short>();
        public static implicit operator PolyVar(short data) => new PolyVar(data);

        public static implicit operator long(PolyVar data) => data.ConvertToNbr<long>();
        public static implicit operator PolyVar(long data) => new PolyVar(data);

        public static implicit operator decimal(PolyVar data) => data.ConvertToNbr<decimal>();
        public static implicit operator PolyVar(decimal data) => new PolyVar(data);

        public static implicit operator float(PolyVar data) => data.ConvertToNbr<float>();
        public static implicit operator PolyVar(float data) => new PolyVar(data);

        public static implicit operator double(PolyVar data) => data.ConvertToNbr<double>();
        public static implicit operator PolyVar(double data) => new PolyVar(data);

        public static implicit operator uint(PolyVar data) => data.ConvertToNbr<uint>();
        public static implicit operator PolyVar(uint data) => new PolyVar(data);

        public static implicit operator byte(PolyVar data) => data.ConvertToNbr<byte>();
        public static implicit operator PolyVar(byte data) => new PolyVar(data);

        public static implicit operator ulong(PolyVar data) => data.ConvertToNbr<ulong>();
        public static implicit operator PolyVar(ulong data) => new PolyVar(data);

        public static implicit operator ushort(PolyVar data) => data.ConvertToNbr<ushort>();
        public static implicit operator PolyVar(ushort data) => new PolyVar(data);

        public static implicit operator bool(PolyVar data) => data.AsBool;
        public static implicit operator PolyVar(bool data) => new PolyVar(data);

        public static implicit operator XmlDocument(PolyVar data) => data.AsXmlDocument;
        public static implicit operator PolyVar(XmlDocument data) => new PolyVar(data);

        public static implicit operator XmlElement(PolyVar data) => data.AsXmlElement;
        public static implicit operator PolyVar(XmlElement data) => new PolyVar(data);

        public override string ToString() => this._value;

        public override bool Equals(object obj) => this._value.Equals(obj);

        public override int GetHashCode() => this._value.GetHashCode();

        public IEnumerator<char> GetEnumerator() => this._value.GetEnumerator();

        bool IEnumerator.MoveNext() => (++this._position) < this._value.Length;

        void IEnumerator.Reset() => this._position = 0;

        #region IDisposable Support
        private bool disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    // TODO: dispose managed state (managed objects).
                }

                // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
                // TODO: set large fields to null.

                disposedValue = true;
            }
        }

        // TODO: override a finalizer only if Dispose(bool disposing) above has code to free unmanaged resources.
        // ~AppletParameters() {
        //   // Do not change this code. Put cleanup code in Dispose(bool disposing) above.
        //   Dispose(false);
        // }

        // This code added to correctly implement the disposable pattern.
        void IDisposable.Dispose()
        {
            // Do not change this code. Put cleanup code in Dispose(bool disposing) above.
            Dispose(true);
            // TODO: uncomment the following line if the finalizer is overridden above.
            // GC.SuppressFinalize(this);
        }
        #endregion
        #endregion
    }
}


text:
Q: Map markers not clustering I have a map which has multiple markers within close proximity of each other. Trying to integrate the marker clustering through google dev kit.
However the clustering is not occuring, and am also not getting an error in console - which makes it somewhat tricky.
Map data being used:
  var places = [{
        "id": 1,
        "name": "Test",
        "coordinate": {
            "latitude": -37.8136,
            "longitude": 144.9630
        },
        "description": "This is a test",
        "is_active": true
    },
    {
        "id": 2,
        "name": "Test2",
        "coordinate": {
            "latitude": -37.8136,
            "longitude": 144.9430
        },
        "description": "This is a test",
        "is_active": true
    },
    {
        "id": 3,
        "name": "Test3",
        "coordinate": {
            "latitude": -37.8136,
            "longitude": 144.9530
        },
        "description": "This is a test",
        "is_active": true
    },
    {
        "id": 4,
        "name": "Test4",
        "coordinate": {
            "latitude": -37.8136,
            "longitude": 144.9670
        },
        "description": "This is a test",
        "is_active": true
    }]

Javascript:
var GoogleMap = {
    map: null,
    markers: {},
    init: function(lat, lng, places) {
        var self = this;
        var mapOptions = {
            zoom: 8,
            center: new google.maps.LatLng(lat, lng)
        };
        this.map = new google.maps.Map(document.getElementById('map'), mapOptions);
        this.infowindow = new google.maps.InfoWindow({
            size: new google.maps.Size(50, 50)
        });
        var searchBox = new google.maps.places.SearchBox(document.getElementById('pac-input'));
        google.maps.event.addListener(searchBox, 'places_changed', function() {
            searchBox.set('map', null);
            var places = searchBox.getPlaces();
            var bounds = new google.maps.LatLngBounds();
            var i, place;
            for (i = 0; place = places[i]; i++) {
                (function(place) {
                    var marker = new google.maps.Marker({
                        position: place.geometry.location
                    });
                    marker.bindTo('map', searchBox, 'map');
                    google.maps.event.addListener(marker, 'map_changed', function() {
                        if (!this.getMap()) {
                            this.unbindAll();
                        }
                    });
                    bounds.extend(place.geometry.location);
                }(place));
            }
            this.map.fitBounds(bounds);
            searchBox.set('map', map);
            map.setZoom(Math.min(map.getZoom(), 12));
        });

        $.each(places, function() {
            self.addMarker(this);
        });
        this.setCenterPoint();
    },
    // Create map markers
    addMarker: function(place) {
        var self = this;
        var marker = new google.maps.Marker({
            position: new google.maps.LatLng(place.coordinate.latitude, place.coordinate.longitude),
            map: self.map,
            title: place.name,
            icon: place.image
        });

        console.log(place);
        // Create information event for each marker
        marker.info_window_content = 'TEST'
        self.markers[place.id] = marker
        google.maps.event.addListener(marker, 'click', function() {
            self.infowindow.setContent(marker.info_window_content)
            self.infowindow.open(self.map, marker);
        });
        // cluster the markers using google marker clusterer
       var markerClusterer = new MarkerClusterer(this.map, self.marker, {
      imagePath:
        "https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m",
    });

    },
    // Update map markers
    updateMarkers: function(records) {
        var self = this;
        $.each(self.markers, function() {
            this.setMap(null);
        })
        $.each(records, function() {
            self.markers[this.id].setMap(self.map);
        });
        //Set map center
        if (records.length) self.setCenterPoint();
    },
    // Set centre point for map
    setCenterPoint: function() {
        var lat = 0,
            lng = 0;
        count = 0;
        //Calculate approximate center point based on number of JSON entries
        for (id in this.markers) {
            var m = this.markers[id];
            if (m.map) {
                lat += m.getPosition().lat();
                lng += m.getPosition().lng();
                count++;
            }
        }
        if (count > 0) {
            this.map.setCenter(new google.maps.LatLng(lat / count, lng / count));
        }
    }
};
// CHANGE MAP FOCUS:
function showCompany(lat, lng) {
    var position = new google.maps.LatLng(lat, lng);
    map.setCenter(position);
    alert(lat, lng);
}

Which is displaying the map in html via the div ID 'map'.
I have created a JSFiddle to see the map markers being loaded in #map, but as you can see. The markers are loading, but not clustering.
In a desperate attempt to resolve, have also tried changing the default zoom level, as I thought this might be creating the issue.
Link: https://jsfiddle.net/pixelmedia/z1ke9bwq/37/

A: Strange that no body reply you with the bounty.
Here is the clustered markers version based on yours:
https://jsfiddle.net/qakbnx6h/1/
The problem is in the addMarker(), for each place, you created a new MarkerClusterer so the clustering is not working.
To solve it:

*

*Remove new MarkerClusterer on addMark()

*return the marker from addMaker()
addMarker: function(place) {
    var self = this;
    var marker = new google.maps.Marker({
        position: new google.maps.LatLng(place.coordinate.latitude, place.coordinate.longitude),
        map: self.map,
        title: place.name,
        icon: place.image
    });

    console.log(place);
    // Create information event for each marker
    marker.info_window_content = 'TEST'
    self.markers[place.id] = marker
    google.maps.event.addListener(marker, 'click', function() {
            self.infowindow.setContent(marker.info_window_content)
            self.infowindow.open(self.map, marker);
            });

    // return marker;
    return marker;
},

*Push the new marker into a array

*Add the new MarkerClusterer below $.each of places and use the array marker created on step 3

// markers array to store place marker
const markers = []
$.each(places, function() {
    // push new marker to array
    markers.push( self.addMarker(this));
});

// use the markers in MarkerClusterer
const markerClusterer = new MarkerClusterer(this.map, markers, {
  imagePath:  "https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m",
});


text:
Q: Changing Template Header for Appendices I am using a modified BYU Thesis Template for my thesis.
I want to be able to change the page header for the the appendices to read "Appendix A Data & Display" instead of "Chapter A Data & Display" where "Data & Display" is the name of one of my appendices.
Here is the relevant code from the class file:
% The fancyhdr package allows you to easily customize the page header.
% The settings below produce a nice, well separated header.
\usepackage{fancyhdr}
  \fancyhead{}
  \fancyhead[LO]{\slshape \rightmark}
  \fancyhead[RO,LE]{\textbf{\thepage}}
  \fancyhead[RE]{\slshape \leftmark}
  \fancyfoot{}
  \pagestyle{fancy}
  \renewcommand{\chaptermark}[1]{\markboth{\chaptername \ \thechapter \ \ #1}{}}
  \renewcommand{\sectionmark}[1]{\markright{\thesection \ \ #1}}

I suppose I should be using an if statement, but my appendices (in their individual tex files) start with \chapter{Data \& Display}

A: The line
\renewcommand{\chaptermark}[1]{\markboth{\chaptername \ \thechapter \ \ #1}{}}

should be
\renewcommand{\chaptermark}[1]{\markboth{\@chapapp \ \thechapter \ \ #1}{}}

to deal with the automatic change of name from "Cahpter" to "Appendix". Modify the page style in the preamble of your document:
\documentclass{BYUPhys}
\usepackage{lipsum}% just to generate text for the example

\makeatletter
\usepackage{fancyhdr}
  \fancyhead{}
  \fancyhead[LO]{\slshape \rightmark}
  \fancyhead[RO,LE]{\textbf{\thepage}}
  \fancyhead[RE]{\slshape \leftmark}
  \fancyfoot{}
  \pagestyle{fancy}
  \renewcommand{\chaptermark}[1]{\markboth{\@chapapp \ \thechapter \ \ #1}{}}
  \renewcommand{\sectionmark}[1]{\markright{\thesection \ \ #1}}
\makeatother

\begin{document}

\chapter{Regular Chapter}
\lipsum[1-40]
\appendix
\chapter{Appendix One}
\lipsum[1-40]

\end{document}


text:
Q: Why is this an invalid operand? I have the following ASM file generated by a compiler I'm writing:
; This code has been generated by the 7Basic
; compiler <http://launchpad.net/7basic>

; Uninitialized data

      SECTION .bss
v_0 resb 4
v_4 resb 4
v_8 resb 4

; Code

      SECTION .text
push 1
pop eax
mov v_0, eax
push 2
pop eax
mov v_4, eax
mov eax, v_0
push eax
mov eax, v_4
push eax
pop ebx
pop eax
imul eax,ebx
push eax
pop eax
mov v_8, eax

When I try to compile it, I get the following errors:

test.asm:16: error: invalid combination of opcode and operands
  test.asm:19: error: invalid combination of opcode and operands
  test.asm:29: error: invalid combination of opcode and operands

This really doesn't make sense because according to the NASM docs, I'm allowed to:

MOV    mem_offs, reg_eax    386

Why can't I perform this operation?

A: You need square brackets to dereference the pointers:
mov  [v_0], eax


text:
Q: Sum of column in sqlDataframe without using groupBy or agg functions in scala/spark For a dataframe given below, i want a new column in dataframe which should have constant value of sum of freq column.
+------+----+
|number|freq|
+------+----+
|     8|   1|
|     6|   2|
|     2|   4|
+------+----+

The result should look like
+------+----+-------+
|number|freq|new_col|
+------+----+-------+
|     8|   1|      7|
|     6|   2|      7|
|     2|   4|      7|
+------+----+-------+

and i want this without groupBy or agg.
I tried :
var x = sum(df("freq"))
df.withColumn("new_col",lit(x))

or
df.withColumn("new_col",x)

or
df.withColumn("new_col",sum($"freq"))

But none worked.

A: You can try this but be careful, it uses a single partition :
import spark.implicits._
import org.apache.spark.sql.functions._

val df = Seq(
  (8,1),
  (6,2),
  (2,4)
).toDF("number","freq")

df.withColumn("new_col", sum($"freq").over())
  .show(false)

+------+----+-------+
|number|freq|new_col|
+------+----+-------+
|8     |1   |7      |
|6     |2   |7      |
|2     |4   |7      |
+------+----+-------+

A: You could use a window over the entire dataframe to do that but I highly recommend not to do it for all the data would need to go to only one partition which would be terrible in terms of performance.
A simple way to do it, very similar to your 1st approach, is:
import org.apache.spark.sql.Row
val Row(x) = df.select(sum('freq)).head
val new_df = df.withColumn("new_col", lit(x))


text:
Q: 0177 versus 177 and their complements In c, why is that ~177 yields -178, while ~0177 yields -128?
I tried printing out the values before and after, but couldn't discern anything. I also couldn't anything explaining this topic. I am reading "The C Programming Language".

A: The leading zero indicates that 0177 is an octal number (127).

A: The constants 177 and 0177 are not the same value.  The former is decimal which the latter is octal.
From section 6.4.4.1 of the C standard:

3 A decimal constant begins with a nonzero digit and consists of a sequence of decimal digits. An octal constant consists of the prefix 0
  optionally followed by a sequence of the digits 0 through 7 only. A
  hexadecimal constant consists of the prefix 0x or 0X followed by a
  sequence of the decimal digits and the letters a (or A) through f (or
  F) with values 10 through 15 respectively.
4 The value of a decimal constant is computed base 10; that of an octal constant, base 8; that of a hexadecimal constant, base 16. The
  lexically first digit is the most significant.

The octal constant 0177 is equal to 127 in decimal.  As a 32-bit hex value, it is represented as 0x0000007f.  Using the ~ operator on this value gives you 0xffffff80.  Assuming 2's complement representation for negative numbers, this is -128 in decimal.


text:
Q: Adding foreign key constraint to associative entity I have 3 tables:
1) SERVICE_REQUESTS (Parent)
CREATE TABLE SERVICE_REQUESTS(
service_id           NUMBER (7)    NOT NULL,
serial_number        NUMBER (10)   NOT NULL,
service_date         DATE          NOT NULL,
service_description  VARCHAR(50)   NOT NULL,
hourly_rate          NUMBER(5,2)   NOT NULL,
customer_id          NUMBER  (5)   NOT NULL,
employee_id          NUMBER  (3)   NOT NULL,

CONSTRAINT service_request_pk PRIMARY KEY(service_id, serial_number));

2) SERVICE_PARTS (Associative Entity to solve M:M relationship)
CREATE TABLE SERVICE_PARTS(
service_id           NUMBER  (7)   NOT NULL,
part_id              NUMBER (10)   NOT NULL,
quantity             NUMBER  (4)   NOT NULL,
unit_cost            NUMBER(7,2)   NOT NULL,

CONSTRAINT service_part_pk PRIMARY KEY(service_id, part_id));

3) PARTS (Parent)
CREATE TABLE PARTS(
part_id              NUMBER (10)   NOT NULL,
part_description     VARCHAR(50)   NOT NULL,
cost                  NUMBER(7,2)   NOT NULL,
quantity_on_hand     NUMBER  (5)   NOT NULL,

CONSTRAINT part_pk PRIMARY KEY(part_id));

I've created a foreign key constraint from SERVICE_PARTS to PARTS with the following statement:
ALTER TABLE service_parts
  ADD CONSTRAINT service_parts_part_id_fk
    FOREIGN KEY (part_id)
      REFERENCES parts(part_id);

Now I'm trying to create a foreign key constraint from SERVICE_PARTS to SERVICE_REQUESTS using the follow statement:
ALTER TABLE service_parts
  ADD CONSTRAINT service_parts_service_id_fk
    FOREIGN KEY (service_id)
      REFERENCES service_requests(service_id);

But I get the following error: ORA-02270: no matching unique or primary key for this column-list. Why does it allow a constraint to be added for the part_id but not the service_id?
I've attached my ER Diagram for visual clarification:

A: If the primary key of the service_requests table is service_id, serial_number, your M:M mapping table would need to include both elements of the primary key.  The definition of the primary key implies that you can have many rows with the same service_id but different serial_number values.  If your mapping table doesn't contain both elements of the key, you wouldn't be able to figure out which particular row in service_requests was mapped to any particular row in service_parts.
Your mapping table definition would need to be
CREATE TABLE SERVICE_PARTS(
service_id           NUMBER  (7)   NOT NULL,
serial_number        NUMBER (10)   NOT NULL,
part_id              NUMBER (10)   NOT NULL,
quantity             NUMBER  (4)   NOT NULL,
unit_cost            NUMBER(7,2)   NOT NULL,

CONSTRAINT service_part_pk PRIMARY KEY(service_id, serial_number, part_id));

and then your foreign key
ALTER TABLE service_parts
  ADD CONSTRAINT service_parts_service_id_fk
    FOREIGN KEY (service_id, serial_number)
      REFERENCES service_requests(service_id, serial_number);

Alternately, if we believe that your mapping table is correct, which would imply that service_id was the key for service_requests, then the definition of service_requests would be
CREATE TABLE SERVICE_REQUESTS(
service_id           NUMBER (7)    NOT NULL,
serial_number        NUMBER (10)   NOT NULL,
service_date         DATE          NOT NULL,
service_description  VARCHAR(50)   NOT NULL,
hourly_rate          NUMBER(5,2)   NOT NULL,
customer_id          NUMBER  (5)   NOT NULL,
employee_id          NUMBER  (3)   NOT NULL,

CONSTRAINT service_request_pk PRIMARY KEY(service_id));

Then your mapping table and your foreign key definition would be correct as is.

A: Your primary key in table SERVICE_REQUESTS:
CONSTRAINT service_request_pk PRIMARY KEY(service_id, serial_number)

Such primary key can't guarantee, that your service_id value will be unique. Hence, you can't make reference only to this field from another table, because there is no way to determine, to which record you will refer. Your primary key in one table and foreign key in another have to be exactly the same.


text:
Q: 'On the roundabout' or 'in the roundabout'? I got a TomTom navigator as a present and set it to narrate in English (Irish voice). Every time I'm about to go left or right in a roundabout it says: "Go right on the roundabout, first exit"
The choice of preposition (on) strikes me as odd. I would've expected an in but perhaps that's just because how we say in my country (Sweden; where on would be plain wrong).
After some searching on the internet I realize that both in the roundabout and on the roundabout are commonly used. However, I can't really tell if they're completely interchangeable or if one of them should be picked in favour of the other depending on the context.

A: When you are driving, you are driving on the road, not "in" the road. However you could be playing in the road, meaning between the curbs is a close vicinity.

Go right on the roundabout, and take the first exit.

A possible usage for in though it may be a stretch:

Go 3 miles until you see the "For Sale" sign in the roundabout, then...

meaning the sign is on land inside the roundabout.


text:
Q: Downgrade Angular 6 directive to Angular 1.7 I would like to downgrade an angular 6 directive defined something like this
@Directive({
  selector: '[ad-host]',
})
export class AdDirective {
  constructor(public viewContainerRef: ViewContainerRef) { }
}

to angular 1.7 but angular https://angular.io/api/upgrade/static module contains downgradeComponent only.
any suggestion how to do so.
the main problem that I am trying to solve is to achieve parent-child communication for children rendered using  by the parent and as per https://blog.angular-university.io/angular-ng-content/ blog I can achieve by having inputRef directive.


text:
Q: Tick boxes for a qgis plugin written in python in a python plugin for qgis I want the user to be able to select one or more of several options via tick boxes.
I imagine it to look like e.g. Qgis 2.2 tool "Vector" -> "Data Management Tools" -> "Join attributes by location". In the "Attribute Summary" section of this tool the user is able to tick several functions on and off:

At the moment I use a string input (##options=string "option1,option2,option3"). The user has to enter all options separated by a comma. This works but it does not look very pretty.
Is this possible with Pyhton? Any suggestions? Thanks in advance.

A: Yes this is possible. I think you are looking for a checkbox.
self.yourCheckbox = QtGui.QCheckBox(self.layoutWidget)
self.yourCheckbox.setObjectName(_fromUtf8("Checkboxname"))

Then to see if its checked:
isitchecked = self.dlg.ui.yourCheckbox.isChecked() # returns True if checked


text:
Q: How to only return primary contacts like in the Android People app I'm trying to pull a list of contacts and attaching all of the contacts associated with a given person.  The problem I am having is that my query is returning back all contacts that have ever been emailed.  I don't want to include every contact I've emailed however, I just want the main contacts (like what is displayed in the built-in People app).
In the code below I was trying to limit the emails by using a ContactsContract.Contacts.CONTENT_URI query to limit the returned emails, but that doesn't seem to work.
Any help would be greatly appreciated.
private ArrayList<ContactFriend> allContacts;
private Cursor contactsCursor;
private Cursor emailCursor;

void load() {
    getLoaderManager().initLoader(CONTACTS_LOADER_ID, null, this);
    getLoaderManager().initLoader(EMAILS_LOADER_ID, null, this);
}

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    if (id == CONTACTS_LOADER_ID) {
        String[] projection = {
                ContactsContract.Contacts._ID,
                ContactsContract.Contacts.DISPLAY_NAME_PRIMARY,
                ContactsContract.Contacts.PHOTO_THUMBNAIL_URI,
        };
        String sortOrder = ContactsContract.Contacts.DISPLAY_NAME_PRIMARY + " ASC";
        return new CursorLoader(getActivity(),
                ContactsContract.Contacts.CONTENT_URI,
                projection,
                null,
                null,
                    sortOrder);
    } else if (id == EMAILS_LOADER_ID) {
        String[] projection = {
                ContactsContract.CommonDataKinds.Email.DATA,
                ContactsContract.CommonDataKinds.Email.CONTACT_ID
        };
        String sortOrder =
                ContactsContract.CommonDataKinds.Email.CONTACT_ID + ", " +
                        ContactsContract.CommonDataKinds.Email.DATA + " ASC";
        return new CursorLoader(getActivity(),
                            ContactsContract.CommonDataKinds.Email.CONTENT_URI,
                            projection,
                            null,
                            null,
                            sortOrder);
    } else {
        // should never happen
        return null;
    }
}

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
    int id = loader.getId();
    if (id == CONTACTS_LOADER_ID) {
        contactsCursor = cursor;
    } else if (id == EMAILS_LOADER_ID) {
        emailCursor = cursor;
    }

    if (contactsCursor != null && emailCursor != null) {
        init();
    }
}

void init() {
    if (allContacts == null) {
        allContacts = getAllContacts();
    }
    // do stuff with allContacts
}

private ArrayList<ContactFriend> getAllContacts() {
    HashMap<Integer, ArrayList<String>> emails = getEmailMap();
    ArrayList<ContactFriend> result = new ArrayList<ContactFriend>();

    contactsCursor.moveToFirst();
    do {
        String name = contactsCursor.getString(contactsCursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME_PRIMARY));
        String photo = contactsCursor.getString(contactsCursor.getColumnIndex(ContactsContract.Contacts.PHOTO_THUMBNAIL_URI));
        int id = contactsCursor.getInt(contactsCursor.getColumnIndex(ContactsContract.Contacts._ID));
        ArrayList<String> contactEmails = emails.get(id);
        if (!contactEmails.isEmpty()) {
            result.add(new ContactFriend(name, contactEmails, photo, id));
        }
    } while (contactsCursor.moveToNext());
    return result;
}

private HashMap<Integer, ArrayList<String>> getEmailMap() {
    HashMap<Integer, ArrayList<String>> result = new HashMap<Integer, ArrayList<String>>();

    while (contactsCursor.moveToNext()) {
        int id = contactsCursor.getInt(contactsCursor.getColumnIndex(ContactsContract.Contacts._ID));
        result.put(id, new ArrayList<String>());
    }

    Set<Integer> contactIds = result.keySet();
    while (emailCursor.moveToNext()) {
        int id = emailCursor.getInt(emailCursor.getColumnIndex(ContactsContract.CommonDataKinds.Email.CONTACT_ID));
        if (contactIds.contains(id)) {
            String email = emailCursor.getString(emailCursor.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA));
            result.get(id).add(email);
        }
    }
    return result;
}

A: Adding this in case someone else has the same problem.  Adding ContactsContract.Contacts.IN_VISIBLE_GROUP to the projection and then selecting only those entries where that value is equal to 1 gives me what I'm looking for.


text:
Q: Powershell parsing local HTML file Im trying to iterate through multiple HTML files in multiple computers.
My code is below:
ForEach ($system in (Get-Content C:\temp\computers.txt)) {

    $folder = "\\$system\c`$\ProgramData\Autodesk\AdLM\"
    Get-ChildItem $folder *.html  |
    Foreach-Object {
        $c = $_.BaseName
        $html = New-Object -ComObject "HTMLFile"
        $HTML.IHTMLDocument2_write($(Get-content $_.Name -Raw ))
        $para1 = $HTML.getElementById('para1') | % InnerText
        Add-Content -path c:\temp\results.csv "$c,$system,$para1"
    }
 }

I'm getting the following error:
New-Object : Cannot find parameter Raw

A: You can use the Internet Explorer COM object to do what you'd like the HTMLFile COM object to do.  HTMLFile isn't working 100% in all versions of Powershell, so this is a viable alternative.
ForEach ($system in (Get-Content C:\temp\computers.txt)) {
  $folder = "\\$system\c`$\ProgramData\Autodesk\AdLM\"
  Get-ChildItem $folder *.html  |
  ForEach-Object {
    $c = $_.BaseName
    $ie=New-Object -ComObject InternetExplorer.Application
    $ie.Navigate("$_")
    while ($ie.busy -eq $true) {
      Start-Sleep -Milliseconds 500
    }
    $doc=$ie.Document
    $elements=$doc.GetElementByID('para1')
    $elements.innerText | ForEach-Object { Add-Content -path c:\temp\results.csv "$c,$system,$para1" }
  }
}


text:
Q: Issue voice recognition c# I'm a beginner in programming and I'm trying to build a simple application to display message box that shows what I tried to say using voice recognition. The problem is when I say "hello" for the first time, for example, no message box is displayed. If I try one more time, a correct message box is played. In the third time that I say "hello", 2 message boxes are displayed. In the 4th time, 3 message boxes, and so on. Can anyone help with this problem?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Speech.Recognition;

namespace Voices
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private SpeechRecognitionEngine sre;

        private void Form1_Load(object sender, EventArgs e)
        {
            sre = new SpeechRecognitionEngine();
            sre.SetInputToDefaultAudioDevice();

            Choices commands = new Choices();
            commands.Add(new string[] { "hello" });

            GrammarBuilder gb = new GrammarBuilder();
            gb.Append(commands);

            Grammar g = new Grammar(gb);
            sre.LoadGrammar(g);

            sre.RecognizeAsync(RecognizeMode.Multiple);

            sre.SpeechRecognized += (s, args) =>
            {
                foreach (RecognizedPhrase phrase in args.Result.Alternates)
                {
                    if (phrase.Confidence > 0.9f)
                        sre.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(sre_SpeechRecognized);
                }
            };

        }

        void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            switch (e.Result.Text)
            {
                case "hello":
                    MessageBox.Show(e.Result.Text);
                    break;
            }
        }
    }
}

A: Your inline event handler (in Form_Load) is adding new event handlers every time you say anything.

A: Following code is the reason you get multiple message boxes:
sre.SpeechRecognized += (s, args) =>
{
    foreach (RecognizedPhrase phrase in args.Result.Alternates)
    {
        if (phrase.Confidence > 0.9f)
            sre.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(sre_SpeechRecognized);
    }
};

Everytime SpeechRecognized is raised, it registers to the same event with the same eventhandler.
It should register to the event only once.
I guess what you want to do is following:
if (phrase.Confidence > 0.9f)
    sre_SpeechRecognized(s, args);


text:
Q: React - how to use useCallBack with onChange function I have simple React component: How I can improve this component by adding useCallback hook? Is it even a good idea to add useCallback hook in this component? If yes, to which function should I add it.

import styled from "styled-components"
import React, { useState } from "react"
import { useGetFilteredBooks } from "../../hooks/useGetFilteredBooks"
import { useRecoilState } from "recoil"
import { Books, PageNumber, SearchText } from "../../recoil/globalState"

export const SearchBook = () => {
    const [text, setText] = useRecoilState(SearchText)
    const [pageNumber, setPageNumber] = useRecoilState(PageNumber)
    const [setBooks] = useRecoilState(Books);
    const { refetch } = useGetFilteredBooks(text, setBooks, setPageNumber);

    const handleOnChange = (event: React.ChangeEvent<HTMLInputElement>) => {
        setText(event.target.value)
    }

    const handleOnSubmit = (e: any) => {
        e.preventDefault();
        refetch();
    }

    return (
        <>
            <form onSubmit={handleOnSubmit}>
                <Input value={text} onChange={handleOnChange} placeholder="Enter the name of the book or author" />
                <button type="submit">Show</button>
            </form>
        </>
    )
}

const Input = styled.input`
    padding: 10px 10px;
    width: 300px;
`


text:
Q: Obtaining a particular 3d view in pgfplots I am trying to achieve the following plot, with the indicated perspective and the axis lines centered:

I've played around with several view options and I'm just not able to reproduce the figure. Any help will be greatly appreciated. Here is what I have so far:
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
    \begin{tikzpicture}[>=latex,font=\footnotesize]
     \begin{axis}[view={45}{110},axis lines = center,colormap/greenyellow,xlabel={$x$},ylabel={$y$},zlabel={$z$}]
      \addplot3[surf,samples=40,domain=-4:4,y domain=-3:3]{-2*x+3*y+6};
     \end{axis}
    \end{tikzpicture}
\end{document}


text:
Q: What date does the Java keytool show? Yesterday, I used keytool for listing our keystore like follows:
keytool -list -keystore src/keystore.p12
Enter keystore password:
Keystore type: JKS
Keystore provider: SUN

Your keystore contains 5 entries

octopus, Jan 15, 2018, PrivateKeyEntry,
Certificate fingerprint (SHA1): FE:B2:B7:C0:A7:CF:...

As there was a problem, I concluded that the first certificate has just expired. Today I'm getting
octopus, Jan 16, 2018, PrivateKeyEntry,
Certificate fingerprint (SHA1): FE:B2:B7:C0:A7:CF:...

Is keytool really meant for showing the current date or is it just joking???
I though, the date was the "Not After" date, as it made sense. It can't be the date the entry was added or recently modified. I may be doing something wrong, but

*

*I'm sure that the date has changed as I can see in an email I sent yesterday

*I'm sure that the keystore did not change as it's tracked by git. I've even deleted it and checked it out again, no change

*I'm sure that the keystore hasn't changed since six months ago (and git agrees)

*other entries show different dates

The keytool provides no version information.
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

A: For JKS it IS the date the keystore entry was created or modified, but PKCS12 doesn't store that info so keytool (actually JCE IINM) just uses 'now'.
Note in recent updates of java 8 KeyStore.getInstance("JKS") actually reads both JKS and PKCS12; see https://stackoverflow.com/a/47640052/2868801 . In java 9 PKCS12 becomes default.
To see the validity period (notBefore and notAfter) in the cert(s), along with a lot of other info you may not want, use -v


text:
Q: GWT Maven hosted mode After some tries, I don't get to make the hosted mode to work with maven. My pom.xml is the following and I'm using a standard maven structure:
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>gwt-maven-plugin</artifactId>
            <version>2.4.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                        <goal>i18n</goal>
                        <goal>generateAsync</goal>
                    </goals>
                </execution>
            </executions>

            <configuration>
                <draftCompile>true</draftCompile>
                <strict>true</strict>
                <inplace>false</inplace>
                <runTarget>project.html</runTarget>
                <style>${gwt.style}</style>
                <i18nMessagesBundle>com.domain.client.i18n.Messages</i18nMessagesBundle>
                <i18nConstantsBundle>comdomain.client.properties.ClientProperties</i18nConstantsBundle>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <executions>
                <execution>
                    <phase>compile</phase>
                    <goals>
                        <goal>exploded</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

Any ideas?

A: Here is the POM I used in a presentation today that works if you want to compare them: https://github.com/checketts/gwt-spring-demo/blob/master/pom.xml.

A: I noticed two missing tags <outputDirectory> under build and  <module> under gwt-maven-plugin configurations.
Also reference - http://code.google.com/p/google-web-toolkit/source/browse/trunk/samples/dynatablerf/pom.xml
 <build>
    <!-- Generate compiled stuff in the folder used for development mode -->
    <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>

    <plugins>

      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.4</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
        <dependencies>
          <!-- Need to run the RF Validation tool. This works on both the command-line
               and in Eclipse, provided that m2e-apt is installed. -->
          <dependency>
            <groupId>com.google.web.bindery</groupId>
            <artifactId>requestfactory-apt</artifactId>
            <version>${gwtVersion}</version>
          </dependency>
        </dependencies>
      </plugin>

      <!-- GWT Maven Plugin-->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <version>2.5.0</version>
        <dependencies>
          <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <version>${gwtVersion}</version>
          </dependency>
          <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-dev</artifactId>
            <version>${gwtVersion}</version>
          </dependency>
        </dependencies>
        <!-- JS is only needed in the package phase, this speeds up testing -->
        <executions>
          <execution>
            <phase>prepare-package</phase>
            <goals>
              <goal>compile</goal>
              <goal>i18n</goal>
              <goal>generateAsync</goal>
             </goals>
          </execution>
        </executions>

        <!-- Plugin configuration. There are many available options,
             see gwt-maven-plugin documentation at codehaus.org -->
        <configuration>
          <draftCompile>true</draftCompile>
          <strict>true</strict>
          <inplace>false</inplace>
          <!-- URL that should be automatically opened in the GWT shell (gwt:run). -->
          <runTarget>project.html</runTarget>
          <style>${gwt.style}</style>
          <i18nMessagesBundle>com.domain.client.i18n.Messages</i18nMessagesBundle>
          <i18nConstantsBundle>comdomain.client.properties.ClientProperties</i18nConstantsBundle>
          <!-- Ask GWT to create the Story of Your Compile (SOYC) (gwt:compile) -->
          <compileReport>true</compileReport>
          <module>youR.gwt.ModuleName</module>
          <logLevel>INFO</logLevel>
          <copyWebapp>true</copyWebapp>
        </configuration>
      </plugin>

A: Try adding these configuration entries :
<warSourceDirectory>${basedir}/src/main/webapp</warSourceDirectory>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<hostedWebapp>${basedir}/src/main/webapp</hostedWebapp>

The last one may be the real needed one actually


text:
Q: How can I determine what services I had running before a new install? Background:

*

*want to move from 32-bit to 64-bit environment (taking advantage of >4GB RAM)

*bought new HDD and installed new OS

*mounted old HDD as a secondary device

Question:

*

*How can I determine all services I had installed and running on the old system?

A: Try:
service --status-all

or:
ls /etc/init.d

A: You can use the chroot command on your partition on which you had old OS. Once you're done with chroot, do anything you want like you are using your old OS again.
you can see list of installed packages or you can see the content of /etc/init.d to see list of services.
To do chroot you can can see up to 6th step in http://alok.fossguru.in/content/rescuing-system-chroot

A: you can list all the service  with sudo initctl list | sort. Give your password after typing the command.
hope that helps.


text:
Q: TeeChart C# Points series custom width The TeeChart Points series has the GetPointerStyle event can be used to change the color and the style of each point of the series, but there is a way to change the width property of each point of the series?

A: You can use GetPointerStyle to modify the Series' HorizSize and VertSize properties. Ie:
private void Points1_GetPointerStyle(CustomPoint series, GetPointerStyleEventArgs e)
{
  if (e.ValueIndex % 4 == 0)
  {
    series.Pointer.HorizSize = 4;
    series.Pointer.VertSize = 4;
  }
  else
  {
    series.Pointer.HorizSize = 2;
    series.Pointer.VertSize = 2;
  }
}


text:
Q: Ghostscript - Specify output size when creating png from pdf I've read a few threads on this general subject, but they don't seem to help so I'm asking as a new question.
I'm currently creating a process to use ghostscript from vb.net (I've had some issues with parameters with Ghostscipt.net, but external process works well enough for me)
I'm capturing a small square area from a specific page of a pdf and converting to a png. There's an offset involved as the area is not on the left/bottom edge, so I'm using 200x200 for the size and -220, 206 for x/y offset and I've specified page 1 for this example, as below:
" -dBATCH -dNOPAUSE -sDEVICE=pnggray -r600 -dDEVICEWIDTHPOINTS=200 -dDEVICEHEIGHTPOINTS=200 -dFIXEDMEDIA -dFirstPage=1 -dLastPage=1 -SOutputFile="mypath\output.png" -c "<</PageOffset [-220 206]>> setpagedevice" -f "mypath\input.pdf"

This works fine, but I next need to restrict the output png file to 600 x 600 pixels, regardless of input size.
All the solutions I've found seem to be related to changing device width/height points, but I use those to specifiy the area I want to capture, so I'm confused as to how this should work.
Can anyone help?
Sorry I couldn't tag this for Ghostscript - my reputation isn't high enough!
Thanks

A: Thanks K J for your comments, very helpful. I've been testing an alternative library for decoding the QR codes - ZXing.net - and this seems not to be so fussy about resolution and image size, so I think I've gotten around the problem that way.
I've tried it with both 300 and 600 resolution files of different sizes and it's worked well, so I'd recommend it to anyone with this sort of requirement!


text:
Q: How to prove that $u(r)=k \frac{1}{r}$ is the only solution for the integral equation $\int_{V'}\rho'\ u(r)\ dV' = constant$? Consider a hollow spherical charge with density $\rho'$ continuously varying only with respect to distance from the center $O$.

$V'=$ yellow volume
$k \in \mathbb {R}$
$\forall$ point $P$ inside the hollow sphere:
\begin{align}
\vec{E}_P &=\displaystyle\int_{V'}\rho'\ \vec{f}(r)\ dV'\\
&=\int_{V'}\rho'\ [-\nabla u(r)]\ dV'\\
&=-\nabla \int_{V'}\rho'\ u(r)\ dV' = 0\\
\implies \int_{V'}\rho'\ u(r)\ dV' &= constant\\
\implies u(r) &=k \dfrac{1}{r}\\
\end{align}
For the proof of last equation, see below:

*

*Logically deducing inverse square law (physics)

*https://www.docdroid.net/Wg59yXo/v-pdf

Question:
At first we do not know how many solutions are there. So let the solutions be  $u_1(r), u_2(r), u_3(r),......$
We started from $\int_{V'}\rho'\ u(r)\ dV' = constant$ and reached $u_1(r)= k \dfrac{1}{r}$
Now if we start from $\int_{V'}\rho'\ u(r)\ dV' = constant$ and by a different approach (i.e. through a series of different reasoning), we reach another solution $u_2(r)$
Again we start from $\int_{V'}\rho'\ u(r)\ dV' = constant$ and by a third approach, we reach third solution $u_3(r)$
Why other such solutions are not possible?

Please read the grey highlighted sentence in the following Wikipedia article: Shell theorem which says:
"If we further constrain the force by requiring that the second part of the theorem also holds, namely that there is no force inside a hollow ball, we exclude the possibility of the additional term, and the inverse square law is indeed the unique force law satisfying the theorem."

How shall we prove that $u(r)=k \dfrac{1}{r}$ is the only solution for the integral equation $\displaystyle\int_{V'}\rho'\ u(r)\ dV' = constant$?
Shall we require high level mathematics to do so?

$$\text{ }$$
I am a mathematics graduate. So please try to answer at my level.

A: The Wikipedia is right. According to the experiment with the hollow sphere, the inverse square law is indeed the unique force law satisfying the theorem.
Your problem seems to lie in the mathematical logic. I have worked out the PDF you posted.
I will use $C_1$, $C_2$, $C_3$... as constants
As you described in your question, you seem to know everything up to $\psi=C_1$. We need to find the solution for $\dfrac{f(r)}{r}$
Now let me begin:
Let the solutions be $\dfrac{f_1(r)}{r}$, $\dfrac{f_2(r)}{r}$, $\dfrac{f_3(r)}{r}$......
For some time, let us concentrate only on $\dfrac{f_1(r)}{r}$
Since $\dfrac{f_1(r)}{r}$ is a solution,
$\psi = \int_V\ \rho\ \dfrac{f_1(r)}{r} dV = C_1$
This must be true.
Now continue your calculations in the PDF you posted. And finally,
$\dfrac{f_1(r)}{r} = C_2 + \dfrac{C_3}{r}$
Following the implications in the PDF, this also must be true.
Now let us concentrate on $\dfrac{f_2(r)}{r}$
Following the exact same reasoning, we see $\dfrac{f_2(r)}{r} = C_4 + \dfrac{C_5}{r}$ must be true.
This same result apply $\forall\ \dfrac{f_n(r)}{r}\ (n\in \mathbb{N})$
Now continuing the last calculations in your PDF (i.e. taking gradient), we can see that inverse square law is the only force law satisfying the if condition of inverse of shell theorem.