问:
hibernate persist not working
I have a simple AppUser entity class and table in db APP_USERS.
when i do a addAppUser from DAO class, I get below exception:

HTTP Status 500 - Request processing failed; nested exception is
  org.hibernate.PersistentObjectException: detached entity passed to
  persist: com.spring.model.AppUser

```<code>@Override
public void addAppUser(AppUser p) {
    Session session = this.sessionFactory.getCurrentSession();
    session.persist(p);
    logger.info("AppUser saved successfully, AppUser Details="+p);
}
</code>```

Not sure how to resolve it. Same code works fine for persisting a different class's object. Did some research but could not find anything that could help.

答:
i had issue because i had the below naive code .. didn't notice it.

```<code>    @Id
    @Column(name = "enterid")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private String enterid;
</code>```

It was not able to autogenerate the enterid which is 'String' and it turned to null.
I noticed that during debugging.

```<code>Hibernate: insert into app_users (enterid, lead, enable, password, approval, role, teamname) values (null, ?, ?, ?, ?, ?, ?)
</code>```

Title: hibernate persist not working

Body:
I have a simple AppUser entity class and table in db APP_USERS.
when i do a addAppUser from DAO class, I get below exception:

HTTP Status 500 - Request processing failed; nested exception is
  org.hibernate.PersistentObjectException: detached entity passed to
  persist: com.spring.model.AppUser

@Override
public void addAppUser(AppUser p) {
    Session session = this.sessionFactory.getCurrentSession();
    session.persist(p);
    logger.info("AppUser saved successfully, AppUser Details="+p);
}

Not sure how to resolve it. Same code works fine for persisting a different class's object. Did some research but could not find anything that could help.

Body:
i had issue because i had the below naive code .. didn't notice it.

    @Id
    @Column(name = "enterid")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private String enterid;

It was not able to autogenerate the enterid which is 'String' and it turned to null.
I noticed that during debugging.

Hibernate: insert into app_users (enterid, lead, enable, password, approval, role, teamname) values (null, ?, ?, ?, ?, ?, ?)


来源: stackexchange

问:
where can we find plugins for Cloudbees jenkins?
looking for some straight forward answer that where can I download plugins for cloudbees Jenkins. Are we going to get it from cloudbess or do we need to use this https://updates.jenkins-ci.org/download/plugins/. Help will be appreciated. I can see -1 but not answer. Thanks. </p>

答:
Excactly you get your plugins from the jenkins site.

Is there any problem with using this url?

ContentLicense: CC BY-SA 3.0


问:
Getting LUIS entities inside a child dialog
I'm developing a bot using Bot Framework, LUIS and ActionBinding.

In one of my intent handlers I call a new Dialog which has the methods StartAsync(IDialogContext context) and ReceiveMessageAsync(IDialogContext context, IAwaitable<IMessageActivity> result)

As I understand it, the messages typed by the user while waiting (with context.Wait(ReceiveMessageAsync)) won't be sent to LUIS, right?

So if I need to understand what the user is saying without having to parse the string, which are my options? Could call the ILuisService.QueryAsync with the message.Text for each message be an option?

I want to be able to detect entities typed by the user so I can map them to missing fields. For example in this conversation:

```<code>User: I want to book a flight.                   // LUIS detects intent
Bot: Ok. Can you tell me more about your flight? // child dialog is called to handle the rest of the conversation
User: I want to go to Madrid.
Bot: To fly to Madrid you can choose between company A, B or C.
User: I want to go with A tomorrow night
Bot: Ok, searching for available tickets for tomorrow night in A...
</code>```

In this case there are no initial entities when the intent is detected, but there could be, and in that case the bot would not ask for the already given information.

For my project, a simple Form with one to one question-answer is not enough. I also need to make more validations and confirmations on previously set parameters if the user wants to change one or more parameters (i.e., I need to go back to all parameters and check if the changed parameter affects them). For example:

```<code>User: Wait, I want to fly to Barcelona instead.
Bot: Company A does not fly to Barcelona. You can choose between C and D.
User: Ok I want to fly with C.
Bot: There are tickets available for tomorrow night in company C. Keep the flight for tomorrow night?
User: yes.
</code>```

Any tips or guidance for best practices would help a lot.

Thanks in advance.

Edit:

With the Sub Action solution, where would my validators operate? On the FulfillAsync method? I'd need to validate and then send a question to the user and understand the reply he sent (parsing entities). Would that be possible inside a LuisAction?

I'd like to use the QueryValueFromLuisAsync but after looking at it, I'd need to pass the paramName, which is one of the action properties (if i'm not mistaken) and that is what I'm trying to avoid. I don't want to map one answer (i.e., message.Text) to one field, i want to map one answer to multiple fields.

Let's say i need to fill a model that has 6 properties. If the bot asks one question to the user and in his reply there are 3 entities I want to map those entities to 3 fields and only make questions about the remaining non mapped fields afterwards.

答:
My first reaction to this is to avoid using a custom child dialog and go with SubActions and create your own validators if you want to have complex logic there or even override the IsValid method from the sub action.

However, if that's not a possibility, then I would consider reusing the QueryValueFromLuisAsync method, where the action should be the model you want to interact with. That function will end up calling LUIS and will try to assign the result or return another intent/action depending on the scenario. I would give this a try.

Body:
I'm developing a bot using Bot Framework, LUIS and ActionBinding.

In one of my intent handlers I call a new Dialog which has the methods StartAsync(IDialogContext context) and ReceiveMessageAsync(IDialogContext context, IAwaitable<IMessageActivity> result)

As I understand it, the messages typed by the user while waiting (with context.Wait(ReceiveMessageAsync)) won't be sent to LUIS, right?

So if I need to understand what the user is saying without having to parse the string, which are my options? Could call the ILuisService.QueryAsync with the message.Text for each message be an option?

I want to be able to detect entities typed by the user so I can map them to missing fields. For example in this conversation:

User: I want to book a flight.                   // LUIS detects intent
Bot: Ok. Can you tell me more about your flight? // child dialog is called to handle the rest of the conversation
User: I want to go to Madrid.
Bot: To fly to Madrid you can choose between company A, B or C.
User: I want to go with A tomorrow night
Bot: Ok, searching for available tickets for tomorrow night in A...

In this case there are no initial entities when the intent is detected, but there could be, and in that case the bot would not ask for the already given information.

For my project, a simple Form with one to one question-answer is not enough. I also need to make more validations and confirmations on previously set parameters if the user wants to change one or more parameters (i.e., I need to go back to all parameters and check if the changed parameter affects them). For example:

User: Wait, I want to fly to Barcelona instead.
Bot: Company A does not fly to Barcelona. You can choose between C and D.
User: Ok I want to fly with C.
Bot: There are tickets available for tomorrow night in company C. Keep the flight for tomorrow night?
User: yes.

Any tips or guidance for best practices would help a lot.

Thanks in advance.

Edit:

With the Sub Action solution, where would my validators operate? On the FulfillAsync method? I'd need to validate and then send a question to the user and understand the reply he sent (parsing entities). Would that be possible inside a LuisAction?

I'd like to use the QueryValueFromLuisAsync but after looking at it, I'd need to pass the paramName, which is one of the action properties (if i'm not mistaken) and that is what I'm trying to avoid. I don't want to map one answer (i.e., message.Text) to one field, i want to map one answer to multiple fields.

Let's say i need to fill a model that has 6 properties. If the bot asks one question to the user and in his reply there are 3 entities I want to map those entities to 3 fields and only make questions about the remaining non mapped fields afterwards.


问:
how to turn off all vim settings for golang?
How could I turn off syntax highlighting in vim, but only for Go?  </p>

<p>I've seen a few posts about just turning off the red-highlighting for white space but that's not quite what I'm looking for. </p>

答:
Add the following line to your vimrc file:</p>

```<code>autocmd FileType go setlocal syntax=OFF
</code>```

Body:
How could I turn off syntax highlighting in vim, but only for Go?

I've seen a few posts about just turning off the red-highlighting for white space but that's not quite what I'm looking for.

Body:
Add the following line to your vimrc file:

autocmd FileType go setlocal syntax=OFF


问:
How to access elements under `shadow-root` at 'chrome://downloads' using jquery and selenium?
I am trying to get the name of the last downloaded file in my selenium javascript application.

I have my selenium driver navigating to the chrome downloads page using: driver.get('chrome://downloads'); , but when I get there, selenium is not able to find ANY elements on the download page.

The chrome downloads page 'chrome://downloads' has a bunch of shadow-root elements that I don't know how to get underneath in order to access the id's that I want. How do I access identifiers beneath shadow-root items?

I want to get $("#file-link") as shown here:

But when I use jquery to find it, everything returns null (probably because it's behind shadow-root)

Here's a big picture of all the information I have including showing that "#file-link" totally exists:

The code I am using to wait for the element to exist is the same that I use for all elements in my application, so I think this is already working:

```<code>driver.wait(until.elementLocated(By.id('downloads-manager')), 120000).then(function(){
    console.log("#downloads-manager shows");
    driver.findElement(By.id('downloads-manager')).then(function(dwMan){
        //How do I "open" #shadow-root now? :(
    });
});
</code>```

Here is my version information:

Chromium v54.0.2840.71

Node v6.5.0

ChromeDriver v2.27.440175

selenium-webdriver v3.4.0

Similar Question

Selenium webdriver can't find elements at chrome://downloads (This is the same problem I am having but in python)

Links

Selenium Javascript API: https://seleniumhq.github.io/selenium/docs/api/javascript/

答:
The $ from your example is not a shorthand for JQuery.
It's function overridden by the page to locate an element by id only:

```<code>function $(id){var el=document.getElementById(id);return el?assertInstanceof(el,HTMLElement):null}
</code>```

To select through the shadow DOM, you need to use the '/deep/' combinator.

So to get all the links in the download page:

```<code>document.querySelectorAll("downloads-manager /deep/ downloads-item /deep/ [id=file-link]")
</code>```

And with Selenium:

```<code>By.css("downloads-manager /deep/ downloads-item /deep/ [id=file-link]")
</code>```

Body:
I am trying to get the name of the last downloaded file in my selenium javascript application.

I have my selenium driver navigating to the chrome downloads page using: driver.get('chrome://downloads'); , but when I get there, selenium is not able to find ANY elements on the download page.

The chrome downloads page 'chrome://downloads' has a bunch of shadow-root elements that I don't know how to get underneath in order to access the id's that I want. How do I access identifiers beneath shadow-root items?

I want to get $("#file-link") as shown here:

But when I use jquery to find it, everything returns null (probably because it's behind shadow-root)

Here's a big picture of all the information I have including showing that "#file-link" totally exists:

The code I am using to wait for the element to exist is the same that I use for all elements in my application, so I think this is already working:

driver.wait(until.elementLocated(By.id('downloads-manager')), 120000).then(function(){
    console.log("#downloads-manager shows");
    driver.findElement(By.id('downloads-manager')).then(function(dwMan){
        //How do I "open" #shadow-root now? :(
    });
});

Here is my version information:

Chromium v54.0.2840.71

Node v6.5.0

ChromeDriver v2.27.440175

selenium-webdriver v3.4.0

Similar Question

Selenium webdriver can't find elements at chrome://downloads (This is the same problem I am having but in python)

Links

Selenium Javascript API: https://seleniumhq.github.io/selenium/docs/api/javascript/

Body:
The $ from your example is not a shorthand for JQuery.
It's function overridden by the page to locate an element by id only:

function $(id){var el=document.getElementById(id);return el?assertInstanceof(el,HTMLElement):null}

To select through the shadow DOM, you need to use the '/deep/' combinator.

So to get all the links in the download page:

document.querySelectorAll("downloads-manager /deep/ downloads-item /deep/ [id=file-link]")

And with Selenium:

By.css("downloads-manager /deep/ downloads-item /deep/ [id=file-link]")


问:
Get Python arguments using Jython in Java
I am trying to parse a python script to get the functions names and their arguments, I need to do it using java.

I managed to get their names using Jython but I can't find any way to get their arguments (name, number of them?).

Python example :

```<code>def multiply_by_two(number):
    """Returns the given number multiplied by two

    The result is always a floating point number.
    This keyword fails if the given `number` cannot be converted to number.
    """
    return float(number) * 2

def numbers_should_be_equal(first, second):
    print '*DEBUG* Got arguments %s and %s' % (first, second)
    if float(first) != float(second):
</code>```

Java code:

```<code>PythonInterpreter interpreter = new PythonInterpreter();
interpreter.execfile(file.getAbsolutePath());
PyStringMap map=(PyStringMap)interpreter.getLocals();
for (Object key : map.keys()) {
    Object o=map.get(Py.java2py(key));
    if (o instanceof PyFunction) {
        System.out.println((String)key); // the function name
        PyFunction function = (PyFunction) o;
    }
}
</code>```

I start to lose hope about finding a way to do it...

If anyone have an idea, even without using Jython

Thank you

答:
I used the answer from mata:

Would doing in in python using inspect.getargspec() be an option, e.g.
    after execfile do something like

```<code>interpreter.exec("import inspect"); PyStringMap map=(PyStringMap)interpreter.eval("dict([(k, inspect.getargspec(v))
for (k, v) in locals().items() if inspect.isfunction(v)]) ")
</code>```

Here is the working code:

```<code>PythonInterpreter interpreter = new PythonInterpreter();
interpreter.execfile(file.getAbsolutePath());
interpreter.exec("import inspect");
PyDictionary dico=(PyDictionary) interpreter.eval("dict([(k, inspect.getargspec(v).args) for (k, v) in locals().items() if inspect.isfunction(v)])");
ConcurrentMap<PyObject, PyObject> map= dico.getMap();
map.forEach((k,v)->{
    System.out.println(k.toString());
    System.out.println(v.toString());
});
</code>```

Body:
I am trying to parse a python script to get the functions names and their arguments, I need to do it using java.

I managed to get their names using Jython but I can't find any way to get their arguments (name, number of them?).

Python example :

def multiply_by_two(number):
    """Returns the given number multiplied by two

    The result is always a floating point number.
    This keyword fails if the given `number` cannot be converted to number.
    """
    return float(number) * 2

def numbers_should_be_equal(first, second):
    print '*DEBUG* Got arguments %s and %s' % (first, second)
    if float(first) != float(second):

Java code:

PythonInterpreter interpreter = new PythonInterpreter();
interpreter.execfile(file.getAbsolutePath());
PyStringMap map=(PyStringMap)interpreter.getLocals();
for (Object key : map.keys()) {
    Object o=map.get(Py.java2py(key));
    if (o instanceof PyFunction) {
        System.out.println((String)key); // the function name
        PyFunction function = (PyFunction) o;
    }
}

I start to lose hope about finding a way to do it...

If anyone have an idea, even without using Jython

Thank you

Body:
I used the answer from mata:

Would doing in in python using inspect.getargspec() be an option, e.g.
    after execfile do something like

interpreter.exec("import inspect"); PyStringMap map=(PyStringMap)interpreter.eval("dict([(k, inspect.getargspec(v))
for (k, v) in locals().items() if inspect.isfunction(v)]) ")

Here is the working code:

PythonInterpreter interpreter = new PythonInterpreter();
interpreter.execfile(file.getAbsolutePath());
interpreter.exec("import inspect");
PyDictionary dico=(PyDictionary) interpreter.eval("dict([(k, inspect.getargspec(v).args) for (k, v) in locals().items() if inspect.isfunction(v)])");
ConcurrentMap<PyObject, PyObject> map= dico.getMap();
map.forEach((k,v)->{
    System.out.println(k.toString());
    System.out.println(v.toString());
});


问:
firebase - Angularfire (get posts of friend list)
I have a list of friends and a list posts, I'm trying to get all the friends of a user and then get all the posts of the friends.

In my component I'm getting the friends of a user and  then i am passing them to my service that trying to get the posts.

In component :_____________

```<code>ngOnInit() {

firebase.database().ref(`friends/status/${this.userUid}`).orderByChild('request').equalTo('accepted').on("child_added", snapshot =>{

const activeFriends = snapshot.val().friend;
console.log("friends", activeFriends);
this.feedDataService.findAllPosts(activeFriends)
.subscribe(
data => this.posts$ = data
);

})

}
</code>```

This will return in console the ids of friends

friends Ste8mdpdjrUST6RQxbd4j7KAsFG2

friends katwxN5JllYJ4PmzAoXnYygKrIg2

I understand that this is because of "child_added" returned the 2 friends. If I had 30 friends I would get 30 console logs.

After I pass the activeFriends = snapshot.val().friend;

My service___________

```<code>findAllPosts(activeFriends):Observable<FeedData[]> {

return this.db.list(`posts/${activeFriends}`,{
query: {
orderByChild: 'postTime'
}
}).map( (arr) => { return arr.reverse(); }).map(FeedData.fromJsonArray).do(console.log);

}
</code>```

What in getting back in console log is the actual posts of this 2 friends that I have (the first user have 2 posts and the other 1 post), but I'm getting them  in different arrays because the keys I pass from them component triggers 2 times from child_added ( "see the logs up" )

console log the arrays of posts of 2 friends

Now in my view I'm always see the last array of posts that have only 1 post

The array I display in view

How can I combine the arrays,or how can i pass the friends keys with different way? Or how can I make this work?

答:
I suggest using switchMap and combineLatest. Using AngularFire, this would be something like:

```<code>this.postsByFriends$ = this.angularfireDatabase.list(`friends/status/${this.userUid}`)
  .switchMap(
    friends => Observable.combineLatest(
      friends.map(
        friend => this.feedDataService.findAllPosts(friend)));
</code>```

postsByFriends should now be an observable of arrays, each element of which is posts by one friend. You could subscribe to it in a template with the async pipe.

[[NOT TESTED]]

Body:
I have a list of friends and a list posts, I'm trying to get all the friends of a user and then get all the posts of the friends.

In my component I'm getting the friends of a user and  then i am passing them to my service that trying to get the posts.

In component :_____________

ngOnInit() {

firebase.database().ref(`friends/status/${this.userUid}`).orderByChild('request').equalTo('accepted').on("child_added", snapshot =>{

const activeFriends = snapshot.val().friend;
console.log("friends", activeFriends);
this.feedDataService.findAllPosts(activeFriends)
.subscribe(
data => this.posts$ = data
);

})

}

This will return in console the ids of friends

friends Ste8mdpdjrUST6RQxbd4j7KAsFG2

friends katwxN5JllYJ4PmzAoXnYygKrIg2

I understand that this is because of "child_added" returned the 2 friends. If I had 30 friends I would get 30 console logs.

After I pass the activeFriends = snapshot.val().friend;

My service___________

findAllPosts(activeFriends):Observable<FeedData[]> {

return this.db.list(`posts/${activeFriends}`,{
query: {
orderByChild: 'postTime'
}
}).map( (arr) => { return arr.reverse(); }).map(FeedData.fromJsonArray).do(console.log);

}

What in getting back in console log is the actual posts of this 2 friends that I have (the first user have 2 posts and the other 1 post), but I'm getting them  in different arrays because the keys I pass from them component triggers 2 times from child_added ( "see the logs up" )

console log the arrays of posts of 2 friends

Now in my view I'm always see the last array of posts that have only 1 post

The array I display in view

How can I combine the arrays,or how can i pass the friends keys with different way? Or how can I make this work?

Body:
I suggest using switchMap and combineLatest. Using AngularFire, this would be something like:

this.postsByFriends$ = this.angularfireDatabase.list(`friends/status/${this.userUid}`)
  .switchMap(
    friends => Observable.combineLatest(
      friends.map(
        friend => this.feedDataService.findAllPosts(friend)));

postsByFriends should now be an observable of arrays, each element of which is posts by one friend. You could subscribe to it in a template with the async pipe.

[[NOT TESTED]]


问:
FileNotFoundException is not getting catched or thrown
It's happening with 2 different methods, it both cases the EDT (swing components) blocks and can't do anything.

In the first I'm trying with throws , it sends strings to a printer, so the FileNotFoundException is because the printer is not being found (and that's not a problem, I know the printer is not connected.).

```<code>public void methodOne ()  throws PrintException, FileNotFoundException{
...
//a lot of lines
...
//not working code:
PrintService service = PrintServiceLookup.lookupDefaultPrintService();
DocFlavor flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE;
DocPrintJob pj = service.createPrintJob();
Doc doc=new SimpleDoc(bytes,flavor,null);
//and here is where the exception should be thrown:
pj.print(doc, null);

}
</code>```

In the second method I'm using try catch, it sends a String to a printer too.

```<code>public void methodTwo(){
String code2 = "1B700096FA";//hex
FileOutputStream os = null;
PrintStream ps=null;
try {
    os = new FileOutputStream("LPT1:POS-58");
    ps= new PrintStream(os);
    ps.print(toAscii(code2)); //--> here it freezes
    System.out.println("cashopen ");//--> not even arrives here
} catch (FileNotFoundException e) { //--> the exception is not being catched
    JOptionPane.showMessageDialog(this, "Can't open the cashdrawer");
    e.printStackTrace();
    }finally{
    ps.close();}
}
}

public StringBuilder toAscii( String hex ){
    StringBuilder output = new StringBuilder();
     for (int i = 0; i < hex.length(); i+=2) {
       String str = hex.substring(i, i+2);
       output.append((char)Integer.parseInt(str, 16));
     }
    return output;
}
</code>```

Other exceptions are working. Any idea is welcome. I'm using Eclipse, Windows x64, Java se 8 121

EDIT

Tested in another computer Win7 x32, Java se 8 121 x32, and it's all fine. No idea what can be.

答: Tested in another computer, working fine now. Something was wrong with Eclipse or Java in the other one.</p>

Body:
It's happening with 2 different methods, it both cases the EDT (swing components) blocks and can't do anything.

In the first I'm trying with throws , it sends strings to a printer, so the FileNotFoundException is because the printer is not being found (and that's not a problem, I know the printer is not connected.).

public void methodOne ()  throws PrintException, FileNotFoundException{
...
//a lot of lines
...
//not working code:
PrintService service = PrintServiceLookup.lookupDefaultPrintService();
DocFlavor flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE;
DocPrintJob pj = service.createPrintJob();
Doc doc=new SimpleDoc(bytes,flavor,null);
//and here is where the exception should be thrown:
pj.print(doc, null);

}

In the second method I'm using try catch, it sends a String to a printer too.

public void methodTwo(){
String code2 = "1B700096FA";//hex
FileOutputStream os = null;
PrintStream ps=null;
try {
    os = new FileOutputStream("LPT1:POS-58");
    ps= new PrintStream(os);
    ps.print(toAscii(code2)); //--> here it freezes
    System.out.println("cashopen ");//--> not even arrives here
} catch (FileNotFoundException e) { //--> the exception is not being catched
    JOptionPane.showMessageDialog(this, "Can't open the cashdrawer");
    e.printStackTrace();
    }finally{
    ps.close();}
}
}

public StringBuilder toAscii( String hex ){
    StringBuilder output = new StringBuilder();
     for (int i = 0; i < hex.length(); i+=2) {
       String str = hex.substring(i, i+2);
       output.append((char)Integer.parseInt(str, 16));
     }
    return output;
}

Other exceptions are working. Any idea is welcome. I'm using Eclipse, Windows x64, Java se 8 121

EDIT

Tested in another computer Win7 x32, Java se 8 121 x32, and it's all fine. No idea what can be.


问:
Can't get NTP to cross-compile to ARM
For some reason I can't get NTP libs to cross compile.  To my untrained eye it looks like it is cross-compiling to ARM.  But, when I do $file  they are not showing as ARM.

```<code>./configure -prefix=$(pwd) CC=~/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc LD=~/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-ld AS=~/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-as --host=arm-linux CFLAGS=-static
</code>```

Result:

```    checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
/home/eecklund/development/trunk/build_tools/ntp-4.2.8p8/sntp/libevent/build-aux/missing: Unknown `--is-lightweight' option
Try `/home/eecklund/development/trunk/build_tools/ntp-4.2.8p8/sntp/libevent/build-aux/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
checking for arm-linux-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking build system type... i686-pc-linux-gnu
checking host system type... arm-unknown-linux-gnu
checking for style of include used by make... GNU
checking for arm-linux-gcc... /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc accepts -g... yes
checking for /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc option to accept ISO C89... none needed
checking whether /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc understands -c and -o together... yes
checking dependency style of /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc... gcc3
checking how to run the C preprocessor... /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc option to accept ISO C89... (cached) none needed
checking for /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc option to accept ISO C99... -std=gnu99
checking for arm-linux-gcc... (cached) /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc accepts -g... (cached) yes
checking for /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc option to accept ISO C89... (cached) none needed
checking whether /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc understands -c and -o together... (cached) yes
checking dependency style of /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc... (cached) gcc3
checking whether /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc needs -traditional... no
checking if /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc can handle #warning... yes
checking if /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc supports __attribute__((...))... yes
checking if /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc can handle -Wstrict-overflow... yes
checking if /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc can handle -Winit-self... yes
checking if linker supports omitting unused code and data... no
checking additional compiler flags... none needed
checking additional linker flags... none needed
checking whether byte ordering is bigendian... no
checking for working volatile... yes
checking how to run the C preprocessor... /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc -E
checking how to run the C preprocessor... /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc -E
checking for arm-linux-g++... no
checking for arm-linux-c++... no
checking for arm-linux-gpp... no
checking for arm-linux-aCC... no
checking for arm-linux-CC... no
checking for arm-linux-cxx... no
checking for arm-linux-cc++... no
checking for arm-linux-cl.exe... no
checking for arm-linux-FCC... no
checking for arm-linux-KCC... no
checking for arm-linux-RCC... no
checking for arm-linux-xlC_r... no
checking for arm-linux-xlC... no
checking for g++... g++
configure: WARNING: using cross tools not prefixed with host triplet
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking for bison... bison -y
checking whether /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc and cc understand -c and -o together... yes
checking whether the compiler supports C99 structure initialization... yes
checking to see if we need ylwrap VPATH hack... no
checking for install dir and man conventions... in file loc/redhat
checking for arm-linux-ar... no
checking for arm-linux-lib... no
checking for arm-linux-link... no
checking for ar... ar
checking the archiver (ar) interface... ar
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc... /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-ld
checking if the linker (/home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... no
checking for arm-linux-dumpbin... no
checking for arm-linux-link... no
checking for dumpbin... no
checking for link... link -dump
checking the name lister (nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert i686-pc-linux-gnu file names to arm-unknown-linux-gnu format... func_convert_file_noop
checking how to convert i686-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-ld option to reload object files... -r
checking for arm-linux-objdump... no
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for arm-linux-dlltool... no
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for arm-linux-ar... ar
checking for archiver @FILE support... @
checking for arm-linux-strip... strip
checking for arm-linux-ranlib... no
checking for ranlib... ranlib
checking command to parse nm output from /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc object... ok
checking for sysroot... no
checking for arm-linux-mt... no
checking for mt... no
checking if : is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc supports -fno-rtti -fno-exceptions... no
checking for /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc option to produce PIC... -fPIC -DPIC
checking if /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc PIC flag -fPIC -DPIC works... yes
checking if /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc static flag -static works... yes
checking if /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc supports -c -o file.o... yes
checking if /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc supports -c -o file.o... (cached) yes
checking whether the /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc linker (/home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-ld) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-ld
checking if the linker (/home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-ld) is GNU ld... yes
checking whether the g++ linker (/home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-ld) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for pid_t... yes
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking sys/mman.h usability... yes
checking sys/mman.h presence... yes
checking for sys/mman.h... yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking sys/poll.h usability... yes
checking sys/poll.h presence... yes
checking for sys/poll.h... yes
checking sys/procset.h usability... no
checking sys/procset.h presence... no
checking for sys/procset.h... no
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/stropts.h usability... yes
checking sys/stropts.h presence... yes
checking for sys/stropts.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking sys/un.h usability... yes
checking sys/un.h presence... yes
checking for sys/un.h... yes
checking sys/wait.h usability... yes
checking sys/wait.h presence... yes
checking for sys/wait.h... yes
checking for dlfcn.h... (cached) yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking libgen.h usability... yes
checking libgen.h presence... yes
checking for libgen.h... yes
checking libintl.h usability... yes
checking libintl.h presence... yes
checking for libintl.h... yes
checking for memory.h... (cached) yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking setjmp.h usability... yes
checking setjmp.h presence... yes
checking for setjmp.h... yes
checking stdbool.h usability... yes
checking stdbool.h presence... yes
checking for stdbool.h... yes
checking sysexits.h usability... yes
checking sysexits.h presence... yes
checking for sysexits.h... yes
checking for unistd.h... (cached) yes
checking utime.h usability... yes
checking utime.h presence... yes
checking for utime.h... yes
checking stdarg.h usability... yes
checking stdarg.h presence... yes
checking for stdarg.h... yes
checking for string.h... (cached) yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking for inttypes.h... (cached) yes
checking for working stdnoreturn.h... no
checking for runetype.h... no
checking for wchar.h... yes
checking for wchar_t... yes
checking for wint_t... yes
checking for int8_t... yes
checking for uint8_t... yes
checking for int16_t... yes
checking for uint16_t... yes
checking for int32_t... yes
checking for uint32_t... yes
checking for intptr_t... yes
checking for uintptr_t... yes
checking for uint_t... no
checking for pid_t... (cached) yes
checking for size_t... yes
checking for ptrdiff_t... yes
checking size of char *... 4
checking size of int... 4
checking size of long... 4
checking size of short... 2
checking for pathfind in -lgen... no
checking for gettext in -lintl... no
checking for vprintf... yes
checking for _doprnt... no
checking vfork.h usability... no
checking vfork.h presence... no
checking for vfork.h... no
checking for fork... yes
checking for vfork... yes
checking for working fork... cross
configure: WARNING: result yes guessed because of cross compilation
checking for working vfork... (cached) yes
checking for mmap... yes
checking for canonicalize_file_name... yes
checking for snprintf... yes
checking for strdup... yes
checking for strchr... yes
checking for strrchr... yes
checking for strsignal... yes
checking for fchmod... yes
checking for fstat... yes
checking for chmod... yes
checking for a sed that does not truncate output... (cached) /usr/bin/sed
configure: Using supplied libopts tearoff
checking for arm-linux-pkg-config... no
checking for pkg-config... /usr/bin/pkg-config
checking if pkg-config is at least version 0.15.0... yes
checking if libevent 2 or later is installed... Package libevent_pthreads was not found in the pkg-config search path.
Perhaps you should add the directory containing `libevent_pthreads.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libevent_pthreads' found
no
configure: Using libevent tearoff
checking for size_t... (cached) yes
checking for stdarg.h... (cached) yes
checking for unsigned long long int... yes
checking for vsnprintf... yes
checking whether vsnprintf is C99 compliant... no
checking if C99-snprintf replacement vsnprintf will be used... yes
checking for inttypes.h... (cached) yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for stdint.h... (cached) yes
checking for struct lconv.decimal_point... yes
checking for struct lconv.thousands_sep... yes
checking for long double... yes
checking for long long int... yes
checking for unsigned long long int... (cached) yes
checking for size_t... (cached) yes
checking for intmax_t... yes
checking for uintmax_t... yes
checking for uintptr_t... (cached) yes
checking for ptrdiff_t... (cached) yes
checking for localeconv... yes
checking for an ANSI C-conforming const... yes
checking for snprintf... (cached) yes
checking whether snprintf is C99 compliant... no
checking if C99-snprintf replacement snprintf will be used... yes
checking for ld used by /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc... (cached) /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-ld
checking if the linker (/home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-ld) is GNU ld... (cached) yes
checking for directory path separator... '/'
checking line editing libraries... edit,editline
checking for readline() with -ledit... no
checking for readline() with -ledit -ltermcap... no
checking for el_gets() with -ledit -ltermcap... no
checking for readline() with -ledit -lcurses... no
checking for el_gets() with -ledit -lcurses... no
checking for readline() with -ledit -lncurses... no
checking for el_gets() with -ledit -lncurses... no
checking for readline() with -leditline... no
checking for readline() with -leditline -ltermcap... no
checking for el_gets() with -leditline -ltermcap... no
checking for readline() with -leditline -lcurses... no
checking for el_gets() with -leditline -lcurses... no
checking for readline() with -leditline -lncurses... no
checking for el_gets() with -leditline -lncurses... no
checking for library containing cos... -lm
checking for vfork.h... (cached) no
checking for fork... (cached) yes
checking for vfork... (cached) yes
checking for working fork... (cached) yes
checking for working vfork... (cached) yes
checking for working alloca.h... yes
checking for alloca... yes
checking whether strerror_r is declared... yes
checking for strerror_r... yes
checking whether strerror_r returns char *... yes
checking for library containing clock_gettime... -lrt
checking for clock_getres... yes
checking for clock_gettime... yes
checking for clock_settime... yes
checking for getclock... no
checking for stime... yes
checking for timegm... yes
checking for strlcpy... no
checking for strlcat... no
checking for library containing snprintb... no
checking for errno.h... (cached) yes
checking for sys/socket.h... (cached) yes
checking for sys/types.h... (cached) yes
checking time.h usability... yes
checking time.h presence... yes
checking for time.h... yes
checking for net/if.h... yes
checking for linux/if_addr.h... yes
checking arpa/nameser.h usability... yes
checking arpa/nameser.h presence... yes
checking for arpa/nameser.h... yes
checking for sys/param.h... (cached) yes
checking for sys/time.h... (cached) yes
checking sys/timers.h usability... no
checking sys/timers.h presence... no
checking for sys/timers.h... no
checking for sys/sysctl.h... yes
checking netinet/in_system.h usability... no
checking netinet/in_system.h presence... no
checking for netinet/in_system.h... no
checking netinet/in_systm.h usability... yes
checking netinet/in_systm.h presence... yes
checking for netinet/in_systm.h... yes
checking for netinet/in.h... (cached) yes
checking for resolv.h... yes
checking for net/if_var.h... no
checking for netinet/ip.h... yes
checking for netinet/in_var.h... no
checking for library containing inet_pton... none required
checking for library containing inet_ntop... none required
checking for library containing setsockopt... none required
checking for recvmsg... yes
checking for inline... inline
checking whether time.h and sys/time.h may both be included... yes
checking size of time_t... 4
checking whether char is unsigned... yes
checking size of signed char... 1
checking for s_char... no
checking for long long... yes
checking size of short... (cached) 2
checking size of int... (cached) 4
checking size of long... (cached) 4
checking size of long long... 8
checking for uid_t in sys/types.h... yes
checking if we're including debugging code... yes
checking semaphore.h usability... yes
checking semaphore.h presence... yes
checking for semaphore.h... yes
checking for socketpair... yes
checking for _beginthread... no
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking POSIX thread version... 10
checking for LinuxThreads pthread.h... no
checking for GNU Pth pthread.h... no
checking sched.h usability... yes
checking sched.h presence... yes
checking for sched.h... yes
checking for pthread_create in default libraries... no
checking for pthread link with -kthread... no
checking for pthread link with -pthread... yes
configure: ol_link_threads: <posix> ol_link_pthreads <-pthread>
checking for sched_yield... yes
checking for pthread_yield... yes
checking for thr_yield... no
checking for pthread_kill... yes
checking for pthread_rwlock_destroy with <pthread.h>... yes
checking for pthread_detach with <pthread.h>... yes
checking for pthread_setconcurrency... yes
checking for pthread_getconcurrency... yes
checking for thr_setconcurrency... no
checking for thr_getconcurrency... no
checking for pthread_kill_other_threads_np... no
checking for LinuxThreads implementation... no
checking for LinuxThreads consistency... no
checking if pthread_create() works... yes
checking if select yields when using pthreads... cross
configure: error: crossing compiling: use --with-yielding-
```

<p>After I run make, I check the file.</p>

<p>file ntpdate/ntpdate result:</p>

```ntpdate/ntpdate: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=0x4874a368a9eff3595cfca7948c4588627c80be80, not stripped
```

答:
Did you try doing what it says?

```<code>/configure --with-yielding-select=yes -prefix=$(pwd) CC=~/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc LD=~/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-ld AS=~/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-as --host=arm-linux CFLAGS=-static
</code>```

I did that and then got a "missing openssl/bn.h" error during make, although I have openssl installed.

Fixed this by adding --with-openssl-incdir="/usr/include" as an option to configure. Now trying to solve an "error: you must have stdarg.h or varargs.h on your system" error during configure. Will get back here when and if I solve it.

Title: Can't get NTP to cross-compile to ARM

Body:
For some reason I can't get NTP libs to cross compile.  To my untrained eye it looks like it is cross-compiling to ARM.  But, when I do $file  they are not showing as ARM.

./configure -prefix=$(pwd) CC=~/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc LD=~/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-ld AS=~/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-as --host=arm-linux CFLAGS=-static

Result:

    checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
/home/eecklund/development/trunk/build_tools/ntp-4.2.8p8/sntp/libevent/build-aux/missing: Unknown `--is-lightweight' option
Try `/home/eecklund/development/trunk/build_tools/ntp-4.2.8p8/sntp/libevent/build-aux/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
checking for arm-linux-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking build system type... i686-pc-linux-gnu
checking host system type... arm-unknown-linux-gnu
checking for style of include used by make... GNU
checking for arm-linux-gcc... /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc accepts -g... yes
checking for /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc option to accept ISO C89... none needed
checking whether /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc understands -c and -o together... yes
checking dependency style of /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc... gcc3
checking how to run the C preprocessor... /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc option to accept ISO C89... (cached) none needed
checking for /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc option to accept ISO C99... -std=gnu99
checking for arm-linux-gcc... (cached) /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc accepts -g... (cached) yes
checking for /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc option to accept ISO C89... (cached) none needed
checking whether /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc understands -c and -o together... (cached) yes
checking dependency style of /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc... (cached) gcc3
checking whether /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc needs -traditional... no
checking if /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc can handle #warning... yes
checking if /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc supports __attribute__((...))... yes
checking if /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc can handle -Wstrict-overflow... yes
checking if /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc can handle -Winit-self... yes
checking if linker supports omitting unused code and data... no
checking additional compiler flags... none needed
checking additional linker flags... none needed
checking whether byte ordering is bigendian... no
checking for working volatile... yes
checking how to run the C preprocessor... /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc -E
checking how to run the C preprocessor... /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc -E
checking for arm-linux-g++... no
checking for arm-linux-c++... no
checking for arm-linux-gpp... no
checking for arm-linux-aCC... no
checking for arm-linux-CC... no
checking for arm-linux-cxx... no
checking for arm-linux-cc++... no
checking for arm-linux-cl.exe... no
checking for arm-linux-FCC... no
checking for arm-linux-KCC... no
checking for arm-linux-RCC... no
checking for arm-linux-xlC_r... no
checking for arm-linux-xlC... no
checking for g++... g++
configure: WARNING: using cross tools not prefixed with host triplet
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking for bison... bison -y
checking whether /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc and cc understand -c and -o together... yes
checking whether the compiler supports C99 structure initialization... yes
checking to see if we need ylwrap VPATH hack... no
checking for install dir and man conventions... in file loc/redhat
checking for arm-linux-ar... no
checking for arm-linux-lib... no
checking for arm-linux-link... no
checking for ar... ar
checking the archiver (ar) interface... ar
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc... /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-ld
checking if the linker (/home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... no
checking for arm-linux-dumpbin... no
checking for arm-linux-link... no
checking for dumpbin... no
checking for link... link -dump
checking the name lister (nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert i686-pc-linux-gnu file names to arm-unknown-linux-gnu format... func_convert_file_noop
checking how to convert i686-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-ld option to reload object files... -r
checking for arm-linux-objdump... no
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for arm-linux-dlltool... no
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for arm-linux-ar... ar
checking for archiver @FILE support... @
checking for arm-linux-strip... strip
checking for arm-linux-ranlib... no
checking for ranlib... ranlib
checking command to parse nm output from /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc object... ok
checking for sysroot... no
checking for arm-linux-mt... no
checking for mt... no
checking if : is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc supports -fno-rtti -fno-exceptions... no
checking for /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc option to produce PIC... -fPIC -DPIC
checking if /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc PIC flag -fPIC -DPIC works... yes
checking if /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc static flag -static works... yes
checking if /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc supports -c -o file.o... yes
checking if /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc supports -c -o file.o... (cached) yes
checking whether the /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc linker (/home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-ld) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-ld
checking if the linker (/home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-ld) is GNU ld... yes
checking whether the g++ linker (/home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-ld) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for pid_t... yes
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking sys/mman.h usability... yes
checking sys/mman.h presence... yes
checking for sys/mman.h... yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking sys/poll.h usability... yes
checking sys/poll.h presence... yes
checking for sys/poll.h... yes
checking sys/procset.h usability... no
checking sys/procset.h presence... no
checking for sys/procset.h... no
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/stropts.h usability... yes
checking sys/stropts.h presence... yes
checking for sys/stropts.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking sys/un.h usability... yes
checking sys/un.h presence... yes
checking for sys/un.h... yes
checking sys/wait.h usability... yes
checking sys/wait.h presence... yes
checking for sys/wait.h... yes
checking for dlfcn.h... (cached) yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking libgen.h usability... yes
checking libgen.h presence... yes
checking for libgen.h... yes
checking libintl.h usability... yes
checking libintl.h presence... yes
checking for libintl.h... yes
checking for memory.h... (cached) yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking setjmp.h usability... yes
checking setjmp.h presence... yes
checking for setjmp.h... yes
checking stdbool.h usability... yes
checking stdbool.h presence... yes
checking for stdbool.h... yes
checking sysexits.h usability... yes
checking sysexits.h presence... yes
checking for sysexits.h... yes
checking for unistd.h... (cached) yes
checking utime.h usability... yes
checking utime.h presence... yes
checking for utime.h... yes
checking stdarg.h usability... yes
checking stdarg.h presence... yes
checking for stdarg.h... yes
checking for string.h... (cached) yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking for inttypes.h... (cached) yes
checking for working stdnoreturn.h... no
checking for runetype.h... no
checking for wchar.h... yes
checking for wchar_t... yes
checking for wint_t... yes
checking for int8_t... yes
checking for uint8_t... yes
checking for int16_t... yes
checking for uint16_t... yes
checking for int32_t... yes
checking for uint32_t... yes
checking for intptr_t... yes
checking for uintptr_t... yes
checking for uint_t... no
checking for pid_t... (cached) yes
checking for size_t... yes
checking for ptrdiff_t... yes
checking size of char *... 4
checking size of int... 4
checking size of long... 4
checking size of short... 2
checking for pathfind in -lgen... no
checking for gettext in -lintl... no
checking for vprintf... yes
checking for _doprnt... no
checking vfork.h usability... no
checking vfork.h presence... no
checking for vfork.h... no
checking for fork... yes
checking for vfork... yes
checking for working fork... cross
configure: WARNING: result yes guessed because of cross compilation
checking for working vfork... (cached) yes
checking for mmap... yes
checking for canonicalize_file_name... yes
checking for snprintf... yes
checking for strdup... yes
checking for strchr... yes
checking for strrchr... yes
checking for strsignal... yes
checking for fchmod... yes
checking for fstat... yes
checking for chmod... yes
checking for a sed that does not truncate output... (cached) /usr/bin/sed
configure: Using supplied libopts tearoff
checking for arm-linux-pkg-config... no
checking for pkg-config... /usr/bin/pkg-config
checking if pkg-config is at least version 0.15.0... yes
checking if libevent 2 or later is installed... Package libevent_pthreads was not found in the pkg-config search path.
Perhaps you should add the directory containing `libevent_pthreads.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libevent_pthreads' found
no
configure: Using libevent tearoff
checking for size_t... (cached) yes
checking for stdarg.h... (cached) yes
checking for unsigned long long int... yes
checking for vsnprintf... yes
checking whether vsnprintf is C99 compliant... no
checking if C99-snprintf replacement vsnprintf will be used... yes
checking for inttypes.h... (cached) yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for stdint.h... (cached) yes
checking for struct lconv.decimal_point... yes
checking for struct lconv.thousands_sep... yes
checking for long double... yes
checking for long long int... yes
checking for unsigned long long int... (cached) yes
checking for size_t... (cached) yes
checking for intmax_t... yes
checking for uintmax_t... yes
checking for uintptr_t... (cached) yes
checking for ptrdiff_t... (cached) yes
checking for localeconv... yes
checking for an ANSI C-conforming const... yes
checking for snprintf... (cached) yes
checking whether snprintf is C99 compliant... no
checking if C99-snprintf replacement snprintf will be used... yes
checking for ld used by /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc... (cached) /home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-ld
checking if the linker (/home/eecklund/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-ld) is GNU ld... (cached) yes
checking for directory path separator... '/'
checking line editing libraries... edit,editline
checking for readline() with -ledit... no
checking for readline() with -ledit -ltermcap... no
checking for el_gets() with -ledit -ltermcap... no
checking for readline() with -ledit -lcurses... no
checking for el_gets() with -ledit -lcurses... no
checking for readline() with -ledit -lncurses... no
checking for el_gets() with -ledit -lncurses... no
checking for readline() with -leditline... no
checking for readline() with -leditline -ltermcap... no
checking for el_gets() with -leditline -ltermcap... no
checking for readline() with -leditline -lcurses... no
checking for el_gets() with -leditline -lcurses... no
checking for readline() with -leditline -lncurses... no
checking for el_gets() with -leditline -lncurses... no
checking for library containing cos... -lm
checking for vfork.h... (cached) no
checking for fork... (cached) yes
checking for vfork... (cached) yes
checking for working fork... (cached) yes
checking for working vfork... (cached) yes
checking for working alloca.h... yes
checking for alloca... yes
checking whether strerror_r is declared... yes
checking for strerror_r... yes
checking whether strerror_r returns char *... yes
checking for library containing clock_gettime... -lrt
checking for clock_getres... yes
checking for clock_gettime... yes
checking for clock_settime... yes
checking for getclock... no
checking for stime... yes
checking for timegm... yes
checking for strlcpy... no
checking for strlcat... no
checking for library containing snprintb... no
checking for errno.h... (cached) yes
checking for sys/socket.h... (cached) yes
checking for sys/types.h... (cached) yes
checking time.h usability... yes
checking time.h presence... yes
checking for time.h... yes
checking for net/if.h... yes
checking for linux/if_addr.h... yes
checking arpa/nameser.h usability... yes
checking arpa/nameser.h presence... yes
checking for arpa/nameser.h... yes
checking for sys/param.h... (cached) yes
checking for sys/time.h... (cached) yes
checking sys/timers.h usability... no
checking sys/timers.h presence... no
checking for sys/timers.h... no
checking for sys/sysctl.h... yes
checking netinet/in_system.h usability... no
checking netinet/in_system.h presence... no
checking for netinet/in_system.h... no
checking netinet/in_systm.h usability... yes
checking netinet/in_systm.h presence... yes
checking for netinet/in_systm.h... yes
checking for netinet/in.h... (cached) yes
checking for resolv.h... yes
checking for net/if_var.h... no
checking for netinet/ip.h... yes
checking for netinet/in_var.h... no
checking for library containing inet_pton... none required
checking for library containing inet_ntop... none required
checking for library containing setsockopt... none required
checking for recvmsg... yes
checking for inline... inline
checking whether time.h and sys/time.h may both be included... yes
checking size of time_t... 4
checking whether char is unsigned... yes
checking size of signed char... 1
checking for s_char... no
checking for long long... yes
checking size of short... (cached) 2
checking size of int... (cached) 4
checking size of long... (cached) 4
checking size of long long... 8
checking for uid_t in sys/types.h... yes
checking if we're including debugging code... yes
checking semaphore.h usability... yes
checking semaphore.h presence... yes
checking for semaphore.h... yes
checking for socketpair... yes
checking for _beginthread... no
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking POSIX thread version... 10
checking for LinuxThreads pthread.h... no
checking for GNU Pth pthread.h... no
checking sched.h usability... yes
checking sched.h presence... yes
checking for sched.h... yes
checking for pthread_create in default libraries... no
checking for pthread link with -kthread... no
checking for pthread link with -pthread... yes
configure: ol_link_threads: <posix> ol_link_pthreads <-pthread>
checking for sched_yield... yes
checking for pthread_yield... yes
checking for thr_yield... no
checking for pthread_kill... yes
checking for pthread_rwlock_destroy with <pthread.h>... yes
checking for pthread_detach with <pthread.h>... yes
checking for pthread_setconcurrency... yes
checking for pthread_getconcurrency... yes
checking for thr_setconcurrency... no
checking for thr_getconcurrency... no
checking for pthread_kill_other_threads_np... no
checking for LinuxThreads implementation... no
checking for LinuxThreads consistency... no
checking if pthread_create() works... yes
checking if select yields when using pthreads... cross
configure: error: crossing compiling: use --with-yielding-

After I run make, I check the file.

file ntpdate/ntpdate result:

ntpdate/ntpdate: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=0x4874a368a9eff3595cfca7948c4588627c80be80, not stripped

Body:
Did you try doing what it says?

/configure --with-yielding-select=yes -prefix=$(pwd) CC=~/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-gcc LD=~/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-ld AS=~/development/trunk/build_tools/arm-2010q1/bin/arm-none-linux-gnueabi-as --host=arm-linux CFLAGS=-static

I did that and then got a "missing openssl/bn.h" error during make, although I have openssl installed.

Fixed this by adding --with-openssl-incdir="/usr/include" as an option to configure. Now trying to solve an "error: you must have stdarg.h or varargs.h on your system" error during configure. Will get back here when and if I solve it.


问:
How to redirect to index page when no internet connectivity is detected in webview
I am creating a web android app, I want a situation whereby I don't want the user to notice the default browser error message when there is no internet. I have already created an activity which does that but when I click on a link when there is no internet it show the default browser message.

here is my network activity

```<code>package com.example.infonet.greenparrotnews;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

public class Nointernet extends AppCompatActivity {

    private boolean isConnected = false;
    private static final String LOG_TAG = "CheckNetworkStatus";
    private NetworkChangeReceiver receiver;
    private TextView networkStatus;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_nointernet);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
        receiver = new NetworkChangeReceiver();
        registerReceiver(receiver, filter);
        networkStatus = (TextView) findViewById(R.id.networkStatus);
    }

    public class NetworkChangeReceiver extends BroadcastReceiver {

        @Override
        public void onReceive(final Context context, final Intent intent) {

            Log.v(LOG_TAG, "Receieved notification about network status");
            isNetworkAvailable(context);

        }

        private boolean isNetworkAvailable(Context context) {
            ConnectivityManager connectivity = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
            if (connectivity != null) {
                NetworkInfo[] info = connectivity.getAllNetworkInfo();
                if (info != null) {
                    for (int i = 0; i < info.length; i++) {
                        if (info[i].getState() == NetworkInfo.State.CONNECTED) {
                            if(!isConnected){
                                Log.v(LOG_TAG, "Now you are connected to Internet!");
                                networkStatus.setText("Now you are connected to Internet!");
                                isConnected = true;
                                //Intent q2 = new Intent(Nointernet.this, MainActivity.class);
                                //startActivity(q2);
                            }
                            return true;
                        }
                    }
                }
            }

            Log.v(LOG_TAG, "You are not connected to Internet!");
            networkStatus.setText("You are not connected to Internet!");
            isConnected = false;
            return false;
        }
    }

}
</code>```

答:
You can try this:</p>

```<code>private void cache() {
    webView.getSettings().setAppCachePath(getApplicationContext().getCacheDir().getAbsolutePath());
    webView.getSettings().setAppCacheEnabled(true);
    webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT); // load online by default
    if (!isNetworkAvailable()) { // loading offline
        webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
    }
}

/** Checks for an active network connection: */
private boolean isNetworkAvailable() {
    ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
    NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
    return activeNetworkInfo != null && activeNetworkInfo.isConnected();
}
</code>```

Body:
I am creating a web android app, I want a situation whereby I don't want the user to notice the default browser error message when there is no internet. I have already created an activity which does that but when I click on a link when there is no internet it show the default browser message.

here is my network activity

package com.example.infonet.greenparrotnews;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

public class Nointernet extends AppCompatActivity {

    private boolean isConnected = false;
    private static final String LOG_TAG = "CheckNetworkStatus";
    private NetworkChangeReceiver receiver;
    private TextView networkStatus;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_nointernet);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
        receiver = new NetworkChangeReceiver();
        registerReceiver(receiver, filter);
        networkStatus = (TextView) findViewById(R.id.networkStatus);
    }

    public class NetworkChangeReceiver extends BroadcastReceiver {

        @Override
        public void onReceive(final Context context, final Intent intent) {

            Log.v(LOG_TAG, "Receieved notification about network status");
            isNetworkAvailable(context);

        }

        private boolean isNetworkAvailable(Context context) {
            ConnectivityManager connectivity = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
            if (connectivity != null) {
                NetworkInfo[] info = connectivity.getAllNetworkInfo();
                if (info != null) {
                    for (int i = 0; i < info.length; i++) {
                        if (info[i].getState() == NetworkInfo.State.CONNECTED) {
                            if(!isConnected){
                                Log.v(LOG_TAG, "Now you are connected to Internet!");
                                networkStatus.setText("Now you are connected to Internet!");
                                isConnected = true;
                                //Intent q2 = new Intent(Nointernet.this, MainActivity.class);
                                //startActivity(q2);
                            }
                            return true;
                        }
                    }
                }
            }

            Log.v(LOG_TAG, "You are not connected to Internet!");
            networkStatus.setText("You are not connected to Internet!");
            isConnected = false;
            return false;
        }
    }

}

Body:
You can try this:

private void cache() {
    webView.getSettings().setAppCachePath(getApplicationContext().getCacheDir().getAbsolutePath());
    webView.getSettings().setAppCacheEnabled(true);
    webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT); // load online by default
    if (!isNetworkAvailable()) { // loading offline
        webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
    }
}

/** Checks for an active network connection: */
private boolean isNetworkAvailable() {
    ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
    NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
    return activeNetworkInfo != null && activeNetworkInfo.isConnected();
}


问:
Changing an image while click is held
I am looking to change an image of a button from when a click is held, then change back upon click release. I currently have a flat image, and I want it to change to one with an inner-shadow to make it look like a button press, but change back to the original flat image when the mouse click is released. I tried onmouseup but I think i'm using it incorrectly. I want the "item" and "item2" to hold their image when clicked, and that works correctly. However I want the "item3" to change back upon mouse release, or just change back instantly after being clicked.

(Edit: I'm new to JavaScript, it doesn't have to be an onmouseup solution. If someone can explain how to create a function which does this then that would be great.)

JS:

```<code>var onImgStp= "images/stop.png";
var onImgPnk= "images/pink.png";
var onImgMut= "images/mute.png";
var offImg= "images/green.png";
var offImgStp= "images/stop2.png";
</code>```

HTML:

```<code><img class="item" src="images/pink.png" onclick="manage(1); this.src = (this.src.endsWith(offImg)? onImgPnk : offImg);"/>
<img class="item" src="images/pink.png" onclick="manage(2); this.src = (this.src.endsWith(offImg)? onImgPnk : offImg);"/>
<img class="item" src="images/pink.png" onclick="manage(3); this.src = (this.src.endsWith(offImg)? onImgPnk : offImg);"/>
<img class="item" src="images/pink.png" onclick="manage(4); this.src = (this.src.endsWith(offImg)? onImgPnk : offImg);"/>
<img class="item" src="images/pink.png" onclick="manage(5); this.src = (this.src.endsWith(offImg)? onImgPnk : offImg);"/>
<img class="item" src="images/pink.png" onclick="manage(6); this.src = (this.src.endsWith(offImg)? onImgPnk : offImg);"/>
<img class="item" src="images/pink.png" onclick="manage(7); this.src = (this.src.endsWith(offImg)? onImgPnk : offImg);"/>
<img class="item" src="images/pink.png" onclick="manage(8); this.src = (this.src.endsWith(offImg)? onImgPnk : offImg);"/>
<img class="item2" src="images/mute.png" onclick="this.src = (this.src.endsWith(offImg)? onImgMut : offImg);"/>
<img class="item3" src="images/stop.png" onmouseup="this.src = (this.src.endsWith(offImgStp)? onImgStp : offImgStp);"/>
</code>```

答:
Have a look at this very simple Proof Of Concept solution (based on your question and the comments):

function mousedown() {
  var el = document.getElementById("image01");
  el.setAttribute("src", "http://blog.fantasy.co/wp-content/uploads/2013/02/feature_Net.jpg")
}

function resetImage() {
  var el = document.getElementById("image01");
  el.setAttribute("src", "https://camo.githubusercontent.com/b87a252140848659b80b0d2297e32dc62afee0cf/68747470733a2f2f646f63732e6d6963726f736f66742e636f6d2f656e2d75732f646f746e65742f61727469636c65732f696d616765732f6875622f6e6574636f72652e737667")
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><img id="image01" src="https://camo.githubusercontent.com/b87a252140848659b80b0d2297e32dc62afee0cf/68747470733a2f2f646f63732e6d6963726f736f66742e636f6d2f656e2d75732f646f746e65742f61727469636c65732f696d616765732f6875622f6e6574636f72652e737667" alt="image" onmousedown="mousedown()" onmouseup="resetImage();" onmouseleave="resetImage();" /></code>```

Normally I would advise to use CSS (and maybe stitched images if you still need more than one) to accomplish this effect.

Title: Changing an image while click is held

Body:
I am looking to change an image of a button from when a click is held, then change back upon click release. I currently have a flat image, and I want it to change to one with an inner-shadow to make it look like a button press, but change back to the original flat image when the mouse click is released. I tried onmouseup but I think i'm using it incorrectly. I want the "item" and "item2" to hold their image when clicked, and that works correctly. However I want the "item3" to change back upon mouse release, or just change back instantly after being clicked.

(Edit: I'm new to JavaScript, it doesn't have to be an onmouseup solution. If someone can explain how to create a function which does this then that would be great.)

JS:

var onImgStp= "images/stop.png";
var onImgPnk= "images/pink.png";
var onImgMut= "images/mute.png";
var offImg= "images/green.png";
var offImgStp= "images/stop2.png";

HTML:

Body:
Have a look at this very simple Proof Of Concept solution (based on your question and the comments):

function mousedown() {
  var el = document.getElementById("image01");
  el.setAttribute("src", "http://blog.fantasy.co/wp-content/uploads/2013/02/feature_Net.jpg")
}

function resetImage() {
  var el = document.getElementById("image01");
  el.setAttribute("src", "https://camo.githubusercontent.com/b87a252140848659b80b0d2297e32dc62afee0cf/68747470733a2f2f646f63732e6d6963726f736f66742e636f6d2f656e2d75732f646f746e65742f61727469636c65732f696d616765732f6875622f6e6574636f72652e737667")
}

<img id="image01" src="https://camo.githubusercontent.com/b87a252140848659b80b0d2297e32dc62afee0cf/68747470733a2f2f646f63732e6d6963726f736f66742e636f6d2f656e2d75732f646f746e65742f61727469636c65732f696d616765732f6875622f6e6574636f72652e737667" alt="image" onmousedown="mousedown()" onmouseup="resetImage();" onmouseleave="resetImage();" />

Normally I would advise to use CSS (and maybe stitched images if you still need more than one) to accomplish this effect.


问:
Mvc 5 pagination using view model
Hi i am newbie to Mvc i have a json service which returns a list of walletstatementlogs based on fromdate and todate. I have a controller TopUpReqLogController every time when i hit the action index of the controller it will go to service and fetch the data and returns to view as Ipagedlist and genrates pagelinks. How do i prevent servicecall everytime in TopUpReqLogController index action i just want to load service data once and pass it to index and display data in pages using int ? page please suggest</p>

```<code> public class WalletTopUpRequest
    {

        public string SlNo { get; set; }
        public string Sequence { get; set; }
        public string Merchant { get; set; }
        public string CustomerCode { get; set; }
        public string CustomerName { get; set; }
        public string BankName { get; set; }
        public string TransactionDate { get; set; }
        public string Reference { get; set; }
        public string Amount { get; set; }
        public string ApprovalStatus { get; set; }
        public string ApproveUser { get; set; }
        public string ApprovalDate { get; set; }
        public string RemarKs { get; set; }
    }

public ViewResult Index(int? page)
        {
            int pageSize = 3;
            int pageNumber = (page ?? 1);
            List<WalletTopUpRequest> wallettoprq = new List<WalletTopUpRequest>();
            if (page == null)
            {
                AgentBusiness business = new AgentBusiness();
                var result = business.Topuprequestlog("99910011010", "99810001110", "jBurFDoD1UpNPzWd/BlK4hVpV8GF+0eQT+AfNxEHHDKMB25AHf6CVA==", "25052017000000", "01062017000000");
                wallettoprq = result.wallettopuprequest.ToList();
                var viewmodel = wallettoprq.ToPagedList(pageNumber, pageSize);
                return View(viewmodel);
            }

            return View(wallettoprq.ToPagedList(pageNumber, pageSize));
        }

@using PagedList;
@using PagedList.Mvc;
@model  IPagedList<HaalMeer.MVC.Client.Models.WalletTopUpRequest>

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<html>
<head>
</head>
<body>
   <div id="page-wrapper">
        <div class="page-title-container">
            @*<div class="container-fluid">*@
                <div class="page-title pull-left">
                    <h2 class="entry-title">Topup Request Log</h2>
                </div>
                <ul class="breadcrumbs pull-right">
                    <li><a href="#">Home</a></li>
                    <li class="active">Topup Request Log</li>
                </ul>
            </div>
        </div>
        <section id="content" class="gray-area">
            <div class="container">
                <div class="row">
                    <div class="col-md-3">
                    </div>
                    @using (Html.BeginForm("Index", "TopUpReqLog", FormMethod.Get))
                    {
                    <div class="col-md-3">
                        <div class="form-group">
                            <label>From Date</label>
                            <div class="datepicker-wrap blue">
                                @*<input type="text" name="date_from" class="input-text full-width" placeholder="mm/dd/yy" style="background-color: #fff" />*@
                                @Html.TextBox("Fromdate", ViewBag.fromdate as string, new { @class = "input-text full-width", @placeholder = "mm/dd/yyy",@style = "background-color: #fff" }) <br />

                            </div>
                        </div>
                    </div>

                    <div class="col-md-3">
                        <div class="form-group">
                            <label>To Date</label>
                            <div class="datepicker-wrap blue">
                                @*<input type="text" name="date_from" class="input-text full-width" placeholder="mm/dd/yy" style="background-color: #fff" />*@
                                @Html.TextBox("Todate", ViewBag.todate as string, new { @class = "input-text full-width", @placeholder = "mm/dd/yyy", @style = "background-color: #fff" }) <br />

                            </div>
                        </div>
                        <button type="submit">Submit</button>
                    </div>
                    }

                    <div class="col-md-3">
                    </div>

                </div>
                <div class="row">
                    <div class="col-md-12 col-sm-12">
                        <div class="table-responsive">

                            <table class="table">
                                <tr class="info" style="text-align: center; font-weight: bold; color: #000">
                                    <td class="col-md-1">Sl</td>
                                    <td class="col-md-2">Date</td>
                                    <td class="col-md-1">Bank Ref.</td>
                                    <td class="col-md-1">Bank Name</td>
                                    <td class="col-md-2">Remarks</td>
                                    <td class="col-md-1">Amount</td>
                                    <td class="col-md-1">Status</td>
                                    <td class="col-md-2">Action Date</td>
                                </tr>

                                        @foreach (var item in Model)
                                        {
                                        <tr>
                                            <td class="hmcenter">@Html.DisplayFor(modelItem => item.SlNo)</td>
                                            <td class="hmcenter">@Html.DisplayFor(modelItem => item.TransactionDate)</td>
                                            <td class="hmcenter">@Html.DisplayFor(modelItem => item.Reference)</td>
                                            <td class="hmcenter">@Html.DisplayFor(modelItem => item.BankName)</td>
                                            <td class="hmleft">@Html.DisplayFor(modelItem => item.RemarKs)</td>
                                            <td class="hmright">@Html.DisplayFor(modelItem => item.Amount) </td>
                                            <td class="hmcenter">@Html.DisplayFor(modelItem => item.ApprovalStatus)</td>
                                            <td class="hmcenter">@Html.DisplayFor(modelItem => item.ApprovalDate)</td>
                                        </tr>

                                         }

                            </table>
                            <br/>

                            Page @(Model.PageCount<Model.PageNumber? 0 : Model.PageNumber) of @Model.PageCount

                            @Html.PagedListPager(Model, page => Url.Action("Index",new { page
                                            }))

                   @*<div class="form-group">
                    <ul class="pagination">
                        <li><a href="#">1</a></li>
                        <li class="active"><a href="#">2</a></li>
                        <li><a href="#">3</a></li>
                        <li><a href="#">4</a></li>
                        <li><a href="#">5</a></li>
                        <li><a href="#">3</a></li>
                        <li><a href="#">4</a></li>
                        <li><a href="#">5</a></li>
                    </ul>
                </div>*@

                        </div>
                    </div>

                </div>

           </div>
        </section>
</code>```

答:
So, from what I understand you want just make it work only on client side. If your model is not empty this code should work. If you want to load data as one result and make pagination on client side, then IPageList is not what you are looking for. Because, it is used only on the server side, and always returns ONE page of data to brake large results. You also can try to pass list of data to the view and turn it to IPageList result in the view and display each
page in tab, but is not a good practice. I would use datatables in this situation to make pagination only on the client side using regular data list:
https://datatables.net/.
Hint to improve current code:

Controller:

```<code>    public ViewResult Index(int? page = 1)
    {
      AgentBusiness business = new AgentBusiness();
      var result = business.Topuprequestlog("99910011010", "99810001110", "jBurFDoD1UpNPzWd/BlK4hVpV8GF+0eQT+AfNxEHHDKMB25AHf6CVA==", "25052017000000", "01062017000000");
      return View(result.wallettopuprequest.ToPagedList(pageNumber, 3));
    }
</code>```

View:

```<code>@Html.PagedListPager(Model, page => Url.Action("Index", new { page }), PagedListRenderOptions.ClassicPlusFirstAndLast)
</code>```

Title: Mvc 5 pagination using view model

Body:
Hi i am newbie to Mvc i have a json service which returns a list of walletstatementlogs based on fromdate and todate. I have a controller TopUpReqLogController every time when i hit the action index of the controller it will go to service and fetch the data and returns to view as Ipagedlist and genrates pagelinks. How do i prevent servicecall everytime in TopUpReqLogController index action i just want to load service data once and pass it to index and display data in pages using int ? page please suggest

 public class WalletTopUpRequest
    {

        public string SlNo { get; set; }
        public string Sequence { get; set; }
        public string Merchant { get; set; }
        public string CustomerCode { get; set; }
        public string CustomerName { get; set; }
        public string BankName { get; set; }
        public string TransactionDate { get; set; }
        public string Reference { get; set; }
        public string Amount { get; set; }
        public string ApprovalStatus { get; set; }
        public string ApproveUser { get; set; }
        public string ApprovalDate { get; set; }
        public string RemarKs { get; set; }
    }

public ViewResult Index(int? page)
        {
            int pageSize = 3;
            int pageNumber = (page ?? 1);
            List<WalletTopUpRequest> wallettoprq = new List<WalletTopUpRequest>();
            if (page == null)
            {
                AgentBusiness business = new AgentBusiness();
                var result = business.Topuprequestlog("99910011010", "99810001110", "jBurFDoD1UpNPzWd/BlK4hVpV8GF+0eQT+AfNxEHHDKMB25AHf6CVA==", "25052017000000", "01062017000000");
                wallettoprq = result.wallettopuprequest.ToList();
                var viewmodel = wallettoprq.ToPagedList(pageNumber, pageSize);
                return View(viewmodel);
            }

            return View(wallettoprq.ToPagedList(pageNumber, pageSize));
        }

@using PagedList;
@using PagedList.Mvc;
@model  IPagedList<HaalMeer.MVC.Client.Models.WalletTopUpRequest>

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}

            @*
*@

Topup Request Log

Home

Topup Request Log

                    @using (Html.BeginForm("Index", "TopUpReqLog", FormMethod.Get))
                    {

                            From Date

                                @*<input type="text" name="date_from" class="input-text full-width" placeholder="mm/dd/yy" style="background-color: #fff" />*@
                                @Html.TextBox("Fromdate", ViewBag.fromdate as string, new { @class = "input-text full-width", @placeholder = "mm/dd/yyy",@style = "background-color: #fff" })

                            To Date

                                @*<input type="text" name="date_from" class="input-text full-width" placeholder="mm/dd/yy" style="background-color: #fff" />*@
                                @Html.TextBox("Todate", ViewBag.todate as string, new { @class = "input-text full-width", @placeholder = "mm/dd/yyy", @style = "background-color: #fff" })

                        <button type="submit">Submit</button>

                    }

                                    Sl
                                    Date
                                    Bank Ref.
                                    Bank Name
                                    Remarks
                                    Amount
                                    Status
                                    Action Date

                                        @foreach (var item in Model)
                                        {

                                            @Html.DisplayFor(modelItem => item.SlNo)
                                            @Html.DisplayFor(modelItem => item.TransactionDate)
                                            @Html.DisplayFor(modelItem => item.Reference)
                                            @Html.DisplayFor(modelItem => item.BankName)
                                            @Html.DisplayFor(modelItem => item.RemarKs)
                                            @Html.DisplayFor(modelItem => item.Amount)
                                            @Html.DisplayFor(modelItem => item.ApprovalStatus)
                                            @Html.DisplayFor(modelItem => item.ApprovalDate)

                                         }

                            Page @(Model.PageCount<Model.PageNumber? 0 : Model.PageNumber) of @Model.PageCount

                            @Html.PagedListPager(Model, page => Url.Action("Index",new { page
                                            }))

                   @*

1

2

3

4

5

3

4

5

*@

Body:
So, from what I understand you want just make it work only on client side. If your model is not empty this code should work. If you want to load data as one result and make pagination on client side, then IPageList is not what you are looking for. Because, it is used only on the server side, and always returns ONE page of data to brake large results. You also can try to pass list of data to the view and turn it to IPageList result in the view and display each
page in tab, but is not a good practice. I would use datatables in this situation to make pagination only on the client side using regular data list:
https://datatables.net/.
Hint to improve current code:

Controller:

    public ViewResult Index(int? page = 1)
    {
      AgentBusiness business = new AgentBusiness();
      var result = business.Topuprequestlog("99910011010", "99810001110", "jBurFDoD1UpNPzWd/BlK4hVpV8GF+0eQT+AfNxEHHDKMB25AHf6CVA==", "25052017000000", "01062017000000");
      return View(result.wallettopuprequest.ToPagedList(pageNumber, 3));
    }

View:

@Html.PagedListPager(Model, page => Url.Action("Index", new { page }), PagedListRenderOptions.ClassicPlusFirstAndLast)