问:
How to integrate two Django projects with different databases?
I have my original Django project which runs on sqlite3 database. I want to integrate another Django project from GitHub which runs on postgre database. I added github link in requirements.txt file & installed it and added the new Django project app in original INSTALLED_APPS section of settings.py file and also updated urls.py file of original project. Now I got stuck with how to combine settings.py of these two projects?

When I run command

python manage.py migrate

then it gives me this error:-

AttributeError: 'DatabaseOperations' object has no attribute 'geo_db_type'

Correct settings are already in github downloaded django project but not in original project.

I have read almost all answers on Stack Overflow as well as on official docs. But enable to understand.
my apologies if this is a duplicate or stupid question.

答:
According to the documentation you need to edit your setting by:
1) add a new file calling ex databases.py

```<code>DATABASES = {
'default': {},
'auth_db': {
    'NAME': 'auth_db',
    'ENGINE': 'django.db.backends.mysql',
    'USER': 'mysql_user',
    'PASSWORD': 'swordfish',
},
'primary': {
    'NAME': 'primary',
    'ENGINE': 'django.db.backends.mysql',
    'USER': 'mysql_user',
    'PASSWORD': 'spam',
},
'replica1': {
    'NAME': 'replica1',
    'ENGINE': 'django.db.backends.mysql',
    'USER': 'mysql_user',
    'PASSWORD': 'eggs',
},
'replica2': {
    'NAME': 'replica2',
    'ENGINE': 'django.db.backends.mysql',
    'USER': 'mysql_user',
    'PASSWORD': 'bacon',
},
</code>```

2) for the authrouter file see the documentation, here an example:

```<code>import random

class PrimaryReplicaRouter(object):
    def db_for_read(self, model, **hints):
        """
        Reads go to a randomly-chosen replica.
        """
        return random.choice(['replica1', 'replica2'])

    def db_for_write(self, model, **hints):
        """
        Writes always go to primary.
        """
        return 'primary'

    def allow_relation(self, obj1, obj2, **hints):
        """
        Relations between objects are allowed if both objects are
        in the primary/replica pool.
        """
        db_list = ('primary', 'replica1', 'replica2')
        if obj1._state.db in db_list and obj2._state.db in db_list:
            return True
        return None

    def allow_migrate(self, db, app_label, model_name=None, **hints):
        """
        All non-auth models end up in this pool.
        """
        return Trueta.app_label == 'auth':
            return 'auth_db'
        return None

    def allow_relation(self, obj1, obj2, **hints):
        """
        Allow relations if a model in the auth app is involved.
        """
        if obj1._meta.app_label == 'auth' or \
           obj2._meta.app_label == 'auth':
           return True
        return None

    def allow_migrate(self, db, app_label, model_name=None, **hints):
        """
        Make sure the auth app only appears in the 'auth_db'
        database.
        """
        if app_label == 'auth':
            return db == 'auth_db'
        return None
</code>```

3) in your settings.py remove the database schema and add this line

```<code>DATABASE_ROUTERS = ['yourapp.filename.CLASS']
</code>```

When you will lunch the command "migrate" add --database=databasename for apply them
For more info see https://docs.djangoproject.com/en/1.10/topics/db/multi-db/

Body:
According to the documentation you need to edit your setting by:
1) add a new file calling ex databases.py

DATABASES = {
'default': {},
'auth_db': {
    'NAME': 'auth_db',
    'ENGINE': 'django.db.backends.mysql',
    'USER': 'mysql_user',
    'PASSWORD': 'swordfish',
},
'primary': {
    'NAME': 'primary',
    'ENGINE': 'django.db.backends.mysql',
    'USER': 'mysql_user',
    'PASSWORD': 'spam',
},
'replica1': {
    'NAME': 'replica1',
    'ENGINE': 'django.db.backends.mysql',
    'USER': 'mysql_user',
    'PASSWORD': 'eggs',
},
'replica2': {
    'NAME': 'replica2',
    'ENGINE': 'django.db.backends.mysql',
    'USER': 'mysql_user',
    'PASSWORD': 'bacon',
},

2) for the authrouter file see the documentation, here an example:

import random

class PrimaryReplicaRouter(object):
    def db_for_read(self, model, **hints):
        """
        Reads go to a randomly-chosen replica.
        """
        return random.choice(['replica1', 'replica2'])

    def db_for_write(self, model, **hints):
        """
        Writes always go to primary.
        """
        return 'primary'

    def allow_relation(self, obj1, obj2, **hints):
        """
        Relations between objects are allowed if both objects are
        in the primary/replica pool.
        """
        db_list = ('primary', 'replica1', 'replica2')
        if obj1._state.db in db_list and obj2._state.db in db_list:
            return True
        return None

    def allow_migrate(self, db, app_label, model_name=None, **hints):
        """
        All non-auth models end up in this pool.
        """
        return Trueta.app_label == 'auth':
            return 'auth_db'
        return None

    def allow_relation(self, obj1, obj2, **hints):
        """
        Allow relations if a model in the auth app is involved.
        """
        if obj1._meta.app_label == 'auth' or \
           obj2._meta.app_label == 'auth':
           return True
        return None

    def allow_migrate(self, db, app_label, model_name=None, **hints):
        """
        Make sure the auth app only appears in the 'auth_db'
        database.
        """
        if app_label == 'auth':
            return db == 'auth_db'
        return None

3) in your settings.py remove the database schema and add this line

DATABASE_ROUTERS = ['yourapp.filename.CLASS']

When you will lunch the command "migrate" add --database=databasename for apply them
For more info see https://docs.djangoproject.com/en/1.10/topics/db/multi-db/


来源: stackexchange

问:
flash distance calculated in python
Define function of flash distance that takes an argument time interval (seconds) and calculates with formula:

```<code>the distance(in kilometers) = time interval(in seconds) * 330 / 1000.
</code>```

Lightning distance in kilometers and return it. The distance shall be rounded to the whole number. Function of flash distance for the returned value must be rounded already.

I have program like this, but somethings is very wrong and I need help please. What and how I have to do?

```<code>def flash_distance (number_ms):
     flash_distance = (number_ms * 330/1000)
     round return (flash_distance * 330/1000)

distance_ms = 330

distance = int (input ("How many seconds it took seeing the lightning flash hearing?"))

print ("lightning distance in kilometers:" + str (flash_distance (distance_ms)))
</code>```

答:
I think the code below will settle your problem. In your code, distance_ms has been assigned to 330, so variable distance assigned by user will not work, which is generally not expected.

```<code>def flash_distance (number_ms):
     flash_distance = (number_ms * 330/1000)
     return round (flash_distance)

distance_ms = int (input ("How many seconds it took seeing the lightning flash hearing?"))

print ("lightning distance in kilometers:" + str (flash_distance (distance_ms)))
</code>```

ContentLicense: CC BY-SA 3.0

Title: flash distance calculated in python

Body:
Define function of flash distance that takes an argument time interval (seconds) and calculates with formula:

the distance(in kilometers) = time interval(in seconds) * 330 / 1000.

Lightning distance in kilometers and return it. The distance shall be rounded to the whole number. Function of flash distance for the returned value must be rounded already.

I have program like this, but somethings is very wrong and I need help please. What and how I have to do?

def flash_distance (number_ms):
     flash_distance = (number_ms * 330/1000)
     round return (flash_distance * 330/1000)

distance_ms = 330

distance = int (input ("How many seconds it took seeing the lightning flash hearing?"))

print ("lightning distance in kilometers:" + str (flash_distance (distance_ms)))

Body:
I think the code below will settle your problem. In your code, distance_ms has been assigned to 330, so variable distance assigned by user will not work, which is generally not expected.

def flash_distance (number_ms):
     flash_distance = (number_ms * 330/1000)
     return round (flash_distance)

distance_ms = int (input ("How many seconds it took seeing the lightning flash hearing?"))

print ("lightning distance in kilometers:" + str (flash_distance (distance_ms)))


问:
Java ArrayIndexOutOfBoundsException
I wrote a Java program below:

```<code>int[] tar = {1,2,5};
for(int i=0 ; i<tar.length ; i++)
{
   if(tar[i] - tar[i-1] > 2)
   {
      System.out.print("true");
   }
}
</code>```

why "tar[i] - tar[i-1]" doesn't mean any error？ Isn't an error of ArrayIndexOutBoundsException?

答:
It is an Exception and not error (if you mean it by compiler), cause Java knows about your array values only at run time.

Compiler cannot run your code and see that. What if at runtime you provided some good values at right indices ? That is the reason, compiler only checks the compiler level rules. It won't hint you about runtime behaviour.

Title: Java ArrayIndexOutOfBoundsException

Body:
I wrote a Java program below:

int[] tar = {1,2,5};
for(int i=0 ; i<tar.length ; i++)
{
   if(tar[i] - tar[i-1] > 2)
   {
      System.out.print("true");
   }
}

why "tar[i] - tar[i-1]" doesn't mean any error？ Isn't an error of ArrayIndexOutBoundsException?


问:
How to Change Amazon S3 file URL Like s3.amazonaws.com/bucket/key from bucket.s3.amazonaws.com/key in Java?
Working with AmazonS3 bucket - After uploading file to bucket, we can get uploaded file URL using below code :

```<code>String fileDownloadUrl = AmzonS3Client.getUrl(bucketName, fileName);
</code>```

In Result it will give url like i.e : bucket.s3.amazonaws.com/key but I want s3.amazonaws.com/bucket/key. So Can anyone help me how can I solve this in java?

答:
By default pathstyleaccess is false so your uploaded file should be bucket.s3.amazonaws.com/key but when you explicitly add clientOptions -- pathStyleAccess to true then it will generate URL like s3.amazonaws.com/bucket/key. Please find below code snippet

S3ClientOptions clientOptions = new S3ClientOptions();
clientOptions.setPathStyleAccess(true);

And set this clientOptions to Amazons3client.

Body:
Working with AmazonS3 bucket - After uploading file to bucket, we can get uploaded file URL using below code :

String fileDownloadUrl = AmzonS3Client.getUrl(bucketName, fileName);

In Result it will give url like i.e : bucket.s3.amazonaws.com/key but I want s3.amazonaws.com/bucket/key. So Can anyone help me how can I solve this in java?


问:
C# xml file creation adding same attribute both of child and parent nodes
I am using c# to create a xml file, however I got some problem.
I would like to have both of parent and child nodes with a same attribute. But only one of those nodes has the attribute, even though I appended both of those.

what I expected:

```<code><request>
    <transaction transactionId:"123">
        <transactionDetail transactionId:"123"></transactionDetail>
    </transaction>
</request>
</code>```

what I got:

```<code><request>
    <transaction>
        <transactionDetail transactionId:"123"></transactionDetail>
    </transaction>
</request>
</code>```

or

```<code><request>
    <transaction  transactionId:"123">
        <transactionDetail></transactionDetail>
    </transaction>
</request>
</code>```

This is depends on the order that I write code (The node I append later has attribute). Could you please help me out to find what's causing this problem?

Also, I just wonder:

Does the order of appending (both of .AppendChild() & .Append() ) matter?

Can't I reuse attributes which are already appended in other nodes?

The following is the function to create xml file:

```<code>public ActionResult createXMLFile() {

            XmlDocument xmlFile = new XmlDocument();

            XmlNode request = xmlFile.CreateElement("request");
            XmlNode transaction= xmlFile.CreateElement("transaction");
            XmlNode transactionDetail= xmlFile.CreateElement("transactionDetail");

            XmlAttribute transactionId= xmlFile.CreateAttribute("transactionId");
            transactionId.Value = "123";

            transaction.Attributes.Append(transactionId);
            transactionDetail.Attributes.Append(transactionId);

            xmlFile.AppendChild(request);
            request.AppendChild(transaction);
            transaction.AppendChild(transactionDetail);

            string path ="somepath";

            xmlFile.Save(path);

    }
</code>```

Thank you for reading my question. :)

答:
As hinted in the comments, you need to create two attributes, you can't reuse the same one:

```<code>var transactionId1 = xmlFile.CreateAttribute("transactionId");
transactionId1.Value = "123";
transaction.Attributes.Append(transactionId1);

var transactionId2 = xmlFile.CreateAttribute("transactionId");
transactionId2.Value = "123";
transactionDetail.Attributes.Append(transactionId2);
</code>```

However, I'd suggest using LINQ to XML. You can create this XML far more declaratively:

```<code>var doc = new XDocument(
    new XElement("request",
        new XElement("transaction",
            new XAttribute("transactionId", "123"),
                new XElement("transactionDetail", new XAttribute("transactionId", "123"))
            )
        )
    );

doc.Save(path);
</code>```

See this fiddle.

Body:
I am using c# to create a xml file, however I got some problem.
I would like to have both of parent and child nodes with a same attribute. But only one of those nodes has the attribute, even though I appended both of those.

what I expected:

<request>
    <transaction transactionId:"123">
        <transactionDetail transactionId:"123"></transactionDetail>
    </transaction>
</request>

what I got:

<request>
    <transaction>
        <transactionDetail transactionId:"123"></transactionDetail>
    </transaction>
</request>

or

<request>
    <transaction  transactionId:"123">
        <transactionDetail></transactionDetail>
    </transaction>
</request>

This is depends on the order that I write code (The node I append later has attribute). Could you please help me out to find what's causing this problem?

Also, I just wonder:

Does the order of appending (both of .AppendChild() & .Append() ) matter?

Can't I reuse attributes which are already appended in other nodes?

The following is the function to create xml file:

public ActionResult createXMLFile() {

            XmlDocument xmlFile = new XmlDocument();

            XmlNode request = xmlFile.CreateElement("request");
            XmlNode transaction= xmlFile.CreateElement("transaction");
            XmlNode transactionDetail= xmlFile.CreateElement("transactionDetail");

            XmlAttribute transactionId= xmlFile.CreateAttribute("transactionId");
            transactionId.Value = "123";

            transaction.Attributes.Append(transactionId);
            transactionDetail.Attributes.Append(transactionId);

            xmlFile.AppendChild(request);
            request.AppendChild(transaction);
            transaction.AppendChild(transactionDetail);

            string path ="somepath";

            xmlFile.Save(path);

    }

Thank you for reading my question. :)

Body:
As hinted in the comments, you need to create two attributes, you can't reuse the same one:

var transactionId1 = xmlFile.CreateAttribute("transactionId");
transactionId1.Value = "123";
transaction.Attributes.Append(transactionId1);

var transactionId2 = xmlFile.CreateAttribute("transactionId");
transactionId2.Value = "123";
transactionDetail.Attributes.Append(transactionId2);

However, I'd suggest using LINQ to XML. You can create this XML far more declaratively:

var doc = new XDocument(
    new XElement("request",
        new XElement("transaction",
            new XAttribute("transactionId", "123"),
                new XElement("transactionDetail", new XAttribute("transactionId", "123"))
            )
        )
    );

doc.Save(path);

See this fiddle.


问:
How to programmatically mark an Azure WebJob as failed?
Is there a way to mark a WebJob (triggered, not continuous) as failed, without throwing an exception? I need to check that certain conditions are true to mark the job as successful.</p>

答:
According to Azure WebJob SDK, Code from TriggeredFunctionExecutor class.

```<code>public async Task<FunctionResult> TryExecuteAsync(TriggeredFunctionData input, CancellationToken cancellationToken)
{

    IFunctionInstance instance = _instanceFactory.Create((TTriggerValue)input.TriggerValue, input.ParentId);
    IDelayedException exception = await _executor.TryExecuteAsync(instance, cancellationToken);
    FunctionResult result = exception != null ?
        new FunctionResult(exception.Exception)

        : new FunctionResult(true);
    return result;
}
</code>```

We know that the WebJobs status depends on whether your WebJob/Function is executed without any exceptions or not. We can't set the finial status of a running WebJob programmatically.

I need to check that certain conditions are true to mark the job as successful.

Throw an exception is the only way I found. Or you could store the webjob execute result in an additional place(For example, Azure Table Storage). We can get the current invocation id by ExecutionContext class. In your webjob, you could save the current invocation id and the status you wanted to an Azure Table Storage. You could query the status later if you needed from Azure Table Storage based on the invocation id.

```<code>public static void ProcessQueueMessage([QueueTrigger("myqueue")] string message, ExecutionContext context, TextWriter log)
{
    log.WriteLine(message);
    SaveStatusToTableStorage(context.InvocationId, "Fail/Success");
}
</code>```

To use ExecutionContext as parameter, you need to install Azure WebJobs SDK Extensions using NuGet and invoke UserCore method before your run your WebJob.

```<code>var config = new JobHostConfiguration();
config.UseCore();
var host = new JobHost(config);
host.RunAndBlock();
</code>```

Body:
According to Azure WebJob SDK, Code from TriggeredFunctionExecutor class.

public async Task<FunctionResult> TryExecuteAsync(TriggeredFunctionData input, CancellationToken cancellationToken)
{

    IFunctionInstance instance = _instanceFactory.Create((TTriggerValue)input.TriggerValue, input.ParentId);
    IDelayedException exception = await _executor.TryExecuteAsync(instance, cancellationToken);
    FunctionResult result = exception != null ?
        new FunctionResult(exception.Exception)

        : new FunctionResult(true);
    return result;
}

We know that the WebJobs status depends on whether your WebJob/Function is executed without any exceptions or not. We can't set the finial status of a running WebJob programmatically.

I need to check that certain conditions are true to mark the job as successful.

Throw an exception is the only way I found. Or you could store the webjob execute result in an additional place(For example, Azure Table Storage). We can get the current invocation id by ExecutionContext class. In your webjob, you could save the current invocation id and the status you wanted to an Azure Table Storage. You could query the status later if you needed from Azure Table Storage based on the invocation id.

public static void ProcessQueueMessage([QueueTrigger("myqueue")] string message, ExecutionContext context, TextWriter log)
{
    log.WriteLine(message);
    SaveStatusToTableStorage(context.InvocationId, "Fail/Success");
}

To use ExecutionContext as parameter, you need to install Azure WebJobs SDK Extensions using NuGet and invoke UserCore method before your run your WebJob.

var config = new JobHostConfiguration();
config.UseCore();
var host = new JobHost(config);
host.RunAndBlock();


问:
Using 'OR' in CakePHP find
I am using CakePHP 3.2 and following find().

```<code>if($filter_data_array['age_younger'] != '')
        {
            $conditions["icases.age <= "] = $filter_data_array['age_younger'];
        }

        if($filter_data_array['age_older'] != '')
        {
            $conditions["icases.age >= "] = $filter_data_array['age_older'];
        }

        if($filter_data_array['go_date_after'] != '')
        {
            $conditions["icases.go_date >= "] = $filter_data_array['go_date_after'];
        }

        if($filter_data_array['go_date_before'] != '')
        {
            $conditions["icases.go_date <= "] = $filter_data_array['go_date_before'];
        }

        if($filter_data_array['client'] != '')
        {
            $conditions["icases.client_id = "] = $filter_data_array['client'];
        }

        if($filter_data_array['case_name'] != '')
        {
            $conditions["icases.name = "] = $filter_data_array['case_name'];
        }

        if($filter_data_array['case_ref'] != '')
        {
            $conditions["icases.case_reference_i_d = "] = $filter_data_array['case_ref'];
        }

        if($filter_data_array['instruction_date'] != '')
        {
            $conditions["icases.date_instruction_received >= "] = $filter_data_array['instruction_date'];
        }

        $cases_data = TableRegistry::get('icases')->find('all')
                ->select(['icases.id', 'icases.state', 'icases.client_id', 'icases.name', 'icases.age', 'icases.case_reference_i_d', 'icases.go_date', 'clients.name'])
                ->innerJoin('icases_users', 'icases_users.icase_id = icases.id')
                ->where($conditions)
                ->innerJoin('clients', 'clients.id = icases.client_id')
                ->order(['clients.name' => 'ASC', 'icases.name' => 'ASC'])
                ->execute()
                ->fetchAll('assoc');
</code>```

Now there is a state column in icases table and I want to filter by

```<code>icases.state='active' OR icases.state='pending' OR icases.state='archive'
</code>```

My question is how do I integrate it into my existing $conditions array?

Thank you in advance.

答:
First of all, I would recommend to follow the CakePHP Conventions. Your Code would become much more readable.

I would also recommend to connect your relations inside the Table objects. This keeps your code DRY and you can just load the associated models by using contain instead of 'manually' using innerJoin.

Check out the following code. It’s not tested, but should work. Using the Advanced conditions is a little more 'Cake-ish' and easily mantainable. If you don’t care about the rest, just have a look at the $orConditions in the code.

$query = TableRegistry::get('Cases')->find('all')
    ->select([
        'Cases.id',
        'Cases.state',
        'Cases.client_id',
        'Cases.name',
        'Cases.age',
        'Cases.case_reference_i_d',
        'Cases.go_date',
        'Clients.name'
    ])
    ->order([
        'Clients.name' => 'asc',
        'Cases.name' => 'asc'
    ])
    ->contain([
        'Clients',
        'Users'
    ])
    ->where(function ($exp) use ($filter_data_array) {

        if (!empty($filter_data_array['age_younger'])) {
            $exp = $exp->lte('Cases.age', $filter_data_array['age_younger']);
        }
        if (!empty($filter_data_array['age_older'])) {
            $exp = $exp->gte('Cases.age', $filter_data_array['age_older']);
        }
        if (!empty($filter_data_array['go_date_after'])) {
            $exp = $exp->gte('Cases.go_date', $filter_data_array['go_date_after']);
        }
        if (!empty($filter_data_array['go_date_before'])) {
            $exp = $exp->lte('Cases.go_date', $filter_data_array['go_date_before']);
        }
        if (!empty($filter_data_array['client'])) {
            $exp = $exp->eq('Cases.client_id', $filter_data_array['client']);
        }
        if (!empty($filter_data_array['case_name'])) {
            $exp = $exp->eq('Cases.name', $filter_data_array['case_name']);
        }
        if (!empty($filter_data_array['case_ref'])) {
            $exp = $exp->eq('Cases.case_reference_i_d', $filter_data_array['case_ref']);
        }
        if (!empty($filter_data_array['instruction_date'])) {
            $exp = $exp->gte('Cases.date_instruction_received', $filter_data_array['instruction_date']);
        }

        $orConditions = $exp->or_([
            'Cases.state' => 'active',
            'Cases.state' => 'pending',
            'Cases.state' => 'archive'
        ]);

        return $exp->add($orConditions);
    });

$cases_data = $query->execute();
```

Title: Using 'OR' in CakePHP find

Body:
I am using CakePHP 3.2 and following find().

if($filter_data_array['age_younger'] != '')
        {
            $conditions["icases.age <= "] = $filter_data_array['age_younger'];
        }

        if($filter_data_array['age_older'] != '')
        {
            $conditions["icases.age >= "] = $filter_data_array['age_older'];
        }

        if($filter_data_array['go_date_after'] != '')
        {
            $conditions["icases.go_date >= "] = $filter_data_array['go_date_after'];
        }

        if($filter_data_array['go_date_before'] != '')
        {
            $conditions["icases.go_date <= "] = $filter_data_array['go_date_before'];
        }

        if($filter_data_array['client'] != '')
        {
            $conditions["icases.client_id = "] = $filter_data_array['client'];
        }

        if($filter_data_array['case_name'] != '')
        {
            $conditions["icases.name = "] = $filter_data_array['case_name'];
        }

        if($filter_data_array['case_ref'] != '')
        {
            $conditions["icases.case_reference_i_d = "] = $filter_data_array['case_ref'];
        }

        if($filter_data_array['instruction_date'] != '')
        {
            $conditions["icases.date_instruction_received >= "] = $filter_data_array['instruction_date'];
        }

        $cases_data = TableRegistry::get('icases')->find('all')
                ->select(['icases.id', 'icases.state', 'icases.client_id', 'icases.name', 'icases.age', 'icases.case_reference_i_d', 'icases.go_date', 'clients.name'])
                ->innerJoin('icases_users', 'icases_users.icase_id = icases.id')
                ->where($conditions)
                ->innerJoin('clients', 'clients.id = icases.client_id')
                ->order(['clients.name' => 'ASC', 'icases.name' => 'ASC'])
                ->execute()
                ->fetchAll('assoc');

Now there is a state column in icases table and I want to filter by

icases.state='active' OR icases.state='pending' OR icases.state='archive'

My question is how do I integrate it into my existing $conditions array?

Thank you in advance.


问:
FuncAnimation difficulty with markevery
I would like to sequentially plot a series of x,y coordinates while marking specified coordinates distinctly. It seems that 'markevery' allows users to do this in matplotlib plots, however, when I provide this property in my animation, I receive the error 'ValueError: markevery is iterable but not a valid form of numpy fancy indexing'. Any thoughts?

My actual 'mark_on' array will be much longer, so I think that using a linecollection isn't reasonable here.

```<code>frames = 100
def update_pos(num,data,line):
    line.set_data(data[...,:num])
    return line,

def traj_ani(data):
    fig_traj = plt.figure()
    l,= plt.plot([],[],'b', markevery = mark_on, marker = '*')
    plt.xlim(-90,90)
    plt.ylim(-90,90)
    pos_ani = animation.FuncAnimation(fig_traj, update_pos, frames = np.shape(data)[1], fargs = (data,l),
                                  interval = 20, blit = True)
    pos_ani.save('AgentTrajectory.mp4')

data = pd.read_csv('xy_pos.csv', header = None, skiprows = [0])
data = np.asarray(data)
mark_on = [20, 50, 100, 300, 600]
traj_ani(data)
</code>```

Thanks!

Here is a complete, mini example of an animation that works:

```<code>import matplotlib
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import csv
import pandas as pd
import numpy as np

Writer = animation.writers['ffmpeg']
writer = Writer(fps=2000, metadata=dict(artist='Me'), bitrate=1800)

def update_pos(num,data,line):
    line.set_data(data[...,:num])
    return line,

def traj_ani(data):
    fig_traj = plt.figure()
    l,= plt.plot([],[],'b')
    plt.xlim(0,1)
    plt.ylim(0,1)
    pos_ani = animation.FuncAnimation(fig_traj, update_pos, frames = 25, fargs = (data,l),
                                  interval = 200, blit = True)
    pos_ani.save('AgentTrajectory.mp4')

data = np.random.rand(2,25)
traj_ani(data)
</code>```

In my full code, I would like to specify certain frames whose x-y coordinate should be marked with either a special character or by a different color.

答:
It seems problematic to set a list of indizes to markevery, which contains indices not present in the ploted array. E.g. if the plotted array has 3 elements but the list set for markevery contains an index 5, a ValueError occurs.

The solution would need to be to set the markevery list in every iteration and make sure it only contains valid indizes.

```<code>import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np

mark_on = np.array([2,5,6,13,17,24])

def update_pos(num,data,line):
    line.set_data(data[...,:num])
    mark = mark_on[mark_on < num]
    line.set_markevery(list(mark))
    return line,

def traj_ani(data):
    fig_traj = plt.figure()
    l,= plt.plot([],[],'b', markevery = [], marker = '*', mfc="red", mec="red", ms=15)
    plt.xlim(0,1)
    plt.ylim(0,1)
    pos_ani = animation.FuncAnimation(fig_traj, update_pos, frames = 25, fargs = (data,l),
                                  interval = 200, blit = True)
    plt.show()

data = np.random.rand(2,25)
traj_ani(data)
</code>```

Title: FuncAnimation difficulty with markevery

Body:
I would like to sequentially plot a series of x,y coordinates while marking specified coordinates distinctly. It seems that 'markevery' allows users to do this in matplotlib plots, however, when I provide this property in my animation, I receive the error 'ValueError: markevery is iterable but not a valid form of numpy fancy indexing'. Any thoughts?

My actual 'mark_on' array will be much longer, so I think that using a linecollection isn't reasonable here.

frames = 100
def update_pos(num,data,line):
    line.set_data(data[...,:num])
    return line,

def traj_ani(data):
    fig_traj = plt.figure()
    l,= plt.plot([],[],'b', markevery = mark_on, marker = '*')
    plt.xlim(-90,90)
    plt.ylim(-90,90)
    pos_ani = animation.FuncAnimation(fig_traj, update_pos, frames = np.shape(data)[1], fargs = (data,l),
                                  interval = 20, blit = True)
    pos_ani.save('AgentTrajectory.mp4')

data = pd.read_csv('xy_pos.csv', header = None, skiprows = [0])
data = np.asarray(data)
mark_on = [20, 50, 100, 300, 600]
traj_ani(data)

Thanks!

Here is a complete, mini example of an animation that works:

import matplotlib
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import csv
import pandas as pd
import numpy as np

Writer = animation.writers['ffmpeg']
writer = Writer(fps=2000, metadata=dict(artist='Me'), bitrate=1800)

def update_pos(num,data,line):
    line.set_data(data[...,:num])
    return line,

def traj_ani(data):
    fig_traj = plt.figure()
    l,= plt.plot([],[],'b')
    plt.xlim(0,1)
    plt.ylim(0,1)
    pos_ani = animation.FuncAnimation(fig_traj, update_pos, frames = 25, fargs = (data,l),
                                  interval = 200, blit = True)
    pos_ani.save('AgentTrajectory.mp4')

data = np.random.rand(2,25)
traj_ani(data)

In my full code, I would like to specify certain frames whose x-y coordinate should be marked with either a special character or by a different color.

Body:
It seems problematic to set a list of indizes to markevery, which contains indices not present in the ploted array. E.g. if the plotted array has 3 elements but the list set for markevery contains an index 5, a ValueError occurs.

The solution would need to be to set the markevery list in every iteration and make sure it only contains valid indizes.

import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np

mark_on = np.array([2,5,6,13,17,24])

def update_pos(num,data,line):
    line.set_data(data[...,:num])
    mark = mark_on[mark_on < num]
    line.set_markevery(list(mark))
    return line,

def traj_ani(data):
    fig_traj = plt.figure()
    l,= plt.plot([],[],'b', markevery = [], marker = '*', mfc="red", mec="red", ms=15)
    plt.xlim(0,1)
    plt.ylim(0,1)
    pos_ani = animation.FuncAnimation(fig_traj, update_pos, frames = 25, fargs = (data,l),
                                  interval = 200, blit = True)
    plt.show()

data = np.random.rand(2,25)
traj_ani(data)


问:
I'm new with angular.js, I just try to create a login form using angular.js

All working find when I try to login first time, but second time after logout submit button not working.

Can We do this code shorter and better way using anguler.js Please help

HTML

```<code><div ng-app="app">

    <div ng-controller="HttpGetController">
        <div ng-hide ="logedin">
            <p>User: <input type="text" name="firstName" ng-model="firstName" required /></p>
            <p>Password: <input type="text" name="lastName" ng-model="lastName" required /></p>
            <button ng-click="SendData()">Submit</button>
        </div>
        <div class="userDetail" ng-hide="userDetail">
                {{message.result[0].FIRST_NAME + " " + message.result[0].LAST_NAME}}
                <div class="logout"><a href="#" title="title" ng-click='logout()'>Logout</a></div>
        </div>
        </div>
</div>
</code>```

Javascript (angular)

```<code>var app = angular.module("app", []);
app.controller("HttpGetController", function ($scope, $http) {
    $scope.userDetail = true;
    if(!localStorage.getItem('logedin')){
        $scope.SendData = function () {
            var creds = 'username=' + $scope.firstName + '&password=' + $scope.lastName;
            var config = {
                headers : {
                    'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
                }
            }
            var res = $http.post('http://api.example.com/beta/login.php', creds, config);
            res.success(function(data, status, headers, config) {
                if(data.success){
                    $scope.logedin = true;
                    $scope.message = data;
                    localStorage.setItem("logedin", angular.toJson(data));
                    $scope.userDetail = false;
                } else {
                    alert(data.description);
                }
            });
        };
    } else {
        $scope.logedin = true;
        $scope.message = JSON.parse(localStorage.getItem('logedin'));
        $scope.userDetail = false;
    }
    $scope.logout = function(){
        window.localStorage.removeItem('logedin');
        $scope.logedin = false;
        $scope.userDetail = true;
    }
});
</code>```

答:
Please avoid using href="#" on your logout button.
Please try `

Logout

Body:
All working find when I try to login first time, but second time after logout submit button not working.

Can We do this code shorter and better way using anguler.js Please help

HTML

User: <input type="text" name="firstName" ng-model="firstName" required />

Password: <input type="text" name="lastName" ng-model="lastName" required />

            <button ng-click="SendData()">Submit</button>

                {{message.result[0].FIRST_NAME + " " + message.result[0].LAST_NAME}}

Logout

Javascript (angular)

var app = angular.module("app", []);
app.controller("HttpGetController", function ($scope, $http) {
    $scope.userDetail = true;
    if(!localStorage.getItem('logedin')){
        $scope.SendData = function () {
            var creds = 'username=' + $scope.firstName + '&password=' + $scope.lastName;
            var config = {
                headers : {
                    'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
                }
            }
            var res = $http.post('http://api.example.com/beta/login.php', creds, config);
            res.success(function(data, status, headers, config) {
                if(data.success){
                    $scope.logedin = true;
                    $scope.message = data;
                    localStorage.setItem("logedin", angular.toJson(data));
                    $scope.userDetail = false;
                } else {
                    alert(data.description);
                }
            });
        };
    } else {
        $scope.logedin = true;
        $scope.message = JSON.parse(localStorage.getItem('logedin'));
        $scope.userDetail = false;
    }
    $scope.logout = function(){
        window.localStorage.removeItem('logedin');
        $scope.logedin = false;
        $scope.userDetail = true;
    }
});

Body:
Please avoid using href="#" on your logout button.
Please try `

<a href="" title="title" ng-click='logout()'>Logout</a>


问:
facebook getuser returning 0 and An active access token must be used to query information about the current user
```<code>  try {
            $userProfile = $facebook->api('/me');
        } catch(\FacebookApiException $e) {
            $user = null;
             echo ($e);
        }

        if ($user) {

            $needEdit = false;

            if (empty($userProfile['email'])) {
                $needEdit = true;
            }

            $username = \Str::slug($userProfile['name']);
            $username = str_replace([' ','.', '-'], ['','', ''], $username);

            $details = [
                'fullname' => $userProfile['first_name']. ' '. $userProfile['last_name'],
                'country' => '',
                'email_address' => (isset($userProfile['email'])) ? $userProfile['email'] : '',
                'password' => time(),
                'username' => $username,
                'auth' => 'facebook',
                'authId' => $userProfile['id'],
                'avatar' => 'https://graph.facebook.com/'.$userProfile['id'].'/picture?type=large'
            ];

           $data=$this->socialauthRepository->isAMember($details['auth'],$details['authId']);
          $emailExists=$this->socialauthRepository->emailExists($details['email_address']);
                    if(count($emailExists)==0){
                    if(count($data)==0){
                        \View::share('details', $details);
                        //$this->setTitle(trans('home.welcome-to-our-social-network'));
                    //  return $this->theme->view('home.index', ['users' => app('App\\Repositories\\UserRepository')->latestUsers(8)])->render();
                    return $this->render('user.home.index', ['posts' => $this->postRepository->dashboardlists('trendzoops'),'celeblist'=> $this->PageRepository->allceleblists()],         ['title' => $this->setTitle('The Trending Zoops')]);

                    }else{
                        return $this->socialauthRepository->register($details);
                    }
                }else{
                    return $this->socialauthRepository->loginwithemailid($emailExists);
                }

        } else {
            $url = $facebook->getLoginUrl(['scope' => 'email','scope'=>'offline_access']);

            //return \Redirect::to($url);
        }
</code>```

Facebook Object ( [sharedSessionID:protected] => [appId:protected] => *************** [appSecret:protected] => ********************* [user:protected] => 0 [signedRequest:protected] => [state:protected] => 60575776c07d60aa8d37d8b7f92ca454 [accessToken:protected] => *********************|********************* [fileUploadSupport:protected] => [trustForwarded:protected] => [allowSignedRequest:protected] => 1 ) 0OAuthException: An active access token must be used to query information about the current user.

I am using this app in laravel for past 1 and half year but suddenly I am getting  $user = $facebook->getUser(); ie 0  . I have not changed  anything in the facebook setting  . As i am using artdarek/oauth-4-laravel and updated the composer also
but still getting zero only I have search each and every question but have not found my answer

I am using PHP Version 5.6.25

答:
I think you may be using Facebook API v2.3 that was only available upto March 25, 2017. you need to upgrade you facebook api version. I prefer you to go for Facebook API v2.8 that i available upto October 2018.

For details of API Date you can check here - Facebook getuser Returning zero

Body:
  try {
            $userProfile = $facebook->api('/me');
        } catch(\FacebookApiException $e) {
            $user = null;
             echo ($e);
        }

        if ($user) {

            $needEdit = false;

            if (empty($userProfile['email'])) {
                $needEdit = true;
            }

            $username = \Str::slug($userProfile['name']);
            $username = str_replace([' ','.', '-'], ['','', ''], $username);

            $details = [
                'fullname' => $userProfile['first_name']. ' '. $userProfile['last_name'],
                'country' => '',
                'email_address' => (isset($userProfile['email'])) ? $userProfile['email'] : '',
                'password' => time(),
                'username' => $username,
                'auth' => 'facebook',
                'authId' => $userProfile['id'],
                'avatar' => 'https://graph.facebook.com/'.$userProfile['id'].'/picture?type=large'
            ];

           $data=$this->socialauthRepository->isAMember($details['auth'],$details['authId']);
          $emailExists=$this->socialauthRepository->emailExists($details['email_address']);
                    if(count($emailExists)==0){
                    if(count($data)==0){
                        \View::share('details', $details);
                        //$this->setTitle(trans('home.welcome-to-our-social-network'));
                    //  return $this->theme->view('home.index', ['users' => app('App\\Repositories\\UserRepository')->latestUsers(8)])->render();
                    return $this->render('user.home.index', ['posts' => $this->postRepository->dashboardlists('trendzoops'),'celeblist'=> $this->PageRepository->allceleblists()],         ['title' => $this->setTitle('The Trending Zoops')]);

                    }else{
                        return $this->socialauthRepository->register($details);
                    }
                }else{
                    return $this->socialauthRepository->loginwithemailid($emailExists);
                }

        } else {
            $url = $facebook->getLoginUrl(['scope' => 'email','scope'=>'offline_access']);

            //return \Redirect::to($url);
        }

Facebook Object ( [sharedSessionID:protected] => [appId:protected] => *************** [appSecret:protected] => ********************* [user:protected] => 0 [signedRequest:protected] => [state:protected] => 60575776c07d60aa8d37d8b7f92ca454 [accessToken:protected] => *********************|********************* [fileUploadSupport:protected] => [trustForwarded:protected] => [allowSignedRequest:protected] => 1 ) 0OAuthException: An active access token must be used to query information about the current user.

I am using this app in laravel for past 1 and half year but suddenly I am getting  $user = $facebook->getUser(); ie 0  . I have not changed  anything in the facebook setting  . As i am using artdarek/oauth-4-laravel and updated the composer also
but still getting zero only I have search each and every question but have not found my answer

I am using PHP Version 5.6.25


问:
Angular2 Kendo UI Slider
Kendo Slider throwing the following error:

I am using an older version of slider in another project. Currently using Kendo Charts in this project without any issues.  Here is my setup:

Package.json

{
  "name": "angular-quickstart",
  "version": "1.0.0",
  "description": "QuickStart package.json from the documentation, supplemented with testing support",
  "scripts": {
    "build": "tsc -p src/",
    "build:watch": "tsc -p src/ -w",
    "build:e2e": "tsc -p e2e/",
    "serve": "lite-server -c=bs-config.json",
    "serve:e2e": "lite-server -c=bs-config.e2e.json",
    "prestart": "npm run build",
    "start": "concurrently \"npm run build:watch\" \"npm run serve\"",
    "pree2e": "npm run build:e2e",
    "e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first",
    "preprotractor": "webdriver-manager update",
    "protractor": "protractor protractor.config.js",
    "pretest": "npm run build",
    "test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"",
    "pretest:once": "npm run build",
    "test:once": "karma start karma.conf.js --single-run",
    "lint": "tslint ./src/**/*.ts -t verbose"
  },
  "keywords": [],
  "author": "",
  "license": "MIT",
  "dependencies": {
    "@angular/animations": "^4.0.0",
    "@angular/common": "~4.0.0",
    "@angular/compiler": "~4.0.0",
    "@angular/core": "~4.0.0",
    "@angular/forms": "~4.0.0",
    "@angular/http": "~4.0.0",
    "@angular/platform-browser": "~4.0.0",
    "@angular/platform-browser-dynamic": "~4.0.0",
    "@angular/router": "~4.0.0",
    "@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.22",
    "@progress/kendo-angular-charts": "^0.20.1",
    "@progress/kendo-angular-inputs": "^0.21.0",
    "@progress/kendo-angular-intl": "^0.11.1",
    "@progress/kendo-angular-l10n": "^0.2.1",
    "@progress/kendo-drawing": "^0.15.2",
    "@progress/kendo-theme-default": "^2.22.0",
    "angular-in-memory-web-api": "~0.3.0",
    "core-js": "^2.4.1",
    "hammerjs": "^2.0.8",
    "rxjs": "5.0.1",
    "systemjs": "0.19.40",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@types/jasmine": "2.5.36",
    "@types/node": "^6.0.46",
    "angular-2-dropdown-multiselect": "^1.0.5",
    "canonical-path": "0.0.2",
    "concurrently": "^3.2.0",
    "jasmine-core": "~2.4.1",
    "karma": "^1.3.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "lite-server": "^2.2.2",
    "lodash": "^4.16.4",
    "protractor": "~4.0.14",
    "rimraf": "^2.5.4",
    "tslint": "^3.15.1",
    "typescript": "~2.1.0"
  },
  "repository": {}
}```
</div>
</div>
</p>

<p>Systemjs.config.js</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>/**
 * System configuration for Angular samples
 * Adjust as necessary for your application needs.
 */
(function (global) {
  System.config({
    paths: {
      // paths serve as alias
      'npm:': 'node_modules/'
    },
    // map tells the System loader where to look for things
    map: {
      // our app is within the app folder
      'app': 'app',

      // angular bundles
      '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
      '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
      '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
      '@angular/animations': 'node_modules/@angular/animations/bundles/animations.umd.min.js',
      '@angular/animations/browser':'node_modules/@angular/animations/bundles/animations-browser.umd.js',
      '@angular/platform-browser/animations': 'node_modules/@angular/platform-browser/bundles/platform-browser-animations.umd.js',
      '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
      '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
      '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
      '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
      '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',

      // other libraries
      'rxjs': 'npm:rxjs',
      'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js'
    },
    // packages tells the System loader how to load when no filename and/or no extension
    packages: {
      app: {
        defaultExtension: 'js',
        meta: {
          './*.js': {
            loader: 'systemjs-angular-loader.js'
          }
        }
      },
      rxjs: {
        defaultExtension: 'js'
      }
    }
  });
})(this);</code>```

systemjs.config.extras.js

(function (global) {
  System.config({
    paths: {
      // paths serve as alias
      'npm:': 'node_modules/'
    },
    map: {
      'angular-2-dropdown-multiselect': 'npm:angular-2-dropdown-multiselect',
      '@ng-bootstrap/ng-bootstrap': 'node_modules/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js',

      '@progress/kendo-angular-charts': 'npm:@progress/kendo-angular-charts',
      '@progress/kendo-angular-inputs': 'npm:@progress/kendo-angular-inputs',
      '@progress/kendo-angular-popup': 'npm:@progress/kendo-angular-popup',
      '@progress/kendo-angular-resize-sensor': 'npm:@progress/kendo-angular-resize-sensor',
      '@telerik/kendo-inputs-common': 'npm:@telerik/kendo-inputs-common',
      '@progress/kendo-angular-l10n': 'npm:@progress/kendo-angular-l10n',
      '@progress/kendo-angular-intl': 'npm:@progress/kendo-angular-intl',
      '@telerik/kendo-draggable': 'npm:@telerik/kendo-draggable',
      '@progress/kendo-charts': 'npm:@progress/kendo-charts',
      '@telerik/kendo-intl': 'npm:@telerik/kendo-intl',
      '@progress/kendo-drawing': 'npm:@progress/kendo-drawing',
      '@progress/kendo-popup-common': 'npm:@progress/kendo-popup-common',

      // other libraries
      'hammerjs': 'npm:hammerjs'

    },
    packages: {
      'npm:angular-2-dropdown-multiselect': {
        main: './src/multiselect-dropdown.js',
        defaultExtension: 'js'
      },
      'npm:@progress/kendo-angular-inputs': {
        main: './dist/npm/main.js',
        defaultExtension: 'js'
      },
      'npm:@progress/kendo-angular-charts': {
        main: './dist/npm/main.js',
        defaultExtension: 'js'
      },
      'npm:hammerjs': {
        defaultExtension: 'js',
        main: "./hammer.min.js"
      },
      'npm:@progress/kendo-angular-popup': {
        main: './dist/npm/main.js',
        defaultExtension: 'js'
      },
      'npm:@progress/kendo-angular-resize-sensor': {
        main: './dist/npm/main.js',
        defaultExtension: 'js'
      },
      'npm:@telerik/kendo-inputs-common': {
        main: './dist/npm/main.js',
        defaultExtension: 'js'
      },
      '@progress/kendo-angular-l10n': {
        main: './dist/npm/main.js',
        defaultExtension: 'js'
      },

      'npm:@progress/kendo-angular-intl': {
        main: './dist/npm/main.js',
        defaultExtension: 'js'
      },

      'npm:@telerik/kendo-draggable': {
        main: './dist/npm/main.js',
        defaultExtension: 'js'
      },
      'npm:@progress/kendo-charts': {
        main: './dist/npm/main.js',
        defaultExtension: 'js'
      },

      'npm:@progress/kendo-drawing': {
        main: './dist/npm/main.js',
        defaultExtension: 'js'
      },

      'npm:@telerik/kendo-intl': {
        main: './dist/npm/main.js',
        defaultExtension: 'js'
      },
      'npm:@progress/kendo-popup-common': {
        main: './dist/npm/main.js',
        defaultExtension: 'js'
      },

    }
  });
})(this);```
</div>
</div>
</p>

<p>app.module</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HttpModule } from '@angular/http';
import { RouterModule } from '@angular/router';

import { NgbModule } from '@ng-bootstrap/ng-bootstrap';

import { AppComponent } from './app.component';
import { ActivityDashboardModule } from './activitydashboard/activitydashboard.module';
import { BudgetDashboardModule } from './budgetdashboard/budgetdashboard.module';

import { MenuComponent } from './shared/menu/menu.component';
import { WelcomeComponent } from './home/welcome.component';
import { AboutComponent } from './about/about.component';

import { DataService } from './shared/data.service';
import { ValuesService } from './shared/values.service';

@NgModule({
  imports: [BrowserModule,
    HttpModule,
    BrowserAnimationsModule,
    RouterModule.forRoot([
      { path: 'welcome', component: WelcomeComponent },
      { path: '', redirectTo: 'welcome', pathMatch: 'full' },
      { path: 'about', component: AboutComponent },
      { path: '**', redirectTo: 'welcome', pathMatch: 'full' },
    ]),
    NgbModule.forRoot(),
    ActivityDashboardModule,
    BudgetDashboardModule
    ],
  providers: [
    DataService,
    ValuesService,
  ],
  declarations:
  [AppComponent,
    WelcomeComponent,
    AboutComponent,
    MenuComponent],
  bootstrap: [AppComponent]
})
export class AppModule { }</code>```

Feature Modlule

import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';

import { NgbModule } from '@ng-bootstrap/ng-bootstrap';

import { SharedModule } from '../shared/shared.module';
import { SliderModule } from '@progress/kendo-angular-inputs';
import { ChartModule } from '@progress/kendo-angular-charts';

import 'hammerjs';

import { AppModule } from '../app.module';

import { ActivityDashboardDataService } from './activitydashboard-data.service';
import { ActivityDashboardComponent } from './activitydashboard.component';
import { ActivityPercentComponent } from './activitypercent/activity-percent.component';
import { MultiselectDropdownModule } from 'angular-2-dropdown-multiselect';

@NgModule({
  declarations: [ActivityDashboardComponent,
    ActivityPercentComponent,
  ],
  imports: [
    NgbModule,
    ChartModule,
    SliderModule,
    CommonModule,
    SharedModule,
    FormsModule,
    SharedModule,
    MultiselectDropdownModule,
    ReactiveFormsModule,
    RouterModule.forChild([
      { path: 'activitydashboard', component: ActivityDashboardComponent }
    ])
  ],
  providers: [
    ActivityDashboardDataService
  ]
})
export class ActivityDashboardModule { }```
</div>
</div>
</p>

<p>Trying to use the control in my component/template     </p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>  <kendo-slider></kendo-slider></code>```

Then the error. Any help would be greatly appreciated.

答: The error message does not seem to be Slider related as there is no croshair there. Anyway - a runnable sample would really help.</p>

Title: Angular2 Kendo UI Slider

Body:
Kendo Slider throwing the following error:

I am using an older version of slider in another project. Currently using Kendo Charts in this project without any issues.  Here is my setup:

Package.json

{
  "name": "angular-quickstart",
  "version": "1.0.0",
  "description": "QuickStart package.json from the documentation, supplemented with testing support",
  "scripts": {
    "build": "tsc -p src/",
    "build:watch": "tsc -p src/ -w",
    "build:e2e": "tsc -p e2e/",
    "serve": "lite-server -c=bs-config.json",
    "serve:e2e": "lite-server -c=bs-config.e2e.json",
    "prestart": "npm run build",
    "start": "concurrently \"npm run build:watch\" \"npm run serve\"",
    "pree2e": "npm run build:e2e",
    "e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first",
    "preprotractor": "webdriver-manager update",
    "protractor": "protractor protractor.config.js",
    "pretest": "npm run build",
    "test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"",
    "pretest:once": "npm run build",
    "test:once": "karma start karma.conf.js --single-run",
    "lint": "tslint ./src/**/*.ts -t verbose"
  },
  "keywords": [],
  "author": "",
  "license": "MIT",
  "dependencies": {
    "@angular/animations": "^4.0.0",
    "@angular/common": "~4.0.0",
    "@angular/compiler": "~4.0.0",
    "@angular/core": "~4.0.0",
    "@angular/forms": "~4.0.0",
    "@angular/http": "~4.0.0",
    "@angular/platform-browser": "~4.0.0",
    "@angular/platform-browser-dynamic": "~4.0.0",
    "@angular/router": "~4.0.0",
    "@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.22",
    "@progress/kendo-angular-charts": "^0.20.1",
    "@progress/kendo-angular-inputs": "^0.21.0",
    "@progress/kendo-angular-intl": "^0.11.1",
    "@progress/kendo-angular-l10n": "^0.2.1",
    "@progress/kendo-drawing": "^0.15.2",
    "@progress/kendo-theme-default": "^2.22.0",
    "angular-in-memory-web-api": "~0.3.0",
    "core-js": "^2.4.1",
    "hammerjs": "^2.0.8",
    "rxjs": "5.0.1",
    "systemjs": "0.19.40",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@types/jasmine": "2.5.36",
    "@types/node": "^6.0.46",
    "angular-2-dropdown-multiselect": "^1.0.5",
    "canonical-path": "0.0.2",
    "concurrently": "^3.2.0",
    "jasmine-core": "~2.4.1",
    "karma": "^1.3.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "lite-server": "^2.2.2",
    "lodash": "^4.16.4",
    "protractor": "~4.0.14",
    "rimraf": "^2.5.4",
    "tslint": "^3.15.1",
    "typescript": "~2.1.0"
  },
  "repository": {}
}

Systemjs.config.js

/**
 * System configuration for Angular samples
 * Adjust as necessary for your application needs.
 */
(function (global) {
  System.config({
    paths: {
      // paths serve as alias
      'npm:': 'node_modules/'
    },
    // map tells the System loader where to look for things
    map: {
      // our app is within the app folder
      'app': 'app',

      // angular bundles
      '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
      '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
      '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
      '@angular/animations': 'node_modules/@angular/animations/bundles/animations.umd.min.js',
      '@angular/animations/browser':'node_modules/@angular/animations/bundles/animations-browser.umd.js',
      '@angular/platform-browser/animations': 'node_modules/@angular/platform-browser/bundles/platform-browser-animations.umd.js',
      '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
      '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
      '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
      '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
      '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',

      // other libraries
      'rxjs': 'npm:rxjs',
      'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js'
    },
    // packages tells the System loader how to load when no filename and/or no extension
    packages: {
      app: {
        defaultExtension: 'js',
        meta: {
          './*.js': {
            loader: 'systemjs-angular-loader.js'
          }
        }
      },
      rxjs: {
        defaultExtension: 'js'
      }
    }
  });
})(this);

systemjs.config.extras.js

(function (global) {
  System.config({
    paths: {
      // paths serve as alias
      'npm:': 'node_modules/'
    },
    map: {
      'angular-2-dropdown-multiselect': 'npm:angular-2-dropdown-multiselect',
      '@ng-bootstrap/ng-bootstrap': 'node_modules/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js',

      '@progress/kendo-angular-charts': 'npm:@progress/kendo-angular-charts',
      '@progress/kendo-angular-inputs': 'npm:@progress/kendo-angular-inputs',
      '@progress/kendo-angular-popup': 'npm:@progress/kendo-angular-popup',
      '@progress/kendo-angular-resize-sensor': 'npm:@progress/kendo-angular-resize-sensor',
      '@telerik/kendo-inputs-common': 'npm:@telerik/kendo-inputs-common',
      '@progress/kendo-angular-l10n': 'npm:@progress/kendo-angular-l10n',
      '@progress/kendo-angular-intl': 'npm:@progress/kendo-angular-intl',
      '@telerik/kendo-draggable': 'npm:@telerik/kendo-draggable',
      '@progress/kendo-charts': 'npm:@progress/kendo-charts',
      '@telerik/kendo-intl': 'npm:@telerik/kendo-intl',
      '@progress/kendo-drawing': 'npm:@progress/kendo-drawing',
      '@progress/kendo-popup-common': 'npm:@progress/kendo-popup-common',

      // other libraries
      'hammerjs': 'npm:hammerjs'

    },
    packages: {
      'npm:angular-2-dropdown-multiselect': {
        main: './src/multiselect-dropdown.js',
        defaultExtension: 'js'
      },
      'npm:@progress/kendo-angular-inputs': {
        main: './dist/npm/main.js',
        defaultExtension: 'js'
      },
      'npm:@progress/kendo-angular-charts': {
        main: './dist/npm/main.js',
        defaultExtension: 'js'
      },
      'npm:hammerjs': {
        defaultExtension: 'js',
        main: "./hammer.min.js"
      },
      'npm:@progress/kendo-angular-popup': {
        main: './dist/npm/main.js',
        defaultExtension: 'js'
      },
      'npm:@progress/kendo-angular-resize-sensor': {
        main: './dist/npm/main.js',
        defaultExtension: 'js'
      },
      'npm:@telerik/kendo-inputs-common': {
        main: './dist/npm/main.js',
        defaultExtension: 'js'
      },
      '@progress/kendo-angular-l10n': {
        main: './dist/npm/main.js',
        defaultExtension: 'js'
      },

      'npm:@progress/kendo-angular-intl': {
        main: './dist/npm/main.js',
        defaultExtension: 'js'
      },

      'npm:@telerik/kendo-draggable': {
        main: './dist/npm/main.js',
        defaultExtension: 'js'
      },
      'npm:@progress/kendo-charts': {
        main: './dist/npm/main.js',
        defaultExtension: 'js'
      },

      'npm:@progress/kendo-drawing': {
        main: './dist/npm/main.js',
        defaultExtension: 'js'
      },

      'npm:@telerik/kendo-intl': {
        main: './dist/npm/main.js',
        defaultExtension: 'js'
      },
      'npm:@progress/kendo-popup-common': {
        main: './dist/npm/main.js',
        defaultExtension: 'js'
      },

    }
  });
})(this);

app.module

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HttpModule } from '@angular/http';
import { RouterModule } from '@angular/router';

import { NgbModule } from '@ng-bootstrap/ng-bootstrap';

import { AppComponent } from './app.component';
import { ActivityDashboardModule } from './activitydashboard/activitydashboard.module';
import { BudgetDashboardModule } from './budgetdashboard/budgetdashboard.module';

import { MenuComponent } from './shared/menu/menu.component';
import { WelcomeComponent } from './home/welcome.component';
import { AboutComponent } from './about/about.component';

import { DataService } from './shared/data.service';
import { ValuesService } from './shared/values.service';

@NgModule({
  imports: [BrowserModule,
    HttpModule,
    BrowserAnimationsModule,
    RouterModule.forRoot([
      { path: 'welcome', component: WelcomeComponent },
      { path: '', redirectTo: 'welcome', pathMatch: 'full' },
      { path: 'about', component: AboutComponent },
      { path: '**', redirectTo: 'welcome', pathMatch: 'full' },
    ]),
    NgbModule.forRoot(),
    ActivityDashboardModule,
    BudgetDashboardModule
    ],
  providers: [
    DataService,
    ValuesService,
  ],
  declarations:
  [AppComponent,
    WelcomeComponent,
    AboutComponent,
    MenuComponent],
  bootstrap: [AppComponent]
})
export class AppModule { }

Feature Modlule

import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';

import { NgbModule } from '@ng-bootstrap/ng-bootstrap';

import { SharedModule } from '../shared/shared.module';
import { SliderModule } from '@progress/kendo-angular-inputs';
import { ChartModule } from '@progress/kendo-angular-charts';

import 'hammerjs';

import { AppModule } from '../app.module';

import { ActivityDashboardDataService } from './activitydashboard-data.service';
import { ActivityDashboardComponent } from './activitydashboard.component';
import { ActivityPercentComponent } from './activitypercent/activity-percent.component';
import { MultiselectDropdownModule } from 'angular-2-dropdown-multiselect';

@NgModule({
  declarations: [ActivityDashboardComponent,
    ActivityPercentComponent,
  ],
  imports: [
    NgbModule,
    ChartModule,
    SliderModule,
    CommonModule,
    SharedModule,
    FormsModule,
    SharedModule,
    MultiselectDropdownModule,
    ReactiveFormsModule,
    RouterModule.forChild([
      { path: 'activitydashboard', component: ActivityDashboardComponent }
    ])
  ],
  providers: [
    ActivityDashboardDataService
  ]
})
export class ActivityDashboardModule { }

Trying to use the control in my component/template

  <kendo-slider></kendo-slider>

Then the error. Any help would be greatly appreciated.


问:
Can't generate signed APK in Android Studio, 'java.io.IOException'
I have a problem with generating signed APK in Android Studio. It was working fine few days ago, I dont know what went wrong. I'm getting this error for any project I try to fgenerate signed APK of:

Warning:Exception while processing task java.io.IOException: Can't write [/Users/bhaveshmisri/Downloads/littleone-dagger-mvp/app/build/intermediates/transforms/proguard/release/jars/3/1f/main.jar] (Can't read [/Users/bhaveshmisri/Downloads/littleone-dagger-mvp/app/build/intermediates/transforms/RealmTransformer/release/folders/1/1/realm(;;;;;;**.class)] (Can't read [com] (Can't read [crashlytics] (Can't read [android] (Can't read [answers] (Can't read [shim] (Can't read [R.class] (Duplicate zip entry [com/crashlytics/android/answers/shim/R.class]))))))))

Here is my buildTypes Task:

```<code>buildTypes {
    debug {
        shrinkResources false // This must be first
        minifyEnabled false   // This must be after shrinkResources
        multiDexEnabled true
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules-debug.pro"
    }
    release {
        shrinkResources true
        minifyEnabled true
        useProguard true
        multiDexEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), "proguard-rules.pro"
    }
}
</code>```

Here is the code I've written in proguard file:

```<code>-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-verbose
-dump class_files.txt
-printseeds seeds.txt
-printusage unused.txt
-printmapping mapping.txt
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-allowaccessmodification
-keepattributes *Annotation*
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
-keepattributes Signature
-keepattributes Exceptions
-repackageclasses ''

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class * extends android.app.
-keep public class com.android.vending.licensing.ILicensingService

-keep class com.google.common.collect.MapMakerInternalMap$ReferenceEntry
-keep class com.google.common.cache.LocalCache$ReferenceEntry

-dontnote com.android.vending.licensing.ILicensingService

-keepclassmembers class * implements java.io.Serializable {
    static final long serialVersionUID;
    private static final java.io.ObjectStreamField[] serialPersistentFields;
    private void writeObject(java.io.ObjectOutputStream);
    private void readObject(java.io.ObjectInputStream);
    java.lang.Object writeReplace();
    java.lang.Object readResolve();
}

-keepclasseswithmembernames class * {
    native <methods>;
}

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers class **.R$* {
  public static <fields>;
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep public class * {
    public protected *;
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

-dontwarn android.support.v7.**
-keep class android.support.v7.** { *; }
-keep interface android.support.v7.* { *; }
-keepattributes *Annotation,Signature
-dontwarn in.mylo.pregnancy.baby.app.**
-keep class in.mylo.pregnancy.baby.app.shapeimageview.**{ *; }

-keep class android.support.v4.app.** { *; }
-keep interface android.support.v4.app.** { *; }
-keep interface com.actionbarsherlock.** { *; }

-keep class butterknife.*
-keepclasseswithmembernames class * {
 @butterknife.* <methods>; }
-keepclasseswithmembernames class * {
 @butterknife.* <fields>; }

-dontwarn javax.annotation.**
-dontwarn javax.inject.**
-dontwarn sun.misc.Unsafe

-dontwarn java.lang.ClassValue
-dontwarn com.google.j2objc.annotations.Weak
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
  **[] $VALUES;
  public *;
}

-dontwarn com.firebase.**
-dontnote com.firebase.client.core.GaePlatform

-keep class com.firebase.** { *; }

-keepnames class com.fasterxml.jackson.** { *; }
-keepnames class javax.servlet.** { *; }
-keepnames class org.ietf.jgss.** { *; }

-dontwarn com.clevertap.android.sdk.**

-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**
-dontnote okhttp3.**

-keep class sun.misc.Unsafe { *; }
-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

-keepclassmembers class * extends android.app.Activity {
   public void *(android.view.View);
}
-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}
-keepclassmembers class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator CREATOR;
}
-keepclassmembers class **.R$* {
    public static <fields>;
}

-dontwarn android.support.**

-dontwarn com.google.android.gms.**

-dontwarn com.fasterxml.**
-dontwarn okio.**
-dontwarn com.caverock.**
-dontwarn com.github.siyamed.shapeimageview.**

-dontwarn retrofit.**
-keep class retrofit.** { *; }
-dontwarn sun.misc.Unsafe
-dontwarn com.octo.android.robospice.retrofit.RetrofitJackson**
-dontwarn retrofit.appengine.UrlFetchClient
-keepattributes Signature
-keepattributes Exceptions
-keepclasseswithmembers class * {
    @retrofit.http.* <methods>;
}
-keep class com.google.gson.** { *; }
-keep class com.google.inject.** { *; }
-keep class org.apache.http.** { *; }
-keep class org.apache.james.mime4j.** { *; }
-keep class javax.inject.** { *; }
-keep class retrofit.** { *; }
-keep class retrofit2.** { *; }
-dontwarn org.apache.http.**
-dontwarn android.net.http.AndroidHttpClient
-dontwarn retrofit.**
-dontwarn retrofit2.**

-dontwarn sun.misc.**

-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
   long producerIndex;
   long consumerIndex;
}

-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
   long producerNode;
   long consumerNode;
}

-keep class in.mylo.pregnancy.baby.app.retrofit.** { *; }

-keep interface org.parceler.Parcel
-keep @org.parceler.Parcel class * { *; }
-keep class **$$Parcelable { *; }

-keepnames public class * extends io.realm.RealmObject
-keep @io.realm.annotations.RealmModule class *
-keep class io.realm.** { *; }
-dontwarn javax.**
-dontwarn io.realm.**

-keepnames public class * extends io.realm.RealmObject

-dontwarn com.google.android.gms.location.**
-dontwarn com.google.android.gms.gcm.**
-dontwarn com.google.android.gms.iid.**

-keep class com.google.android.gms.gcm.** { *; }
-keep class com.google.android.gms.iid.** { *; }
-keep class com.google.android.gms.location.** { *; }

-keep class com.moe.pushlibrary.activities.** { *; }
-keep class com.moengage.locationlibrary.GeofenceIntentService
-keep class com.moe.pushlibrary.InstallReceiver
-keep class com.moengage.push.MoEPushWorker
-keep class com.moe.pushlibrary.providers.MoEProvider
-keep class com.moengage.receiver.MoEInstanceIDListener
-keep class com.moengage.worker.MoEGCMListenerService
-keep class com.moe.pushlibrary.models.** { *;}
-keep class com.moengage.core.GeoTask
-keep class com.moengage.location.GeoManager
-keep class com.moengage.inapp.InAppManager
-keep class com.moengage.push.PushManager
-keep class com.moengage.inapp.InAppController

-dontwarn com.moengage.location.GeoManager
-dontwarn com.moengage.core.GeoTask
-dontwarn com.moengage.receiver.*
-dontwarn com.moengage.worker.*
-dontwarn com.moengage.inapp.ViewEngine

-keep class com.delight.**  { *; }

-dontwarn com.google.android.gms.location.**
-keep class com.moe.** { *; }
-keep class com.moengage.** { *; }
-keep class com.delight.** { *; }

-keep class com.google.android.gms.ads.** { *; }

-keep class com.facebook.** {
   *;
}

-dontwarn android.databinding.**
-keep class android.databinding.** { *; }
</code>```

Any help appreciated, thanks in advance.

答:
Try to add below line in your proguard file to ignore warning that you are getting as above.</p>

```<code>-dontwarn com.crashlytics.android.answers.shim.**
</code>```

Body:
I have a problem with generating signed APK in Android Studio. It was working fine few days ago, I dont know what went wrong. I'm getting this error for any project I try to fgenerate signed APK of:

Warning:Exception while processing task java.io.IOException: Can't write [/Users/bhaveshmisri/Downloads/littleone-dagger-mvp/app/build/intermediates/transforms/proguard/release/jars/3/1f/main.jar] (Can't read [/Users/bhaveshmisri/Downloads/littleone-dagger-mvp/app/build/intermediates/transforms/RealmTransformer/release/folders/1/1/realm(;;;;;;**.class)] (Can't read [com] (Can't read [crashlytics] (Can't read [android] (Can't read [answers] (Can't read [shim] (Can't read [R.class] (Duplicate zip entry [com/crashlytics/android/answers/shim/R.class]))))))))

Here is my buildTypes Task:

buildTypes {
    debug {
        shrinkResources false // This must be first
        minifyEnabled false   // This must be after shrinkResources
        multiDexEnabled true
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules-debug.pro"
    }
    release {
        shrinkResources true
        minifyEnabled true
        useProguard true
        multiDexEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), "proguard-rules.pro"
    }
}

Here is the code I've written in proguard file:

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-verbose
-dump class_files.txt
-printseeds seeds.txt
-printusage unused.txt
-printmapping mapping.txt
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-allowaccessmodification
-keepattributes *Annotation*
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
-keepattributes Signature
-keepattributes Exceptions
-repackageclasses ''

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class * extends android.app.
-keep public class com.android.vending.licensing.ILicensingService

-keep class com.google.common.collect.MapMakerInternalMap$ReferenceEntry
-keep class com.google.common.cache.LocalCache$ReferenceEntry

-dontnote com.android.vending.licensing.ILicensingService

-keepclassmembers class * implements java.io.Serializable {
    static final long serialVersionUID;
    private static final java.io.ObjectStreamField[] serialPersistentFields;
    private void writeObject(java.io.ObjectOutputStream);
    private void readObject(java.io.ObjectInputStream);
    java.lang.Object writeReplace();
    java.lang.Object readResolve();
}

-keepclasseswithmembernames class * {
    native <methods>;
}

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers class **.R$* {
  public static <fields>;
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep public class * {
    public protected *;
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

-dontwarn android.support.v7.**
-keep class android.support.v7.** { *; }
-keep interface android.support.v7.* { *; }
-keepattributes *Annotation,Signature
-dontwarn in.mylo.pregnancy.baby.app.**
-keep class in.mylo.pregnancy.baby.app.shapeimageview.**{ *; }

-keep class android.support.v4.app.** { *; }
-keep interface android.support.v4.app.** { *; }
-keep interface com.actionbarsherlock.** { *; }

-keep class butterknife.*
-keepclasseswithmembernames class * {
 @butterknife.* <methods>; }
-keepclasseswithmembernames class * {
 @butterknife.* <fields>; }

-dontwarn javax.annotation.**
-dontwarn javax.inject.**
-dontwarn sun.misc.Unsafe

-dontwarn java.lang.ClassValue
-dontwarn com.google.j2objc.annotations.Weak
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
  **[] $VALUES;
  public *;
}

-dontwarn com.firebase.**
-dontnote com.firebase.client.core.GaePlatform

-keep class com.firebase.** { *; }

-keepnames class com.fasterxml.jackson.** { *; }
-keepnames class javax.servlet.** { *; }
-keepnames class org.ietf.jgss.** { *; }

-dontwarn com.clevertap.android.sdk.**

-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**
-dontnote okhttp3.**

-keep class sun.misc.Unsafe { *; }
-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

-keepclassmembers class * extends android.app.Activity {
   public void *(android.view.View);
}
-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}
-keepclassmembers class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator CREATOR;
}
-keepclassmembers class **.R$* {
    public static <fields>;
}

-dontwarn android.support.**

-dontwarn com.google.android.gms.**

-dontwarn com.fasterxml.**
-dontwarn okio.**
-dontwarn com.caverock.**
-dontwarn com.github.siyamed.shapeimageview.**

-dontwarn retrofit.**
-keep class retrofit.** { *; }
-dontwarn sun.misc.Unsafe
-dontwarn com.octo.android.robospice.retrofit.RetrofitJackson**
-dontwarn retrofit.appengine.UrlFetchClient
-keepattributes Signature
-keepattributes Exceptions
-keepclasseswithmembers class * {
    @retrofit.http.* <methods>;
}
-keep class com.google.gson.** { *; }
-keep class com.google.inject.** { *; }
-keep class org.apache.http.** { *; }
-keep class org.apache.james.mime4j.** { *; }
-keep class javax.inject.** { *; }
-keep class retrofit.** { *; }
-keep class retrofit2.** { *; }
-dontwarn org.apache.http.**
-dontwarn android.net.http.AndroidHttpClient
-dontwarn retrofit.**
-dontwarn retrofit2.**

-dontwarn sun.misc.**

-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
   long producerIndex;
   long consumerIndex;
}

-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
   long producerNode;
   long consumerNode;
}

-keep class in.mylo.pregnancy.baby.app.retrofit.** { *; }

-keep interface org.parceler.Parcel
-keep @org.parceler.Parcel class * { *; }
-keep class **$$Parcelable { *; }

-keepnames public class * extends io.realm.RealmObject
-keep @io.realm.annotations.RealmModule class *
-keep class io.realm.** { *; }
-dontwarn javax.**
-dontwarn io.realm.**

-keepnames public class * extends io.realm.RealmObject

-dontwarn com.google.android.gms.location.**
-dontwarn com.google.android.gms.gcm.**
-dontwarn com.google.android.gms.iid.**

-keep class com.google.android.gms.gcm.** { *; }
-keep class com.google.android.gms.iid.** { *; }
-keep class com.google.android.gms.location.** { *; }

-keep class com.moe.pushlibrary.activities.** { *; }
-keep class com.moengage.locationlibrary.GeofenceIntentService
-keep class com.moe.pushlibrary.InstallReceiver
-keep class com.moengage.push.MoEPushWorker
-keep class com.moe.pushlibrary.providers.MoEProvider
-keep class com.moengage.receiver.MoEInstanceIDListener
-keep class com.moengage.worker.MoEGCMListenerService
-keep class com.moe.pushlibrary.models.** { *;}
-keep class com.moengage.core.GeoTask
-keep class com.moengage.location.GeoManager
-keep class com.moengage.inapp.InAppManager
-keep class com.moengage.push.PushManager
-keep class com.moengage.inapp.InAppController

-dontwarn com.moengage.location.GeoManager
-dontwarn com.moengage.core.GeoTask
-dontwarn com.moengage.receiver.*
-dontwarn com.moengage.worker.*
-dontwarn com.moengage.inapp.ViewEngine

-keep class com.delight.**  { *; }

-dontwarn com.google.android.gms.location.**
-keep class com.moe.** { *; }
-keep class com.moengage.** { *; }
-keep class com.delight.** { *; }

-keep class com.google.android.gms.ads.** { *; }

-keep class com.facebook.** {
   *;
}

-dontwarn android.databinding.**
-keep class android.databinding.** { *; }

Any help appreciated, thanks in advance.

Body:
Try to add below line in your proguard file to ignore warning that you are getting as above.

-dontwarn com.crashlytics.android.answers.shim.**


问:
Http2 Server Push support
Quick question/clarification on using Server Push with Http2.

So, I installed libnghttp2, then compiled Apache 2.4.18 from source with http2 support and created some self signed certs to use https.

I then added in directive Protocols h2c http/1.1 and created a vhost including:

```<code><Location /index.html>
    Header add Link "</css/site.css>;rel=preload"
</Location>
</code>```

so I can test Server Push. Hitting my front end with Firefox I get the h2 header returned as well as a Link Header that's value is /css/site.css but my css isnt preloaded..
Not sure if I am fundamentally misunderstanding what Server Push is doing or not doing or whether I have done something wrong.

I've tried with a few variations of the css value and location value but with no success. Been googling for a while, but to no avail, so any point in the right direction would be great.

答:
you can try again:

```<code><Location /index.html>
Header add Link "</css/site.css>;rel=preload;as=style"
</code>```

if you want to push image you should use " as=image"

Title: Http2 Server Push support

Body:
Quick question/clarification on using Server Push with Http2.

So, I installed libnghttp2, then compiled Apache 2.4.18 from source with http2 support and created some self signed certs to use https.

I then added in directive Protocols h2c http/1.1 and created a vhost including:

<Location /index.html>
    Header add Link "</css/site.css>;rel=preload"
</Location>

so I can test Server Push. Hitting my front end with Firefox I get the h2 header returned as well as a Link Header that's value is /css/site.css but my css isnt preloaded..
Not sure if I am fundamentally misunderstanding what Server Push is doing or not doing or whether I have done something wrong.

I've tried with a few variations of the css value and location value but with no success. Been googling for a while, but to no avail, so any point in the right direction would be great.

Body:
you can try again:

<Location /index.html>
Header add Link "</css/site.css>;rel=preload;as=style"

if you want to push image you should use " as=image"


问:
Laravel Displays a blank screen after deploying to goddady servers
Am new to Laravel, actually I've not been able to upload any laravel project on a remote server and it worked.
I've been working on my localhost for my projects for quit sometime, on install on laravel rom local host, I had the same problem but just had to change the permissions of the storage folder. but on the remote server, i tried changing the permissions but every thing failed.</p>

答:
please try the following.

```<code>1.Open-> bootstrap (folder) ->app.php (file)
   change existing realpath to  realpath(__DIR__.'/../')

2. take all the contents of "public" folder to the project root folder

3. open index.php in project root folder -> change existing code to "require __DIR__.'/bootstrap/autoload.php';"

4. change existing code to $app = require_once __DIR__.'/bootstrap/app.php';
</code>```

This has got nothing to do with file permissions or anything.

I hope this may solve your issue.

Body:
please try the following.

1.Open-> bootstrap (folder) ->app.php (file)
   change existing realpath to  realpath(__DIR__.'/../')

2. take all the contents of "public" folder to the project root folder

3. open index.php in project root folder -> change existing code to "require __DIR__.'/bootstrap/autoload.php';"

4. change existing code to $app = require_once __DIR__.'/bootstrap/app.php';

This has got nothing to do with file permissions or anything.

I hope this may solve your issue.


问:
bootstrap list button right
Hello I have list in bootstrap:

```<code><h4><i class="fa fa-flag" aria-hidden="true"></i> 2</h4>
    <ul id="filter-version" class="filter multiple-select term-list">
        <li data-id="3">
            <a href="#">a</a>
        </li>
        <li data-id="1">
            <a href="#">b</a>
        </li>
        <li data-id="2">
            <a href="#">c</a>
        </li>
    </ul><button class="btn btn-default btn-sm more-less">Więcej</button>

    <span class="btn btn-default btn-sm start-filter" data-filter="version">Pokaż</span>
</code>```

How can i align properly "Więcej" and "Pokaż" to the right? If i use float: right then the buttons are in same line as "1,2,3,4".

Thanks.

```<code>http://jsfiddle.net/C2K9Z/156/
</code>```

答:
```<code><h4><i class="fa fa-flag" aria-hidden="true"></i> 2</h4>
<ul id="filter-version" class="filter multiple-select term-list">
    <li data-id="3">
        <a href="#">a</a>
    </li>
    <li data-id="1">
        <a href="#">b</a>
    </li>
    <li data-id="2">
        <a href="#">c</a>
    </li>
</ul>
<button class="btn btn-default btn-sm more-less" style="float:right">Więcej</button>

<span class="btn btn-default btn-sm start-filter" data-filter="version" style="float:right">Pokaż</span><br/>
</code>```

Title: bootstrap list button right

Body:
Hello I have list in bootstrap:

 2

            a

            b

            c

<button class="btn btn-default btn-sm more-less">Więcej</button>

    Pokaż

How can i align properly "Więcej" and "Pokaż" to the right? If i use float: right then the buttons are in same line as "1,2,3,4".

Thanks.

http://jsfiddle.net/C2K9Z/156/


问:
Adding an attribute to a transcluded element
I have a form directive that extends the ability of HTML form tag that I maintain to add behaviours to it . Given below is one use of it ,

```<code>     return {
        restrict: 'E',
        replace: true,
        transclude: 'element',
        template: '<fieldset ng-disabled="formLoading" ng-transclude></fieldset>',
        link: function (scope, elem, attr, ctrl, transclude) {
            // elem.on('submit', function () {
            //     $rootScope.formLoading = true;
            // });
        }
    }
</code>```

Above I transclude the form to contain inside a fieldset so that the user cannot interact with the form if the form is loading .

Now If i want to add an autocomplete off attribute to the form that is transcluded , What would be the right way to do it ?

答:
Well, this worked for me .

```<code>        link: function (scope, elem, attr, ctrl, transclude) {
            angular.element(elem[0].firstChild).attr('autocomplete', 'off')
        }
</code>```

In here transcluded element is the firstChild of the element.

Body:
I have a form directive that extends the ability of HTML form tag that I maintain to add behaviours to it . Given below is one use of it ,

     return {
        restrict: 'E',
        replace: true,
        transclude: 'element',
        template: '<fieldset ng-disabled="formLoading" ng-transclude></fieldset>',
        link: function (scope, elem, attr, ctrl, transclude) {
            // elem.on('submit', function () {
            //     $rootScope.formLoading = true;
            // });
        }
    }

Above I transclude the form to contain inside a fieldset so that the user cannot interact with the form if the form is loading .

Now If i want to add an autocomplete off attribute to the form that is transcluded , What would be the right way to do it ?

Body:
Well, this worked for me .

        link: function (scope, elem, attr, ctrl, transclude) {
            angular.element(elem[0].firstChild).attr('autocomplete', 'off')
        }

In here transcluded element is the firstChild of the element.


问:
Array of observables type
I am just curious, what will be the correct type of Observables array?

I tried:

```<code>let myObservables: Observable[] = new Array();
let myObservables: Observable<Array<any>> = new Array();
let myObservables: Observable<[]> = new Array();
</code>```

but none of them are working.

I just want an array in which i can push observables so that i can pass it to Observable.forkJoin(myObservables)

答:
Okay i found it. The following are two correct ways to do it:

```<code>let myObservables: Observable<any>[] = new Array();
let myObservables: Array<Observable<any>> = new Array();
</code>```

If anyone finds it helpful :)

Title: Array of observables type

Body:
I am just curious, what will be the correct type of Observables array?

I tried:

let myObservables: Observable[] = new Array();
let myObservables: Observable<Array<any>> = new Array();
let myObservables: Observable<[]> = new Array();

but none of them are working.

I just want an array in which i can push observables so that i can pass it to Observable.forkJoin(myObservables)

Body:
Okay i found it. The following are two correct ways to do it:

let myObservables: Observable<any>[] = new Array();
let myObservables: Array<Observable<any>> = new Array();

If anyone finds it helpful :)


问:
Wordpress set value from input field as comment author for logged in users
I have a shared account, lets call it "marketing".
Now I have three people using this account named Anna, Ben and Max.

When someone logs into this account and wants to type a comment with their name, it always shows the name "marketing" as author. How can I change this so that I put a name in my input field and I get the value from this as my comment author. In my comments.php I do not check if the user is logged on and call it here:

```<code><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="2"/>
</code>```

I tried to make following in my functions.php:

```<code>function change_author( $commentdata ) {
    if ( $commentdata['user_ID'] == 2 ) {  // User ID for Marketing

    $commentdata['user_ID'] = 0;
    $commentdata['comment_author'] = '';

  }

  return $commentdata;
}
add_filter( 'preprocess_comment' , 'change_author' );
</code>```

In this case my comment_author will always be Anonymous and also if I set it to NULL.

When i give the variable a value $commentdata['comment_author'] = 'test';
I get "test" as my comment_author but as I said, I would like to have the value I set in my input field. It works for not logged in users very well so I thought there might be a trick for logged in users as well.

In phpMyAdmin I checked for the entries in the database and it is giving me the right values for ID etc. But it also empties the comment_author field which results in an anonymous author.

I really hope that somebody can give me the right hint to accomplish this task.

答:
Goddamit, I didn't know that this was so f***ing easy.

```<code>function change_author( $commentdata ) {

    if ( $commentdata['user_ID'] == 2 ) {

    $commentdata['user_ID'] = 0;
    $commentdata['comment_author'] = $_POST['author'];
    $commentdata['comment_author_email'] = '';
    $commentdata['comment_author_url'] = '';

  }

  return $commentdata;
}
add_filter( 'preprocess_comment' , 'change_author' );
</code>```

I think this would work also with != 0 instead of == 2.
This is just a solution for my custom theme but I think it would also work with

```<code>$commentdata['comment_author_email'] = $_POST['mail'];
$commentdata['comment_author_url'] = $_POST['url'];
</code>```

Note: the value in $_POST[] is either the name or the ID from the
  input field. Didn't test everything because name and ID have the same
  value in my theme.

Tested it a few times local and it worked very well!

Body:
I have a shared account, lets call it "marketing".
Now I have three people using this account named Anna, Ben and Max.

When someone logs into this account and wants to type a comment with their name, it always shows the name "marketing" as author. How can I change this so that I put a name in my input field and I get the value from this as my comment author. In my comments.php I do not check if the user is logged on and call it here:

<input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="2"/>

I tried to make following in my functions.php:

function change_author( $commentdata ) {
    if ( $commentdata['user_ID'] == 2 ) {  // User ID for Marketing

    $commentdata['user_ID'] = 0;
    $commentdata['comment_author'] = '';

  }

  return $commentdata;
}
add_filter( 'preprocess_comment' , 'change_author' );

In this case my comment_author will always be Anonymous and also if I set it to NULL.

When i give the variable a value $commentdata['comment_author'] = 'test';
I get "test" as my comment_author but as I said, I would like to have the value I set in my input field. It works for not logged in users very well so I thought there might be a trick for logged in users as well.

In phpMyAdmin I checked for the entries in the database and it is giving me the right values for ID etc. But it also empties the comment_author field which results in an anonymous author.

I really hope that somebody can give me the right hint to accomplish this task.

Body:
Goddamit, I didn't know that this was so f***ing easy.

function change_author( $commentdata ) {

    if ( $commentdata['user_ID'] == 2 ) {

    $commentdata['user_ID'] = 0;
    $commentdata['comment_author'] = $_POST['author'];
    $commentdata['comment_author_email'] = '';
    $commentdata['comment_author_url'] = '';

  }

  return $commentdata;
}
add_filter( 'preprocess_comment' , 'change_author' );

I think this would work also with != 0 instead of == 2.
This is just a solution for my custom theme but I think it would also work with

$commentdata['comment_author_email'] = $_POST['mail'];
$commentdata['comment_author_url'] = $_POST['url'];

Note: the value in $_POST[] is either the name or the ID from the
  input field. Didn't test everything because name and ID have the same
  value in my theme.

Tested it a few times local and it worked very well!


问:
VBA code to compare first column of muliple spreedsheet in a excel file
Hi i am new to VBA need help, I have one excel file with multiple spreadsheet.
I want to compare first column of first spreadsheet(Mastersheet) with other spreadsheets first column and highlight the cell in all the sheet which is not present in master sheet.</p>

答:
Why do you need VBA for this task.
You can use conditional formatting to achieve the end result.

On your Master sheet, make a named range called "MasterList" for the values you have in column A.
Now on another sheet where you want to compare the values, select the while column A and make a new rule for conditional formatting using the formula given below and set the format as per your choice. Make New Rule for each sheet you want to compare with column A of Master Sheet.

```<code>=AND(A1<>"",COUNTIF(MasterList,A1)=0)
</code>```

Here MasterList is the named range you need to create on Master Sheet.

Body:
Why do you need VBA for this task.
You can use conditional formatting to achieve the end result.

On your Master sheet, make a named range called "MasterList" for the values you have in column A.
Now on another sheet where you want to compare the values, select the while column A and make a new rule for conditional formatting using the formula given below and set the format as per your choice. Make New Rule for each sheet you want to compare with column A of Master Sheet.

=AND(A1<>"",COUNTIF(MasterList,A1)=0)

Here MasterList is the named range you need to create on Master Sheet.