问:
Protractor: stop do while loop once element is found
In non-Angular page using Protractor I have a situation where I have to loop trough some list of elements on the page and once I find the element I'm looking for, I have to stop the loop and click on that element.

Page object file:

```<code>var homePage = function() {
    this.elementLists = browser.element(by.id('list')).all(by.css('div.list'));
    this.elementLink = browser.element(by.id('list')).element(by.css('div[data-code="GAA"]'));
    this.paginationRight = browser.element(by.css('.navi-right'));
    ...
}
module.exports = homePage;
</code>```

Spec file:

```<code>// page objects
var homePage = require('../home_page/home_page.js');

// variables
var maxLoopCount = '';
var i = 0;

describe(...
    it(...
        // initialize page object
        var home = new homePage();

        // store number of listsinto a variable
        home.elementLists.count().then(function(num) {
            maxLoopCount = num;

            // click on right paginator arrow until element is displayed in the list
            while (i < maxLoopCount) {
                home.paginationRight.click();
                browser.sleep(1500);
                if (expect(home.elementLink.isPresent()).toBeTruthy()) {
                    break;
                }
                i++;
            };
    });
});
</code>```

I know I should use if (elementFound === true), but how can I do that?

答:
Just use:</p>

```<code>browser.wait(protractor.ExpectedConditions.visibilityOf($('.page-list-content')), 6000);
</code>```

Body:
In non-Angular page using Protractor I have a situation where I have to loop trough some list of elements on the page and once I find the element I'm looking for, I have to stop the loop and click on that element.

Page object file:

var homePage = function() {
    this.elementLists = browser.element(by.id('list')).all(by.css('div.list'));
    this.elementLink = browser.element(by.id('list')).element(by.css('div[data-code="GAA"]'));
    this.paginationRight = browser.element(by.css('.navi-right'));
    ...
}
module.exports = homePage;

Spec file:

// page objects
var homePage = require('../home_page/home_page.js');

// variables
var maxLoopCount = '';
var i = 0;

describe(...
    it(...
        // initialize page object
        var home = new homePage();

        // store number of listsinto a variable
        home.elementLists.count().then(function(num) {
            maxLoopCount = num;

            // click on right paginator arrow until element is displayed in the list
            while (i < maxLoopCount) {
                home.paginationRight.click();
                browser.sleep(1500);
                if (expect(home.elementLink.isPresent()).toBeTruthy()) {
                    break;
                }
                i++;
            };
    });
});

I know I should use if (elementFound === true), but how can I do that?

Body:
Just use:

browser.wait(protractor.ExpectedConditions.visibilityOf($('.page-list-content')), 6000);


来源: stackexchange

问:
Hibernate org.hibernate.MappingException: Unknown entity
I have the following entity which I can't map for some reason and I get "org.hibernate.MappingException: Unknown entity" during run time

Human:

```<code>package abo;

public class Human {

private int id;
private String name;
public Human()
{

}

public int getId() {
    return id;
}
public void setId(int id) {
    this.id = id;
}
public String getName() {
    return name;
}
public void setName(String name) {
    this.name = name;
}

}
</code>```

mapping file Human.hbm.xml(in the same package):

```<code><?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 16:40:24 26/09/2015 by Hibernate Tools 3.4.0.CR1 -->
<hibernate-mapping>
    <class name="abo.Human" table="human">
        <id name="id" type="int">
            <generator class="identity" />
        </id>
        <property name="name" type="java.lang.String">
        </property>
    </class>
</hibernate-mapping>
</code>```

And now the hibernate configuration file(hibernate.cfg.xml):

```<code><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
                                         "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
 <session-factory name="">
  <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
  <property name="hibernate.connection.password">blabla</property>
  <property name="hibernate.connection.url">jdbc:mysql://localhost:3306</property>
  <property name="hibernate.connection.username">root</property>
  <property name="hibernate.default_schema">protein_tracker</property>
  <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
  <mapping resource="abo/Human.hbm.xml"/>
 </session-factory>
</hibernate-configuration>
</code>```

Any suggestions?
Thanks!

答:
Try to write ein your example SessionFactory as the :</p>

```<code>SessionFactory objSf = new Configuration().configure().buildSessionFactory();
</code>```

ContentLicense: CC BY-SA 3.0

Body:
I have the following entity which I can't map for some reason and I get "org.hibernate.MappingException: Unknown entity" during run time

Human:

package abo;

public class Human {

private int id;
private String name;
public Human()
{

}

public int getId() {
    return id;
}
public void setId(int id) {
    this.id = id;
}
public String getName() {
    return name;
}
public void setName(String name) {
    this.name = name;
}

}

mapping file Human.hbm.xml(in the same package):

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
    <class name="abo.Human" table="human">
        <id name="id" type="int">
            <generator class="identity" />
        </id>
        <property name="name" type="java.lang.String">
        </property>
    </class>
</hibernate-mapping>

And now the hibernate configuration file(hibernate.cfg.xml):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
                                         "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
 <session-factory name="">
  <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
  <property name="hibernate.connection.password">blabla</property>
  <property name="hibernate.connection.url">jdbc:mysql://localhost:3306</property>
  <property name="hibernate.connection.username">root</property>
  <property name="hibernate.default_schema">protein_tracker</property>
  <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
  <mapping resource="abo/Human.hbm.xml"/>
 </session-factory>
</hibernate-configuration>

Any suggestions?
Thanks!

Body:
Try to write ein your example SessionFactory as the :

SessionFactory objSf = new Configuration().configure().buildSessionFactory();


问:
Trouble getting total count using .Take() and .Skip()
I'm having some trouble implementing some paging using Linq and I've read the various questions (this and this for example) on here but I'm still getting the error;

System.InvalidOperationException: The result of a query cannot be enumerated more than once.

My (slightly obfuscated) code is;

```<code>public List<Thing> GetThings(ObjectParameter[] params, int count, int pageIndex)
{
    var things = from t in Context.ExecuteFunction<Something>("function", params)
                 select new Thing
                 {
                     ID = t.ID
                 });

    var pagedThings = things;

    if (pageIndex == 0)
        pagedThings = things.Take(count);
    else if (pageIndex > 0)
        pagedThings = things.Skip(count * pageIndex).Take(count);

    var countOfThings = things.Count();

    return pagedThings.ToList();
}
</code>```

As soon as the final .ToList() is called, the error is thrown but I can't see why - are the calls to things.Count() and pagedThings.ToList() enumerating the same thing?

Edit: I'm using Entity Framework if that makes any difference

答:
Here is my implementation of your code. a few things to notice.
1. You can handle Skip in one statement.
2. The main method shows how to pass multiple pages into the method.</p>

```<code>using System;
using System.Collections.Generic;
using System.Linq;

public class Program
{
    public static void Main()
    {
        List<Thing> thingList = new List<Thing>();
        for (int i = 0; i < 99; i++)
        {
            thingList.Add(new Thing(i));
        }
       int count = 20;
        int pageIndex = 0;
        int numberPages = (int)Math.Ceiling(thingList.Count * 1.0/ (count ));
        for( ; pageIndex < numberPages; pageIndex ++)
        {
           var myPagedThings = GetThings(thingList, count, pageIndex);
           foreach( var item in myPagedThings)
           {
            Console.WriteLine(item.ID  );
           }
        }
    }

    public static IEnumerable<Thing> GetThings(List<Thing> myList, int count, int pageIndex)
    {
        var things = (
            from t in myList
            select new Thing{ID = t.ID}).ToList();

        return things.Skip(count * pageIndex).Take(count);
    }
}

public class Thing
{
    public int ID
    { get; set; }

    public Thing (){}
    public Thing(int id)
    {   this.ID = id;   }
}
</code>```

Body:
I'm having some trouble implementing some paging using Linq and I've read the various questions (this and this for example) on here but I'm still getting the error;

System.InvalidOperationException: The result of a query cannot be enumerated more than once.

My (slightly obfuscated) code is;

public List<Thing> GetThings(ObjectParameter[] params, int count, int pageIndex)
{
    var things = from t in Context.ExecuteFunction<Something>("function", params)
                 select new Thing
                 {
                     ID = t.ID
                 });

    var pagedThings = things;

    if (pageIndex == 0)
        pagedThings = things.Take(count);
    else if (pageIndex > 0)
        pagedThings = things.Skip(count * pageIndex).Take(count);

    var countOfThings = things.Count();

    return pagedThings.ToList();
}

As soon as the final .ToList() is called, the error is thrown but I can't see why - are the calls to things.Count() and pagedThings.ToList() enumerating the same thing?

Edit: I'm using Entity Framework if that makes any difference

Body:
Here is my implementation of your code. a few things to notice.
1. You can handle Skip in one statement.
2. The main method shows how to pass multiple pages into the method.

using System;
using System.Collections.Generic;
using System.Linq;

public class Program
{
    public static void Main()
    {
        List<Thing> thingList = new List<Thing>();
        for (int i = 0; i < 99; i++)
        {
            thingList.Add(new Thing(i));
        }
       int count = 20;
        int pageIndex = 0;
        int numberPages = (int)Math.Ceiling(thingList.Count * 1.0/ (count ));
        for( ; pageIndex < numberPages; pageIndex ++)
        {
           var myPagedThings = GetThings(thingList, count, pageIndex);
           foreach( var item in myPagedThings)
           {
            Console.WriteLine(item.ID  );
           }
        }
    }

    public static IEnumerable<Thing> GetThings(List<Thing> myList, int count, int pageIndex)
    {
        var things = (
            from t in myList
            select new Thing{ID = t.ID}).ToList();

        return things.Skip(count * pageIndex).Take(count);
    }
}

public class Thing
{
    public int ID
    { get; set; }

    public Thing (){}
    public Thing(int id)
    {   this.ID = id;   }
}


问:
How can I take more control in ASP.NET?
I'm trying to build a very, very simple "micro-webapp" which I suspect will be of interest to a few Stack Overflow'rs if I ever get it done. I'm hosting it on my C# in Depth site, which is vanilla ASP.NET 3.5 (i.e. not MVC).

The flow is very simple:

If a user enters the app with a URL which doesn't specify all the parameters (or if any of them are invalid) I want to just display the user input controls. (There are only two.)

If a user enters the app with a URL which does have all the required parameters, I want to display the results and the input controls (so they can change the parameters)

Here are my self-imposed requirements (mixture of design and implementation):

I want the submission to use GET rather than POST, mostly so users can bookmark the page easily.

I don't want the URL to end up looking silly after submission, with extraneous bits and pieces on it. Just the main URL and the real parameters please.

Ideally I'd like to avoid requiring JavaScript at all. There's no good reason for it in this app.

I want to be able to access the controls during render time and set values etc. In particular, I want to be able to set the default values of the controls to the parameter values passed in, if ASP.NET can't do this automatically for me (within the other restrictions).

I'm happy to do all the parameter validation myself, and I don't need much in the way of server side events. It's really simple to set everything on page load instead of attaching events to buttons etc.

Most of this is okay, but I haven't found any way of completely removing the viewstate and keeping the rest of the useful functionality. Using the post from this blog post I've managed to avoid getting any actual value for the viewstate - but it still ends up as a parameter on the URL, which looks really ugly.

If I make it a plain HTML form instead of an ASP.NET form (i.e. take out runat="server") then I don't get any magic viewstate - but then I can't access the controls programmatically.

I could do all of this by ignoring most of ASP.NET and building up an XML document with LINQ to XML, and implementing IHttpHandler. That feels a bit low level though.

I realise that my problems could be solved by either relaxing my constraints (e.g. using POST and not caring about the surplus parameter) or by using ASP.NET MVC, but are my requirements really unreasonable?

Maybe ASP.NET just doesn't scale down to this sort of app? There's a very likely alternative though: I'm just being stupid, and there's a perfectly simple way of doing it that I just haven't found.

Any thoughts, anyone? (Cue comments of how the mighty are fallen, etc. That's fine - I hope I've never claimed to be an ASP.NET expert, as the truth is quite the opposite...)

答:
Have you thought about not eliminating the POST but rather redirecting to a suitable GET url when the form is POSTed.   That is, accept both GET and POST, but on POST construct a GET request and redirect to it.  This could be handled either on the page or via an HttpModule if you wanted to make it page-independent. I think this would make things much easier.

EDIT: I assume that you have EnableViewState="false" set on the page.

OwnerDisplayName: Jon Skeet

ContentLicense: CC BY-SA 2.5

Title: How can I take more control in ASP.NET?

LastEditorDisplayName: Jon Skeet

OwnerDisplayName: tvanfosson

LastEditorDisplayName: tvanfosson


问:
Calling Google Endpoint api from a custom Domain
Is it possible to call, my endpoint api (https://myapi.appspot.com/_ah/api/) from my web app hosted in another domain (i.e. www.mydomain.com)?

Thanks.

答:
You actually can't with cloud endpoint version 1, as stated in the doc. It comes out of the box with version 2 (beta as of March 2017)

Note: version 1 of the Google Cloud Endpoints Frameworks did not support custom domains but version 2 does.

Same question on stackoverflow:

App engine endpoints API - 404 with custom domain

Deploy Google Endpoint in a custom Domain


问:
How to get the transpose in sql (HANA)?
I have a query which returns the table which is like

```<code> SELECT (CASE WHEN type=1 THEN 'A'
                 WHEN type=2 THEN 'B'

           END) as TYPE,COUNT(*) AS COUNT
            from TYPE_TABLE GROUP BY TYPE
</code>```

(I use case to have the count in each types).

```<code>count     type
_____     _____
123         A
124         B
120         C
</code>```

I want to have the table to be like this

```<code> A       B       C
___     ___     ___
123      124     120
</code>```

So actually I need the transpose of the column count.How do I get this in HANA?

答:
A pure SQL solution (SQL Server)

```<code>select
  [A]
  , [B]
  , [C]
from
(
  select Type,[Count]
  from ( SELECT (CASE WHEN type=1 THEN 'A'
             WHEN type=2 THEN 'B'
             .....
       END) as TYPE,COUNT(*) AS COUNT
        from TYPE_TABLE GROUP BY TYPE) Table1
) x
pivot
(
  SUM(Count)
  for Type in([A], [B], [C])
)p
</code>```

Demo

Title: How to get the transpose in sql (HANA)?

Body:
I have a query which returns the table which is like

 SELECT (CASE WHEN type=1 THEN 'A'
                 WHEN type=2 THEN 'B'

           END) as TYPE,COUNT(*) AS COUNT
            from TYPE_TABLE GROUP BY TYPE

(I use case to have the count in each types).

count     type
_____     _____
123         A
124         B
120         C

I want to have the table to be like this

 A       B       C
___     ___     ___
123      124     120

So actually I need the transpose of the column count.How do I get this in HANA?

Body:
A pure SQL solution (SQL Server)

select
  [A]
  , [B]
  , [C]
from
(
  select Type,[Count]
  from ( SELECT (CASE WHEN type=1 THEN 'A'
             WHEN type=2 THEN 'B'
             .....
       END) as TYPE,COUNT(*) AS COUNT
        from TYPE_TABLE GROUP BY TYPE) Table1
) x
pivot
(
  SUM(Count)
  for Type in([A], [B], [C])
)p

Demo


问:
wxpython call a function when focus of TextCtrl changes
Morning, I would like to call a function in my GUI in the event that the content of a TextCtrl is changed. Only after the user leaves the TextCtrl object though, not during editing.

Please can you help me find the right event handler to use, I'm very new to wxpython and I can't even find a list of allowable events.

Many thanks

答:
You can bind the TextCtrl to wx.EVT_TEXT to capture changes to the value and wx.EVT_KILL_FOCUS to trigger an even when the focus changes. Alternatively you could bind it to wx.EVT_SET_FOCUS and save the current TextCtrl value and also bind to it wx.EVT_KILL_FOCUS to and compare the new value to see if it's changed.

------- EDIT -------

WxFormBuilder is fantastic tool for quickly creating basic UIs. It will also show you every event that you can bind to a widget by clicking on the 'events'` tab.


问:
std::tuple::get returning const Type&&
I just read the updated interface for C++17 for std::tuple::get on cppreference http://en.cppreference.com/w/cpp/utility/tuple/get and the new overloads return const Type&& from the get<>() functions.  Why would you want to return a const Type&& over just a regular const Type&?  You can't move from instances of either type..

For reference these are the function declarations I am referring to

```<code>template< class T, class... Types >
constexpr const T&& get(const tuple<Types...>&& t);
</code>```

and

```<code>template< std::size_t I, class... Types >
constexpr std::tuple_element_t<I, tuple<Types...> >const&&
get( const tuple<Types...>&& t );
</code>```

答: You can move from mutable data from a const&&.  It is relatively obscure.

Title: std::tuple::get returning const Type&&

Body:
I just read the updated interface for C++17 for std::tuple::get on cppreference http://en.cppreference.com/w/cpp/utility/tuple/get and the new overloads return const Type&& from the get<>() functions.  Why would you want to return a const Type&& over just a regular const Type&?  You can't move from instances of either type..

For reference these are the function declarations I am referring to

template< class T, class... Types >
constexpr const T&& get(const tuple<Types...>&& t);

and

template< std::size_t I, class... Types >
constexpr std::tuple_element_t<I, tuple<Types...> >const&&
get( const tuple<Types...>&& t );


问:
Maven dependency not getting updated with LATEST version
I'm using intelij. I have multiple maven projects.
I deployed new version of maven Project_1, in the logs intelij showed version like this 1.0.0-20170331.023320-3.jar

Then in other Project_2 in pom file at  I set the version of Project_1 as LATEST and run install. And in the logs intelij shows that 1.0.0-20170330-253 version was downloaded. It has different timestamp and when I'm checking the file in the external libraries, it doesn't contain my recent changes.

Please, advise, what I'm doing wrong?

答:
You may want to "Reimport all maven projects" in IntelliJ which will redownload the dependencies
Right click on the Project -> select Maven -> Click Reimport</p>


问:
Parse log and plot graph using splunk
LogLevel="INFO" ServerName="test" HEALTH_CHECK_STATUS="OK"  DATETIME="29-3-2017 13:15:00"

LogLevel="INFO" ServerName="test" EALTH_CHECK_STATUS="OK"  DATETIME="29-3-2017 13:20:00"

LogLevel="INFO" ServerName="test" HEALTH_CHECK_STATUS="OK"  DATETIME="29-3-2017 13:25:00"

LogLevel="INFO" ServerName="test" HEALTH_CHECK_STATUS="OK"  DATETIME="29-3-2017 13:30:00"

LogLevel="INFO" ServerName="test" HEALTH_CHECK_STATUS="FAILED"  DATETIME="29-3-2017 13:35:00"

I am trying to plot the graph for HEALTH_CHECK_STATUS.
Help required for the same. I tried using timechart. But all requires number as input. Is it possible to convert the "OK" and "FAILED" and plot the graph in splunk?

答: index=myindex HEALTH_CHECK_STATUS| eval health=if(HEALTH_CHECK_STATUS="OK",100,0) | timechart values(health) as healthstatus</p>

Title: Parse log and plot graph using splunk


问:
Keras & Theano, Python 3.5, Windows 10 error
I am trying to use Keras with a Theano backend to work, so far I have just tried to import Kera like so.

```<code>from keras.models import Sequential
from keras.layers import Dense
</code>```

And I get a huge output error which I'm not too sure how to fix.

```<code>Using Theano backend.
===============================
00001   #include <Python.h>
00002   #include "theano_mod_helper.h"
.....   ............
01081   PyMODINIT_FUNC
01082   PyInit_lazylinker_ext(void) {
01083   #else
01084   #define RETVAL
01085   PyMODINIT_FUNC
01086   initlazylinker_ext(void)
01087   {
01088   #endif
01089       PyObject* m;
01090
01091       lazylinker_ext_CLazyLinkerType.tp_new = PyType_GenericNew;
01092       if (PyType_Ready(&lazylinker_ext_CLazyLinkerType) < 0)
01093           return RETVAL;
01094   #if defined(NPY_PY3K)
01095       m = PyModule_Create(&moduledef);
01096   #else
01097       m = Py_InitModule3("lazylinker_ext", lazylinker_ext_methods,
01098                          "Example module that creates an extension type.");
01099   #endif
01100       Py_INCREF(&lazylinker_ext_CLazyLinkerType);
01101       PyModule_AddObject(m, "CLazyLinker", (PyObject *)&lazylinker_ext_CLazyLinkerType);
01102
01103       return RETVAL;
01104   }
01105
===============================
In file included from C:\Users\Def\Anaconda3\include/Python.h:50:0,
Problem occurred during compilation with the command line below:
                 from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:1:
C:\Users\Def\Anaconda3\include/pyport.h:686:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
 #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
  ^
In file included from C:\Users\Def\Anaconda3\include/Python.h:133:0,
"C:\cygwin64\bin\g++.exe" -shared -g -march=broadwell -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -mno-sse4a -mcx16 -msahf -mmovbe -maes -mno-sha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mbmi2 -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -mrtm -mhle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-clwb -mno-pcommit -mno-mwaitx --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=6144 -mtune=generic -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -I"C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include" -I"C:\Users\Def\Anaconda3\include" -I"C:\Users\Def\Anaconda3\lib\site-packages\theano\gof" -L"C:\Users\Def\Anaconda3\libs" -L"C:\Users\Def\Anaconda3" -o C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\lazylinker_ext.pyd C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp -lpython36
                 from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:1:
C:\Users\Def\Anaconda3\include/fileutils.h:23:5: error: '__int64' does not name a type
     __int64 st_ino;
     ^
C:\Users\Def\Anaconda3\include/fileutils.h:29:5: error: '__int64' does not name a type
     __int64 st_size;
     ^
In file included from /usr/include/sys/stat.h:22:0,
                 from C:\Users\Def\Anaconda3\include/pyport.h:227,
                 from C:\Users\Def\Anaconda3\include/Python.h:50,
                 from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:1:
C:\Users\Def\Anaconda3\include/fileutils.h:30:12: error: expected ';' at end of member declaration
     time_t st_atime;
            ^
C:\Users\Def\Anaconda3\include/fileutils.h:30:12: error: expected unqualified-id before '.' token
     time_t st_atime;
            ^
C:\Users\Def\Anaconda3\include/fileutils.h:32:12: error: expected ';' at end of member declaration
     time_t st_mtime;
            ^
C:\Users\Def\Anaconda3\include/fileutils.h:32:12: error: expected unqualified-id before '.' token
     time_t st_mtime;
            ^
C:\Users\Def\Anaconda3\include/fileutils.h:34:12: error: expected ';' at end of member declaration
     time_t st_ctime;
            ^
C:\Users\Def\Anaconda3\include/fileutils.h:34:12: error: expected unqualified-id before '.' token
     time_t st_ctime;
            ^
In file included from C:\Users\Def\Anaconda3\include/Python.h:8:0,
                 from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:1:
C:\Users\Def\Anaconda3\include/pyconfig.h:269:23: error: '__int64' does not name a type
 # define PY_LONG_LONG __int64
                       ^
C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:309:9: note: in expansion of macro 'PY_LONG_LONG'
 typedef PY_LONG_LONG npy_longlong;
         ^
In file included from C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:22:0,
                 from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:7:
C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:310:31: error: expected initializer before 'npy_ulonglong'
 typedef unsigned PY_LONG_LONG npy_ulonglong;
                               ^
In file included from C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:22:0,
                 from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:7:
C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:611:17: error: 'npy_longlong' does not name a type
         typedef npy_longlong npy_int64;
                 ^
C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:612:17: error: 'npy_ulonglong' does not name a type
         typedef npy_ulonglong npy_uint64;
                 ^
C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:1090:9: error: 'npy_int64' does not name a type
 typedef npy_int64 npy_timedelta;
         ^
C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:1091:9: error: 'npy_int64' does not name a type
 typedef npy_int64 npy_datetime;
         ^
In file included from C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/ndarrayobject.h:18:0,
                 from C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:23,
                 from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:7:
C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:742:9: error: 'npy_int64' does not name a type
         npy_int64 year;
         ^
C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:748:9: error: 'npy_int64' does not name a type
         npy_int64 day;
         ^
In file included from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:7:0:
C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h: In function 'int npy_PyFile_DupClose2(PyObject*, FILE*, off_t)':
C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:274:41: error: 'lseek' was not declared in this scope
     if (npy_lseek(fd, orig_pos, SEEK_SET) == -1) {
                                         ^

Traceback (most recent call last):
  File "C:\Users\Def\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 75, in <module>
    raise ImportError()
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Def\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 92, in <module>
    raise ImportError()
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/Def/Dropbox/Dissertation/deepLearning.py", line 1, in <module>
    from keras.models import Sequential
  File "C:\Users\Def\Anaconda3\lib\site-packages\keras\__init__.py", line 3, in <module>
    from . import activations
  File "C:\Users\Def\Anaconda3\lib\site-packages\keras\activations.py", line 3, in <module>
    from . import backend as K
  File "C:\Users\Def\Anaconda3\lib\site-packages\keras\backend\__init__.py", line 61, in <module>
    from .theano_backend import *
  File "C:\Users\Def\Anaconda3\lib\site-packages\keras\backend\theano_backend.py", line 3, in <module>
    import theano
  File "C:\Users\Def\Anaconda3\lib\site-packages\theano\__init__.py", line 66, in <module>
    from theano.compile import (
  File "C:\Users\Def\Anaconda3\lib\site-packages\theano\compile\__init__.py", line 10, in <module>
    from theano.compile.function_module import *
  File "C:\Users\Def\Anaconda3\lib\site-packages\theano\compile\function_module.py", line 21, in <module>
    import theano.compile.mode
  File "C:\Users\Def\Anaconda3\lib\site-packages\theano\compile\mode.py", line 10, in <module>
    import theano.gof.vm
  File "C:\Users\Def\Anaconda3\lib\site-packages\theano\gof\vm.py", line 662, in <module>
    from . import lazylinker_c
  File "C:\Users\Def\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 127, in <module>
    preargs=args)
  File "C:\Users\Def\Anaconda3\lib\site-packages\theano\gof\cmodule.py", line 2316, in compile_str
    (status, compile_stderr.replace('\n', '. ')))
Exception: Compilation failed (return status=1): In file included from C:\Users\Def\Anaconda3\include/Python.h:50:0,.                  from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:1:. C:\Users\Def\Anaconda3\include/pyport.h:686:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?).".  #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?).".   ^. In file included from C:\Users\Def\Anaconda3\include/Python.h:133:0,.                  from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:1:. C:\Users\Def\Anaconda3\include/fileutils.h:23:5: error: '__int64' does not name a type.      __int64 st_ino;.      ^. C:\Users\Def\Anaconda3\include/fileutils.h:29:5: error: '__int64' does not name a type.      __int64 st_size;.      ^. In file included from /usr/include/sys/stat.h:22:0,.                  from C:\Users\Def\Anaconda3\include/pyport.h:227,.                  from C:\Users\Def\Anaconda3\include/Python.h:50,.                  from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:1:. C:\Users\Def\Anaconda3\include/fileutils.h:30:12: error: expected ';' at end of member declaration.      time_t st_atime;.             ^. C:\Users\Def\Anaconda3\include/fileutils.h:30:12: error: expected unqualified-id before '.' token.      time_t st_atime;.             ^. C:\Users\Def\Anaconda3\include/fileutils.h:32:12: error: expected ';' at end of member declaration.      time_t st_mtime;.             ^. C:\Users\Def\Anaconda3\include/fileutils.h:32:12: error: expected unqualified-id before '.' token.      time_t st_mtime;.             ^. C:\Users\Def\Anaconda3\include/fileutils.h:34:12: error: expected ';' at end of member declaration.      time_t st_ctime;.             ^. C:\Users\Def\Anaconda3\include/fileutils.h:34:12: error: expected unqualified-id before '.' token.      time_t st_ctime;.             ^. In file included from C:\Users\Def\Anaconda3\include/Python.h:8:0,.                  from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:1:. C:\Users\Def\Anaconda3\include/pyconfig.h:269:23: error: '__int64' does not name a type.  # define PY_LONG_LONG __int64.                        ^. C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:309:9: note: in expansion of macro 'PY_LONG_LONG'.  typedef PY_LONG_LONG npy_longlong;.          ^. In file included from C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:22:0,.                  from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:7:. C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:310:31: error: expected initializer before 'npy_ulonglong'.  typedef unsigned PY_LONG_LONG npy_ulonglong;.                                ^. In file included from C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:22:0,.                  from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:7:. C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:611:17: error: 'npy_longlong' does not name a type.          typedef npy_longlong npy_int64;.                  ^. C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:612:17: error: 'npy_ulonglong' does not name a type.          typedef npy_ulonglong npy_uint64;.                  ^. C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:1090:9: error: 'npy_int64' does not name a type.  typedef npy_int64 npy_timedelta;.          ^. C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:1091:9: error: 'npy_int64' does not name a type.  typedef npy_int64 npy_datetime;.          ^. In file included from C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/ndarrayobject.h:18:0,.                  from C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:23,.                  from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:7:. C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:742:9: error: 'npy_int64' does not name a type.          npy_int64 year;.          ^. C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:748:9: error: 'npy_int64' does not name a type.          npy_int64 day;.          ^. In file included from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:7:0:. C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h: In function 'int npy_PyFile_DupClose2(PyObject*, FILE*, off_t)':. C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:274:41: error: 'lseek' was not declared in this scope.      if (npy_lseek(fd, orig_pos, SEEK_SET) == -1) {.                                          ^.

Process finished with exit code 1
</code>```

Now to me this looks like it has a compilation issue with some Cython code and it not being able to compile properly but what should I do to fix this?
Thanks

答:
So after some deeper looking I found that my Windows 10 system had a bunch of C++ compiler that was conflicting which the library, not just MinGW.

Also, CygWin which was also causing a problem after I deleted these compilers and took their location our of my Path it worked.

So I recommend if you struggle with the same problem do a scan for any 'g++' compilers you might have forgotten about in your system and check your Paths!

Body:
I am trying to use Keras with a Theano backend to work, so far I have just tried to import Kera like so.

from keras.models import Sequential
from keras.layers import Dense

And I get a huge output error which I'm not too sure how to fix.

Using Theano backend.
===============================
00001   #include <Python.h>
00002   #include "theano_mod_helper.h"
.....   ............
01081   PyMODINIT_FUNC
01082   PyInit_lazylinker_ext(void) {
01083   #else
01084   #define RETVAL
01085   PyMODINIT_FUNC
01086   initlazylinker_ext(void)
01087   {
01088   #endif
01089       PyObject* m;
01090
01091       lazylinker_ext_CLazyLinkerType.tp_new = PyType_GenericNew;
01092       if (PyType_Ready(&lazylinker_ext_CLazyLinkerType) < 0)
01093           return RETVAL;
01094   #if defined(NPY_PY3K)
01095       m = PyModule_Create(&moduledef);
01096   #else
01097       m = Py_InitModule3("lazylinker_ext", lazylinker_ext_methods,
01098                          "Example module that creates an extension type.");
01099   #endif
01100       Py_INCREF(&lazylinker_ext_CLazyLinkerType);
01101       PyModule_AddObject(m, "CLazyLinker", (PyObject *)&lazylinker_ext_CLazyLinkerType);
01102
01103       return RETVAL;
01104   }
01105
===============================
In file included from C:\Users\Def\Anaconda3\include/Python.h:50:0,
Problem occurred during compilation with the command line below:
                 from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:1:
C:\Users\Def\Anaconda3\include/pyport.h:686:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
 #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
  ^
In file included from C:\Users\Def\Anaconda3\include/Python.h:133:0,
"C:\cygwin64\bin\g++.exe" -shared -g -march=broadwell -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -mno-sse4a -mcx16 -msahf -mmovbe -maes -mno-sha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mbmi2 -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -mrtm -mhle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-clwb -mno-pcommit -mno-mwaitx --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=6144 -mtune=generic -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -I"C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include" -I"C:\Users\Def\Anaconda3\include" -I"C:\Users\Def\Anaconda3\lib\site-packages\theano\gof" -L"C:\Users\Def\Anaconda3\libs" -L"C:\Users\Def\Anaconda3" -o C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\lazylinker_ext.pyd C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp -lpython36
                 from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:1:
C:\Users\Def\Anaconda3\include/fileutils.h:23:5: error: '__int64' does not name a type
     __int64 st_ino;
     ^
C:\Users\Def\Anaconda3\include/fileutils.h:29:5: error: '__int64' does not name a type
     __int64 st_size;
     ^
In file included from /usr/include/sys/stat.h:22:0,
                 from C:\Users\Def\Anaconda3\include/pyport.h:227,
                 from C:\Users\Def\Anaconda3\include/Python.h:50,
                 from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:1:
C:\Users\Def\Anaconda3\include/fileutils.h:30:12: error: expected ';' at end of member declaration
     time_t st_atime;
            ^
C:\Users\Def\Anaconda3\include/fileutils.h:30:12: error: expected unqualified-id before '.' token
     time_t st_atime;
            ^
C:\Users\Def\Anaconda3\include/fileutils.h:32:12: error: expected ';' at end of member declaration
     time_t st_mtime;
            ^
C:\Users\Def\Anaconda3\include/fileutils.h:32:12: error: expected unqualified-id before '.' token
     time_t st_mtime;
            ^
C:\Users\Def\Anaconda3\include/fileutils.h:34:12: error: expected ';' at end of member declaration
     time_t st_ctime;
            ^
C:\Users\Def\Anaconda3\include/fileutils.h:34:12: error: expected unqualified-id before '.' token
     time_t st_ctime;
            ^
In file included from C:\Users\Def\Anaconda3\include/Python.h:8:0,
                 from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:1:
C:\Users\Def\Anaconda3\include/pyconfig.h:269:23: error: '__int64' does not name a type
 # define PY_LONG_LONG __int64
                       ^
C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:309:9: note: in expansion of macro 'PY_LONG_LONG'
 typedef PY_LONG_LONG npy_longlong;
         ^
In file included from C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:22:0,
                 from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:7:
C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:310:31: error: expected initializer before 'npy_ulonglong'
 typedef unsigned PY_LONG_LONG npy_ulonglong;
                               ^
In file included from C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:22:0,
                 from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:7:
C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:611:17: error: 'npy_longlong' does not name a type
         typedef npy_longlong npy_int64;
                 ^
C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:612:17: error: 'npy_ulonglong' does not name a type
         typedef npy_ulonglong npy_uint64;
                 ^
C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:1090:9: error: 'npy_int64' does not name a type
 typedef npy_int64 npy_timedelta;
         ^
C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:1091:9: error: 'npy_int64' does not name a type
 typedef npy_int64 npy_datetime;
         ^
In file included from C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/ndarrayobject.h:18:0,
                 from C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:23,
                 from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:7:
C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:742:9: error: 'npy_int64' does not name a type
         npy_int64 year;
         ^
C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:748:9: error: 'npy_int64' does not name a type
         npy_int64 day;
         ^
In file included from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:7:0:
C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h: In function 'int npy_PyFile_DupClose2(PyObject*, FILE*, off_t)':
C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:274:41: error: 'lseek' was not declared in this scope
     if (npy_lseek(fd, orig_pos, SEEK_SET) == -1) {
                                         ^

Traceback (most recent call last):
  File "C:\Users\Def\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 75, in <module>
    raise ImportError()
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Def\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 92, in <module>
    raise ImportError()
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/Def/Dropbox/Dissertation/deepLearning.py", line 1, in <module>
    from keras.models import Sequential
  File "C:\Users\Def\Anaconda3\lib\site-packages\keras\__init__.py", line 3, in <module>
    from . import activations
  File "C:\Users\Def\Anaconda3\lib\site-packages\keras\activations.py", line 3, in <module>
    from . import backend as K
  File "C:\Users\Def\Anaconda3\lib\site-packages\keras\backend\__init__.py", line 61, in <module>
    from .theano_backend import *
  File "C:\Users\Def\Anaconda3\lib\site-packages\keras\backend\theano_backend.py", line 3, in <module>
    import theano
  File "C:\Users\Def\Anaconda3\lib\site-packages\theano\__init__.py", line 66, in <module>
    from theano.compile import (
  File "C:\Users\Def\Anaconda3\lib\site-packages\theano\compile\__init__.py", line 10, in <module>
    from theano.compile.function_module import *
  File "C:\Users\Def\Anaconda3\lib\site-packages\theano\compile\function_module.py", line 21, in <module>
    import theano.compile.mode
  File "C:\Users\Def\Anaconda3\lib\site-packages\theano\compile\mode.py", line 10, in <module>
    import theano.gof.vm
  File "C:\Users\Def\Anaconda3\lib\site-packages\theano\gof\vm.py", line 662, in <module>
    from . import lazylinker_c
  File "C:\Users\Def\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 127, in <module>
    preargs=args)
  File "C:\Users\Def\Anaconda3\lib\site-packages\theano\gof\cmodule.py", line 2316, in compile_str
    (status, compile_stderr.replace('\n', '. ')))
Exception: Compilation failed (return status=1): In file included from C:\Users\Def\Anaconda3\include/Python.h:50:0,.                  from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:1:. C:\Users\Def\Anaconda3\include/pyport.h:686:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?).".  #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?).".   ^. In file included from C:\Users\Def\Anaconda3\include/Python.h:133:0,.                  from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:1:. C:\Users\Def\Anaconda3\include/fileutils.h:23:5: error: '__int64' does not name a type.      __int64 st_ino;.      ^. C:\Users\Def\Anaconda3\include/fileutils.h:29:5: error: '__int64' does not name a type.      __int64 st_size;.      ^. In file included from /usr/include/sys/stat.h:22:0,.                  from C:\Users\Def\Anaconda3\include/pyport.h:227,.                  from C:\Users\Def\Anaconda3\include/Python.h:50,.                  from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:1:. C:\Users\Def\Anaconda3\include/fileutils.h:30:12: error: expected ';' at end of member declaration.      time_t st_atime;.             ^. C:\Users\Def\Anaconda3\include/fileutils.h:30:12: error: expected unqualified-id before '.' token.      time_t st_atime;.             ^. C:\Users\Def\Anaconda3\include/fileutils.h:32:12: error: expected ';' at end of member declaration.      time_t st_mtime;.             ^. C:\Users\Def\Anaconda3\include/fileutils.h:32:12: error: expected unqualified-id before '.' token.      time_t st_mtime;.             ^. C:\Users\Def\Anaconda3\include/fileutils.h:34:12: error: expected ';' at end of member declaration.      time_t st_ctime;.             ^. C:\Users\Def\Anaconda3\include/fileutils.h:34:12: error: expected unqualified-id before '.' token.      time_t st_ctime;.             ^. In file included from C:\Users\Def\Anaconda3\include/Python.h:8:0,.                  from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:1:. C:\Users\Def\Anaconda3\include/pyconfig.h:269:23: error: '__int64' does not name a type.  # define PY_LONG_LONG __int64.                        ^. C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:309:9: note: in expansion of macro 'PY_LONG_LONG'.  typedef PY_LONG_LONG npy_longlong;.          ^. In file included from C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:22:0,.                  from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:7:. C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:310:31: error: expected initializer before 'npy_ulonglong'.  typedef unsigned PY_LONG_LONG npy_ulonglong;.                                ^. In file included from C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:22:0,.                  from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:7:. C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:611:17: error: 'npy_longlong' does not name a type.          typedef npy_longlong npy_int64;.                  ^. C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:612:17: error: 'npy_ulonglong' does not name a type.          typedef npy_ulonglong npy_uint64;.                  ^. C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:1090:9: error: 'npy_int64' does not name a type.  typedef npy_int64 npy_timedelta;.          ^. C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:1091:9: error: 'npy_int64' does not name a type.  typedef npy_int64 npy_datetime;.          ^. In file included from C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/ndarrayobject.h:18:0,.                  from C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:23,.                  from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:7:. C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:742:9: error: 'npy_int64' does not name a type.          npy_int64 year;.          ^. C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:748:9: error: 'npy_int64' does not name a type.          npy_int64 day;.          ^. In file included from C:\Users\Def\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:7:0:. C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h: In function 'int npy_PyFile_DupClose2(PyObject*, FILE*, off_t)':. C:\Users\Def\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:274:41: error: 'lseek' was not declared in this scope.      if (npy_lseek(fd, orig_pos, SEEK_SET) == -1) {.                                          ^.

Process finished with exit code 1

Now to me this looks like it has a compilation issue with some Cython code and it not being able to compile properly but what should I do to fix this?
Thanks


问:
How can I set two primary key fields for my models in Django?
I have a model like this:

```<code>class Hop(models.Model):
    migration = models.ForeignKey('Migration')
    host = models.ForeignKey(User, related_name='host_set')
</code>```

How can I have the primary key be the combination of migration and host?

答:
Currently, Django models only support a single-column primary key. If you don't specify primary_key = True for the field in your model, Django will automatically create a column id as a primary key.

The attribute unique_together in class Meta is only a constraint for your data.

ContentLicense: CC BY-SA 4.0

Body:
I have a model like this:

class Hop(models.Model):
    migration = models.ForeignKey('Migration')
    host = models.ForeignKey(User, related_name='host_set')

How can I have the primary key be the combination of migration and host?


问:
How to segregate a single value from a query in MS Access
My apologies but I am a bit lost in the world of Microsoft Access. So I currently have a query that returns a column of values. The output looks like this:

SMABranchCode
    Code1
    Code2
    Code3
    etc.

This query then gets moved to a form text box. To do this, I have used Control Source like so:
    =IIf(IsNull(DLookUp("SMABranchCode","PWS_SM_QUERY"))," ","X")

This works "Ok"; however there are going to be probably 30+ more text boxes going horizontally next to this one all running the same query. Above them is a label with the Code. So basically when it spits out the data it looks like this (as long as there is an entry for that code):

Code 1  |  Code 2  | Code 3

X   |     X    |   X

The problem is, I either need to go and create a query for each of these text boxes so that it only pulls a single entry for each Code OR I can hopefully change up my Control Source entry (=IIf(IsNull(DLookUp("SMABranchCode","PWS_SM_QUERY"))," ","X")) to include criteria so that each text box has its own Criteria, so that from the one original query, each Code (1,2,3) only displays its information.

I have tried changing DLookUp to have criteria which has looked like this:
   =IIf(IsNull(DLookUp("SMABranchCode","PWS_SM_QUERY","SMABranchCode = Code1"))," ","X")

However that gives me an #Error! in the boxes I apply it too. I'm hoping maybe someone can help me figure out a solution since my brain is turning to mush over this.

Thank you

答:
I presume SMABranchCode is a text type field. Criteria values for text fields must be delimited with apostrophes, date/time field values would use #.

"SMABranchCode = 'Code1'"


问:
pthread Library location
In which directory does the libpthread library reside on a Linux system ?</p>

答:
Another simple way:</p>

```<code>ldd /bin/tar | grep pthread
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f803cdd4000)
</code>```

Title: pthread Library location

Body:
Another simple way:

ldd /bin/tar | grep pthread
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f803cdd4000)


问:
Fill out datetime-local field with existing localdatetime object in jsp using spring form
This is an editing form that will have all the fields filled out using existing data from database.  Regular text input fills out just fine but I am having issue doing the same with datetime.             </p>

```<code><sf:form class="form-horizontal" role="form" modelAttribute="sighting" action="edit" method="POST">
    <div class="form-group">
          <label for="Reported Time" class="col-md-4 col-sm-4 col-xs-12 control-label">
               Reported Time:
          </label>
          <div class="col-md-4 col-sm-6 col-xs-12">
               <sf:input type="datetime-local" class="add-form form-control" path="sightingDate" name="sightingDate"/>
          </div>
    </div>
</code>```

答:
Use the input type date instead of datetime-local since you don't have a timestamp part.

Modify your controller to populate your date in YYYY-MM-DD format
(e.g. "2016-11-11") in the sightingDate attribute. You can't
specify the date in any other format for an HTML5 date input type. You might want to make sightingDate as String so that you can store date in this format.

Body:
This is an editing form that will have all the fields filled out using existing data from database.  Regular text input fills out just fine but I am having issue doing the same with datetime.

<sf:form class="form-horizontal" role="form" modelAttribute="sighting" action="edit" method="POST">

               Reported Time:

               <sf:input type="datetime-local" class="add-form form-control" path="sightingDate" name="sightingDate"/>


问:
Sql query in another query to find user location by longitude and latitude
I am stuck on "basic" sql command. I have one table in WP ( usermeta ). In this table, I have longitude and latitude as meta_key. What I need is use two different queries to get list of user_id.

I have query that should be able to find users with dynamic distance every time I call it (that part "??SOMETHING??" is something unknown for me)

```<code>SELECT *,
       (3959 * acos(cos(radians('LAT VAL')) * cos(radians(latitude))
         * cos( radians(longtitude) - radians('LNG VAL')) + sin(radians('LAT VAL'))
         * sin(radians(latitude)))) AS distance
FROM ??SOMETHING??
HAVING distance < 15
ORDER BY distance
LIMIT 0 , 10
</code>```

Then I have this query ( really working )

```<code>SELECT user_id,
       MAX(IF(meta_key = 'latitude', meta_value, NULL)) AS latitude,
       MAX(IF(meta_key = 'longitude', meta_value, NULL)) AS longitude
FROM usermeta
GROUP BY user_id;
</code>```

I am doing it for hours now and I am not able figure it out alone. I think I am so close.

I will be very grateful, if someone can help me with that.

答:
Just replace the ??something?? with the query you have:

```<code>SELECT *,
       (3959 * acos(cos(radians('LAT VAL')) * cos(radians(latitude))
         * cos( radians(longtitude) - radians('LNG VAL')) + sin(radians('LAT VAL'))
         * sin(radians(latitude)))) AS distance
FROM
(
  SELECT user_id,
       MAX(IF(meta_key = 'latitude', meta_value, NULL)) AS latitude,
       MAX(IF(meta_key = 'longitude', meta_value, NULL)) AS longitude
  FROM usermeta
  GROUP BY user_id
) a
HAVING distance < 15
ORDER BY distance
LIMIT 0 , 10
</code>```

Please note, that in the query above the 'LAT VAL' and 'LNG VAL' are the coordinates of the point you want to find the users

Body:
I am stuck on "basic" sql command. I have one table in WP ( usermeta ). In this table, I have longitude and latitude as meta_key. What I need is use two different queries to get list of user_id.

I have query that should be able to find users with dynamic distance every time I call it (that part "??SOMETHING??" is something unknown for me)

SELECT *,
       (3959 * acos(cos(radians('LAT VAL')) * cos(radians(latitude))
         * cos( radians(longtitude) - radians('LNG VAL')) + sin(radians('LAT VAL'))
         * sin(radians(latitude)))) AS distance
FROM ??SOMETHING??
HAVING distance < 15
ORDER BY distance
LIMIT 0 , 10

Then I have this query ( really working )

SELECT user_id,
       MAX(IF(meta_key = 'latitude', meta_value, NULL)) AS latitude,
       MAX(IF(meta_key = 'longitude', meta_value, NULL)) AS longitude
FROM usermeta
GROUP BY user_id;

I am doing it for hours now and I am not able figure it out alone. I think I am so close.

I will be very grateful, if someone can help me with that.

Body:
Just replace the ??something?? with the query you have:

SELECT *,
       (3959 * acos(cos(radians('LAT VAL')) * cos(radians(latitude))
         * cos( radians(longtitude) - radians('LNG VAL')) + sin(radians('LAT VAL'))
         * sin(radians(latitude)))) AS distance
FROM
(
  SELECT user_id,
       MAX(IF(meta_key = 'latitude', meta_value, NULL)) AS latitude,
       MAX(IF(meta_key = 'longitude', meta_value, NULL)) AS longitude
  FROM usermeta
  GROUP BY user_id
) a
HAVING distance < 15
ORDER BY distance
LIMIT 0 , 10

Please note, that in the query above the 'LAT VAL' and 'LNG VAL' are the coordinates of the point you want to find the users


问:
Using .stage not giving desired result
I make a global variable equal to a movieclip

A function gets run with an if statement checking if [x] movieclip exists, if it doesn't add it.
Despite the MovieClip being on the stage it continues using the if statement.

Document class

```<code>public static var skinHolder:MovieClip = new test;
</code>```

Seperate Class (function runs every frame)

```<code>    function animHandler():void
    {
        if (! Game.skinHolder.stage)
        {
            // if its not on the stage we add it to the stage
            addChild(Game.skinHolder);
        }

    }
</code>```

答:
I don't completely understand your structure, but to check if a DisplayObjectContainer (MovieClip in your case) has a specific child, you can use the contains() method.

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObjectContainer.html#contains()

```<code>if (!contains(Game.skinHolder)) {
    addChild(Game.skinHolder);
}
</code>```

Title: Using .stage not giving desired result

Body:
I make a global variable equal to a movieclip

A function gets run with an if statement checking if [x] movieclip exists, if it doesn't add it.
Despite the MovieClip being on the stage it continues using the if statement.

Document class

public static var skinHolder:MovieClip = new test;

Seperate Class (function runs every frame)

    function animHandler():void
    {
        if (! Game.skinHolder.stage)
        {
            // if its not on the stage we add it to the stage
            addChild(Game.skinHolder);
        }

    }

Body:
I don't completely understand your structure, but to check if a DisplayObjectContainer (MovieClip in your case) has a specific child, you can use the contains() method.

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObjectContainer.html#contains()

if (!contains(Game.skinHolder)) {
    addChild(Game.skinHolder);
}


问:
Developing a Web Page to Post Text into Facebook
I am trying to develop a web page which will post some text from textbox to my fb timeline.
In fb developer account ,I have got method for that .It is working but it will always post a url link with my textbox text.
I don't want to include this url in timeline post.
Here is my javascript code

```<code>  FB.ui({
            method: 'share',
            caption: 'Your Comment',
            description: $('#TxtCmnt').val(),
            href: 'google.co.in',
            message:'This is for testing purpose'
        }, function (response) { });
</code>```

I want to exclude href. Here without href ,code won't work.
Any remedy???

答:
Check for facebook api.Facebookclient() will instantiate an object that will do the rest job.
https://facebookapi.codeplex.com/ </p>

Body:
I am trying to develop a web page which will post some text from textbox to my fb timeline.
In fb developer account ,I have got method for that .It is working but it will always post a url link with my textbox text.
I don't want to include this url in timeline post.
Here is my javascript code

  FB.ui({
            method: 'share',
            caption: 'Your Comment',
            description: $('#TxtCmnt').val(),
            href: 'google.co.in',
            message:'This is for testing purpose'
        }, function (response) { });

I want to exclude href. Here without href ,code won't work.
Any remedy???


问:
How can I perfectly center my image?
So I have an image on my website and I want to perfectly center it. I have tried many things but none have worked.

body{
background-color: black;
}

img {
  position: absolute;
  margin-top: 10%;
  text-align: center;
  height: 40%;
  z-index: -5
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><img src="images/astronaut.png"></code>```

答:
Have a look at the following links for further help, hope it helps.

https://www.w3.org/Style/Examples/007/center

https://css-tricks.com/snippets/css/absolute-center-vertical-horizontal-an-image/

html {
  width: 100%;
  height: 100%;
  background:url(http://tse4.mm.bing.net/th?id=OIP.IX1fAIIUJ82DtdfgR2tSnADhEs&w=207&h=276&c=8&qlt=90&o=4&dpr=2&pid=1.7) center center no-repeat;
}```

Title: How can I perfectly center my image?


答:
A google search turned up Issue 2485, which pointed to a flaw like this:

```<code>#include <functional>
#include <string>
#include <tuple>

using namespace std;

string str1() { return "one"; }
const string str2() { return "two"; }
tuple<string> tup3() { return make_tuple("three"); }
const tuple<string> tup4() { return make_tuple("four"); }

int main() {
  // cref(str1()); // BAD, properly rejected
  // cref(str2()); // BAD, properly rejected
  // cref(get<0>(tup3())); // BAD, properly rejected
  cref(get<0>(tup4())); // BAD, but improperly accepted!
}
</code>```

In this particular case, cref has a deleted overload for const T&&, but passing it through get is obscuring that the tuple, and its member, is a temporary.

Title: std::tuple::get returning const Type&&

Body:
A google search turned up Issue 2485, which pointed to a flaw like this:

#include <functional>
#include <string>
#include <tuple>

using namespace std;

string str1() { return "one"; }
const string str2() { return "two"; }
tuple<string> tup3() { return make_tuple("three"); }
const tuple<string> tup4() { return make_tuple("four"); }

int main() {
  // cref(str1()); // BAD, properly rejected
  // cref(str2()); // BAD, properly rejected
  // cref(get<0>(tup3())); // BAD, properly rejected
  cref(get<0>(tup4())); // BAD, but improperly accepted!
}

In this particular case, cref has a deleted overload for const T&&, but passing it through get is obscuring that the tuple, and its member, is a temporary.


问:
C++: Access to a public member function from outside of a class
I have a class defined in a separate file and at some point I need to access one of the public member functions from another source file. For some reason, I forgot how to do that and compiler gives me an error.

I have classA.h with definition of class A similar to this:

```<code>class classA {
  public:
  int function1(int alpha);
}
</code>```

And a separate file classA.cpp with the implementation. And then in some other file blah.cpp I include the header and try to access it like this:

```<code> classA::function1(15);
</code>```

and my compiler refuses it with error that it could not find a match for 'classA::function1(int)'.

I use Embarcadero RAD studio 2010 if that matters.

答:
Is function1 a static method ? If no, then you need an object of that class to call a member function.

Include classA.h in your blah.cpp and create an object of Class A and then call the member function.

Body:
I have a class defined in a separate file and at some point I need to access one of the public member functions from another source file. For some reason, I forgot how to do that and compiler gives me an error.

I have classA.h with definition of class A similar to this:

class classA {
  public:
  int function1(int alpha);
}

And a separate file classA.cpp with the implementation. And then in some other file blah.cpp I include the header and try to access it like this:

 classA::function1(15);

and my compiler refuses it with error that it could not find a match for 'classA::function1(int)'.

I use Embarcadero RAD studio 2010 if that matters.


问:
Update Android Support Library to 23.2.0 cause error: XmlPullParserException Binary XML file line #17<vector> tag requires viewportWidth > 0
I try to update my Support Library up to 23.2.0 and face this error:

```<code>Exception while inflating <vector>
org.xmlpull.v1.XmlPullParserException: Binary XML file line #17<vector> tag requires viewportWidth > 0
at android.support.graphics.drawable.VectorDrawableCompat.updateStateFromTypedArray(VectorDrawableCompat.java:535)
at android.support.graphics.drawable.VectorDrawableCompat.inflate(VectorDrawableCompat.java:472)
at android.support.graphics.drawable.VectorDrawableCompat.createFromXmlInner(VectorDrawableCompat.java:436)
at android.support.v7.widget.AppCompatDrawableManager$VdcInflateDelegate.createFromXmlInner(AppCompatDrawableManager.java:829)
at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates(AppCompatDrawableManager.java:303)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:178)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:173)
at android.support.v7.widget.TintTypedArray.getDrawable(TintTypedArray.java:60)
at android.support.v7.widget.Toolbar.<init>(Toolbar.java:254)
at android.support.v7.widget.Toolbar.<init>(Toolbar.java:196)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:594)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:267)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:129)
at com.chotot.vn.v2.activities.MainActivity.onCreate(MainActivity.java:121)
at android.app.Activity.performCreate(Activity.java:5133)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
</code>```

And

```<code>FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.chotot.vn.dev/com.chotot.vn.v2.activities.MainActivity}: android.view.InflateException: Binary XML file line #13: Error inflating class android.support.v7.widget.Toolbar
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #13: Error inflating class android.support.v7.widget.Toolbar
at android.view.LayoutInflater.createView(LayoutInflater.java:620)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:267)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:129)
at com.chotot.vn.v2.activities.MainActivity.onCreate(MainActivity.java:121)
at android.app.Activity.performCreate(Activity.java:5133)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:594)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:267)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:129)
at com.chotot.vn.v2.activities.MainActivity.onCreate(MainActivity.java:121)
at android.app.Activity.performCreate(Activity.java:5133)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/abc_ic_ab_back_material.xml from drawable resource ID #0x7f020016
at android.content.res.Resources.loadDrawable(Resources.java:2091)
at android.content.res.Resources.getDrawable(Resources.java:695)
at android.support.v7.widget.TintResources.superGetDrawable(TintResources.java:48)
at android.support.v7.widget.AppCompatDrawableManager.onDrawableLoadedFromResources(AppCompatDrawableManager.java:374)
at android.support.v7.widget.TintResources.getDrawable(TintResources.java:44)
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:323)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:180)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:173)
at android.support.v7.widget.TintTypedArray.getDrawable(TintTypedArray.java:60)
at android.support.v7.widget.Toolbar.<init>(Toolbar.java:254)
at android.support.v7.widget.Toolbar.<init>(Toolbar.java:196)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:594)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:267)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:129)
at com.chotot.vn.v2.activities.MainActivity.onCreate(MainActivity.java:121)
at android.app.Activity.performCreate(Activity.java:5133)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #17: invalid drawable tag vector
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:897)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:837)
at android.content.res.Resources.loadDrawable(Resources.java:2087)
at android.content.res.Resources.getDrawable(Resources.java:695)
at android.support.v7.widget.TintResources.superGetDrawable(TintResources.java:48)
at android.support.v7.widget.AppCompatDrawableManager.onDrawableLoadedFromResources(AppCompatDrawableManager.java:374)
at android.support.v7.widget.TintResources.getDrawable(TintResources.java:44)
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:323)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:180)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:173)
at android.support.v7.widget.TintTypedArray.getDrawable(TintTypedArray.java:60)
at android.support.v7.widget.Toolbar.<init>(Toolbar.java:254)
at android.support.v7.widget.Toolbar.<init>(Toolbar.java:196)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:594)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:267)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:129)
at com.chotot.vn.v2.activities.MainActivity.onCreate(MainActivity.java:121)
at android.app.Activity.performCreate(Activity.java:5133)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
</code>```

My activity_main.xml

```<code><?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <fragment
        android:id="@+id/f_actionbar"
        android:name="com.chotot.vn.fragments.ActionBarFragment"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

    <android.support.v7.widget.Toolbar
        android:id="@+id/main_tool_bar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:layout_alignParentTop="true"
        android:background="@color/action_bar_bg">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <include
                android:id="@+id/main_action_bar_layout"
                layout="@layout/layout_actionbar_custom_search"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:layout_gravity="top" />

            <LinearLayout
                android:id="@+id/main_action_bar_layout_content"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/main_action_bar_layout"
                android:orientation="vertical" />
        </RelativeLayout>
    </android.support.v7.widget.Toolbar>

    <FrameLayout
        android:id="@+id/layout_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/main_tool_bar" />

</RelativeLayout>
</code>```

How can I fix it?

答:
I changed the FragmentActivity to AppCompatActivity, the problem is solved. My environment is:</p>

```<code>compileSdkVersion = 25
buildToolsVersion = "25.0.0"
supportVersion = "25.2.0"
</code>```

Body:
I try to update my Support Library up to 23.2.0 and face this error:

Exception while inflating <vector>
org.xmlpull.v1.XmlPullParserException: Binary XML file line #17<vector> tag requires viewportWidth > 0
at android.support.graphics.drawable.VectorDrawableCompat.updateStateFromTypedArray(VectorDrawableCompat.java:535)
at android.support.graphics.drawable.VectorDrawableCompat.inflate(VectorDrawableCompat.java:472)
at android.support.graphics.drawable.VectorDrawableCompat.createFromXmlInner(VectorDrawableCompat.java:436)
at android.support.v7.widget.AppCompatDrawableManager$VdcInflateDelegate.createFromXmlInner(AppCompatDrawableManager.java:829)
at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates(AppCompatDrawableManager.java:303)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:178)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:173)
at android.support.v7.widget.TintTypedArray.getDrawable(TintTypedArray.java:60)
at android.support.v7.widget.Toolbar.<init>(Toolbar.java:254)
at android.support.v7.widget.Toolbar.<init>(Toolbar.java:196)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:594)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:267)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:129)
at com.chotot.vn.v2.activities.MainActivity.onCreate(MainActivity.java:121)
at android.app.Activity.performCreate(Activity.java:5133)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)

And

FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.chotot.vn.dev/com.chotot.vn.v2.activities.MainActivity}: android.view.InflateException: Binary XML file line #13: Error inflating class android.support.v7.widget.Toolbar
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #13: Error inflating class android.support.v7.widget.Toolbar
at android.view.LayoutInflater.createView(LayoutInflater.java:620)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:267)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:129)
at com.chotot.vn.v2.activities.MainActivity.onCreate(MainActivity.java:121)
at android.app.Activity.performCreate(Activity.java:5133)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:594)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:267)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:129)
at com.chotot.vn.v2.activities.MainActivity.onCreate(MainActivity.java:121)
at android.app.Activity.performCreate(Activity.java:5133)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/abc_ic_ab_back_material.xml from drawable resource ID #0x7f020016
at android.content.res.Resources.loadDrawable(Resources.java:2091)
at android.content.res.Resources.getDrawable(Resources.java:695)
at android.support.v7.widget.TintResources.superGetDrawable(TintResources.java:48)
at android.support.v7.widget.AppCompatDrawableManager.onDrawableLoadedFromResources(AppCompatDrawableManager.java:374)
at android.support.v7.widget.TintResources.getDrawable(TintResources.java:44)
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:323)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:180)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:173)
at android.support.v7.widget.TintTypedArray.getDrawable(TintTypedArray.java:60)
at android.support.v7.widget.Toolbar.<init>(Toolbar.java:254)
at android.support.v7.widget.Toolbar.<init>(Toolbar.java:196)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:594)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:267)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:129)
at com.chotot.vn.v2.activities.MainActivity.onCreate(MainActivity.java:121)
at android.app.Activity.performCreate(Activity.java:5133)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #17: invalid drawable tag vector
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:897)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:837)
at android.content.res.Resources.loadDrawable(Resources.java:2087)
at android.content.res.Resources.getDrawable(Resources.java:695)
at android.support.v7.widget.TintResources.superGetDrawable(TintResources.java:48)
at android.support.v7.widget.AppCompatDrawableManager.onDrawableLoadedFromResources(AppCompatDrawableManager.java:374)
at android.support.v7.widget.TintResources.getDrawable(TintResources.java:44)
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:323)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:180)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:173)
at android.support.v7.widget.TintTypedArray.getDrawable(TintTypedArray.java:60)
at android.support.v7.widget.Toolbar.<init>(Toolbar.java:254)
at android.support.v7.widget.Toolbar.<init>(Toolbar.java:196)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:594)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:267)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:129)
at com.chotot.vn.v2.activities.MainActivity.onCreate(MainActivity.java:121)
at android.app.Activity.performCreate(Activity.java:5133)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)

My activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <fragment
        android:id="@+id/f_actionbar"
        android:name="com.chotot.vn.fragments.ActionBarFragment"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

    <android.support.v7.widget.Toolbar
        android:id="@+id/main_tool_bar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:layout_alignParentTop="true"
        android:background="@color/action_bar_bg">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <include
                android:id="@+id/main_action_bar_layout"
                layout="@layout/layout_actionbar_custom_search"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:layout_gravity="top" />

            <LinearLayout
                android:id="@+id/main_action_bar_layout_content"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/main_action_bar_layout"
                android:orientation="vertical" />
        </RelativeLayout>
    </android.support.v7.widget.Toolbar>

    <FrameLayout
        android:id="@+id/layout_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/main_tool_bar" />

</RelativeLayout>

How can I fix it?

Body:
I changed the FragmentActivity to AppCompatActivity, the problem is solved. My environment is:

compileSdkVersion = 25
buildToolsVersion = "25.0.0"
supportVersion = "25.2.0"