router

Pass props from child to parent react navigation

孤者浪人 提交于 2019-11-26 21:03:34
I am using react-navigation . I am passing props from a react-native component to the modal from react-navigation which is opened on a tap. export default class SomeComp extends Component { ... render() { const { navigate } = this.props; return ( <TouchableOpacity onPress={navigate("Modal", {data: ..., ...})} ..../> ) } } Inside the modal I access the goBack() function which closes the modal , as well as the props passed through SomeComp export default class Modal extends Component { ... render() { const { data, ... } = this.props.navigation.state.params; const { goBack } = this.props

SSH -L connection successful, but localhost port forwarding not working “channel 3: open failed: connect failed: Connection refused”

我只是一个虾纸丫 提交于 2019-11-26 19:42:57
问题 My lab runs RStudio on a server. A couple weeks ago, from my cousin's house, I successfully ssh'd into the server and pulled up the server-side RStudio through my local Firefox browser. Now when I try to access the server RStudio from home (via my own router), it doesn't work. I need help troubleshooting, and I'm guessing it's some problem on the router. I'm running Mac OSX 10.6.8. No idea what the university server's running, but I don't think it's a server-side problem. Here's how it worked

How can I determine the IP of my router/gateway in Java?

耗尽温柔 提交于 2019-11-26 18:59:01
How can I determine the IP of my router/gateway in Java? I can get my IP easily enough. I can get my internet IP using a service on a website. But how can I determine my gateway's IP? This is somewhat easy in .NET if you know your way around. But how do you do it in Java? Java doesn't make this as pleasant as other languages, unfortunately. Here's what I did: import java.io.*; import java.util.*; public class ExecTest { public static void main(String[] args) throws IOException { Process result = Runtime.getRuntime().exec("traceroute -m 1 www.amazon.com"); BufferedReader output = new

Providing input/subcommands to command executed over SSH with JSch

末鹿安然 提交于 2019-11-26 15:33:12
I'm trying to manage router via Java application using Jcraft Jsch library. I'm trying to send Router Config via TFTP server. The problem is in my Java code because this works with PuTTY. This my Java code: int port=22; String name ="R1"; String ip ="192.168.18.100"; String password ="root"; JSch jsch = new JSch(); Session session = jsch.getSession(name, ip, port); session.setPassword(password); session.setConfig("StrictHostKeyChecking", "no"); System.out.println("Establishing Connection..."); session.connect(); System.out.println("Connection established."); ChannelExec channelExec =

Angular2 conditional routing

好久不见. 提交于 2019-11-26 14:27:10
问题 This might be a basic question, but in Angular2 is there any way to do conditional routing ? Or, would someone do that outside the router ? I know ui-router had some ability to do this, but I haven't seen anything similar in Angular2s router 回答1: update In the new router guards can be used instead https://angular.io/guide/router#milestone-5-route-guards original (for the long gone router) Implement the CanActivate lifecycle hook like shown here Life cycle hooks in Angular2 router and return

Objective-C : How to fetch the router address?

北战南征 提交于 2019-11-26 09:40:30
问题 I tried to fetch the router address this way. - (NSString *) routerIp { NSString *address = @\"error\"; struct ifaddrs *interfaces = NULL; struct ifaddrs *temp_addr = NULL; int success = 0; // retrieve the current interfaces - returns 0 on success success = getifaddrs(&interfaces); if (success == 0) { // Loop through linked list of interfaces temp_addr = interfaces; while(temp_addr != NULL) { if(temp_addr->ifa_addr->sa_family == AF_INET) { // Check if interface is en0 which is the wifi

RouterModule.forRoot(ROUTES) vs RouterModule.forChild(ROUTES)

不羁岁月 提交于 2019-11-26 08:46:07
问题 What is the differences between these two and what are the use cases for each? The docs aren\'t exactly helpful: forRoot creates a module that contains all the directives, the given routes, and the router service itself. forChild creates a module that contains all the directives and the given routes, but does not include the router service. My vague guess is that one is for the \'main\' module and the other is for any imported modules (since they would already have the service available from

How to separate routes on Node.js and Express 4?

喜欢而已 提交于 2019-11-26 08:03:57
问题 I want to separate Routes from my server.js file. I am following this tutorial on Scotch.io http://scotch.io/tutorials/javascript/build-a-restful-api-using-node-and-express-4 It is working if all lines are on server.js file. But I am failing to separate. How can I make this work? server.js // set up ====================================================================== var express = require(\'express\'); var app = express(); var bodyParser = require(\'body-parser\'); // configuration ========

Pass props from child to parent react navigation

谁都会走 提交于 2019-11-26 07:49:47
问题 I am using react-navigation . I am passing props from a react-native component to the modal from react-navigation which is opened on a tap. export default class SomeComp extends Component { ... render() { const { navigate } = this.props; return ( <TouchableOpacity onPress={navigate(\"Modal\", {data: ..., ...})} ..../> ) } } Inside the modal I access the goBack() function which closes the modal , as well as the props passed through SomeComp export default class Modal extends Component { ...

How can I determine the IP of my router/gateway in Java?

让人想犯罪 __ 提交于 2019-11-26 06:44:08
问题 How can I determine the IP of my router/gateway in Java? I can get my IP easily enough. I can get my internet IP using a service on a website. But how can I determine my gateway\'s IP? This is somewhat easy in .NET if you know your way around. But how do you do it in Java? 回答1: Java doesn't make this as pleasant as other languages, unfortunately. Here's what I did: import java.io.*; import java.util.*; public class ExecTest { public static void main(String[] args) throws IOException { Process