hostname

rspec route testing and hosts

眉间皱痕 提交于 2019-12-04 08:05:37
问题 I see I can test routes with rspec like this: get("/").should route_to("welcome#index") but I have constraints based on the hostname or parts of hostnames and redirects between several ones. How do I specify a hostname when testing? How do I run the tests with proper configuration? I tried printing root_url and I got: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true 回答1: The same error happens on mine whenever I run rspec

how to find host name from IP with out login to the host

岁酱吖の 提交于 2019-12-04 07:26:01
问题 i need to find the host name of a UNIX host whose IP is known with out login to that UNIX host 回答1: Use nslookup nslookup 208.77.188.166 ... Non-authoritative answer: 166.188.77.208.in-addr.arpa name = www.example.com. 回答2: You can do a reverse DNS lookup with host , too. Just give it the IP address as an argument: $ host 192.168.0.10 server10 has address 192.168.0.10 回答3: Another NS lookup utility that can be used for reversed lookup is dig with the -x option: $ dig -x 72.51.34.34 ; <<>> DiG

zsh prompt and hostname

笑着哭i 提交于 2019-12-04 03:35:23
I use the following prompt in .zshrc: PROMPT="%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%1~ %{$reset_color%}%# " When I open terminal I see this prompt: zoltan@zoltan-Macbook-Pro ~ % Is it possible to drop the text "zoltan" in the hostname? I would like to make it look like this: zoltan@Macbook-Pro ~ % Any suggestion would be greatly appreciated. Thank you! It's a bit of a mess, but you can pretend the %m is a parameter and use parameter expansion to strip the zoltan from the host name: PROMPT="...${${(%):-%m}#1} ..." A little explanation. First, you create a "parameter

How can I create and manage a multi-tenant ASP MVC application

非 Y 不嫁゛ 提交于 2019-12-03 21:33:09
I want to create a multi-tenant application that uses the hostname to determine the customer. For example: CustomerOne.myapp.com AnotherCo.myapp.com AndOneMore.myapp.com ... I can do the database and security side with no problems, I can also get the hostname from the URL, but what I am struggling to find out is how to create the basic plumbing that would allow a new customer to sign up online, provide their company name, and for the application to create the new URL, ready to be used straight away. Can anyone help? Thanks, Rob. codeulike I can't answer this exactly, but I can break it down a

Ip address to NetBIOS/FQDN name in Java/Android

自闭症网瘾萝莉.ら 提交于 2019-12-03 15:17:58
问题 given the ip address of a computer on the same network of my Android device, i have to find its NetBIOS/FQDN name ... is there any "clean" solution to accomplish this with the Android SDK and generally speaking in java ? Obviously InetAddress.get*HostName does not return the NetBIOS name :) 回答1: You can use JCIFS open source library. InetAddress addr = NbtAddress.getByName( "hostname" ).getInetAddress(); works both ways, ip address to hostname and vice versa. 回答2: Actually, the code provided

In Java 8, how do I get my hostname without hard-coding it in my environment?

风格不统一 提交于 2019-12-03 09:46:27
We just upgraded to Java 8 on Amazon Linux. We are using Spring 4.3.8.RELEASE. It used to be that we could get our machine hostname by setting up beans in our application context file like so ... <bean id="localhostInetAddress" class="java.net.InetAddress" factory-method="getLocalHost" /> <bean id="hostname" factory-bean="localhostInetAddress" factory-method="getHostName" /> But with Java 8, the bean "hostname" now contains the string localhost Before Java 8, it used to contain the "hostname" value as run on the command line, which is [myuser@machine1 ~]$ hostname machine1.mydomain.org How can

Ip address to NetBIOS/FQDN name in Java/Android

可紊 提交于 2019-12-03 05:10:53
given the ip address of a computer on the same network of my Android device, i have to find its NetBIOS/FQDN name ... is there any "clean" solution to accomplish this with the Android SDK and generally speaking in java ? Obviously InetAddress.get*HostName does not return the NetBIOS name :) Tom You can use JCIFS open source library. InetAddress addr = NbtAddress.getByName( "hostname" ).getInetAddress(); works both ways, ip address to hostname and vice versa. Actually, the code provided by Tom does not work, this code works for me (with JCIFS lib.) NbtAddress[] nbts = NbtAddress.getAllByAddress

Host Name Vs Canonical Host Name

早过忘川 提交于 2019-12-03 04:29:23
Can anyone please explain me the difference between Host Name and Canonical Host Name? I am currently using InetAddress class to fetch host name using the IP Address. I came across these 2 APIs. So I am just wondering, which one I should opt for? There are a few difference between the two: getCanonicalHostName() will attempt to resolve the FQDN . Therefore, you would get foo.mycompany.com whereas getHostName() might just return foo . getCanonicalHostName() will always do a reverse DNS lookup, whereas getHostName() would return the stored hostname if you supplied one in the InetAddress

Extract domain name from a host name

那年仲夏 提交于 2019-12-03 01:57:06
Is there a programatic way to find the domain name from a given hostname? given -> www.yahoo.co.jp return -> yahoo.co.jp The approach that works but is very slow is: split on "." and remove 1 group from the left, join and query an SOA record using dnspython when a valid SOA record is returned, consider that a domain Is there a cleaner/faster way to do this without using regexps? Alnitak There's no trivial definition of which "domain name" is the parent of any particular "host name". Your current method of traversing up the tree until you see an SOA record is actually the most correct.

Can we set easy-to-remember hostnames for EC2 instances?

南笙酒味 提交于 2019-12-03 01:41:31
问题 I'm running a couple of standard Fedora instances on EC2. I feel the public hostnames of the instances assigned by Amazon are too weird and hard to remember. I'd like to change them to something short (like red/blue/green/etc). Is there any draw back in doing this? And how do I set it up such that it persists after reboots? Thanks. 回答1: Before you get started, try running hostname and hostname --fqdn and take note of what the responses are. You can edit /etc/hostname and set a hostname, which