How do I get the local hostname if unresolvable through DNS in Java?
location: linuxexchange.com - date: May 18, 2011
This sounds like something that should have been asked before, and it has sort of, but I'm looking to get the local hostname and IP addresses of a machine even when it is not resolvable through DNS (in Java).
I can get the local IP addresses without resolution by iterating through NetworkInterfaces.getNetworkInterfaces().
Any answers to this question I've found indicate to use getLocalHost()
InetAddress localhost = java.net.InetAddress.getLocalHost();
hostName = localhost.getHostName();
but this throws an UnknownHostException if the hostname isn't resolvable through DNS.
Is there no way to get the local hostname without a DNS lookup happening behind the scenes?
edit: the IP address retrieved is 10.4.168.23
The exception is java.net.UnknownHostException: cms1.companyname.com: cms1.companyname.com (hostname changed for pseudo-anonymity), and the hosts file does not contain the hostname. But it does know its hostname, so I'm not sure why I can't get it without an exception b
How did LoZ: A Link to the Past handle subtile collisions?
location: linuxexchange.com - date: March 21, 2015
The Legend of Zelda: A Link To The Past is rendered with 16×16 tiles. How did they implement collision with tiles where only a quarter or half is occupied?
You can see such tiles in the cliff corners here:
Did they use a finer grid for collision detection, like four 8×8 tiles? If so, how do the diagonally cut tiles work?
The corners of the tiles also seem "round": if Link walks into a tile's corner, he can keep on walking and automatically moves around it. How is that done?
Adding link local address
location: linuxexchange.com - date: March 30, 2013
If the IPv6 link-local address is manually deleted on an interface, is there a way to obtain the link-local address back without bringing the interface down? The requirement stems from the need to hold onto (IPv4) existing connections on the interface, but also obtain the link-local address on it.
How do I run a local webfacing server?
location: linuxexchange.com - date: September 10, 2013
I have a LAN with computers connected to various switches and hubs. I want to trasform one of my computers into a web server and I would like to have access to that computer from the internet.
Would the best way to do this be setting my router to send all traffic incoming on port 80 to the IP of my web server? Is there a router designed to do this specifically?
And where in my LAN should I place the router?
If there is a better alternative, please let me know.
how to avoid routing through local stack in Linux
location: linuxexchange.com - date: December 16, 2011
I have the following environment: 2 hosts, each with 2 Ethernet interfaces connected to eachother (like on diagram below):
| (1)+---------------+(2) |
| host1 | | host2 |
| | | |
| (3)+---------------+(4) |
I would like to write client/server socket tool that will open both client and server sockets on host1.
I would like client to send TCP packets through interface (1) and server to listen on interface (3), that packets will go through host2.
Normally Linux stack will route this packets through local TCP/IP stack without sending those to host2.
I have tried to use SO_BINDTODEVICE option for both server and client and it seems that server indeed is binded to interface (3) and is not listening localhost traffic. I have checked that client from host1 could not be accepted whereas client from host2 does.
How to copy symbolic link file from Linux to Windows and then back to Linux but still keeping it as a symbolic link
location: linuxexchange.com - date: April 30, 2014
I have a symbolic link in my Linux machine.
I want to copy just the symbolic link (not the target) to a Windows machine and then copy this symbolic link from Windows machine back to some other Linux machine and symbolic link should continue to work.
What I tried:
I gziped the symbolic link
Moved gzipped file to Windows machine using WinSCP
Extracted symbolic link
Moved symbolic file to Linux machine using WinSCP
Now this file is not a symbolic link anymore.
Do anybody knows a trick to do this?
how disable viewing of hidden files.?
location: linux.com - date: December 28, 2013
linux mint 15 xfce
task - disable viewing of hidden files.
question - which library is responsible for the display of hidden files?
how do I add a local folder as a repository?
location: linuxquestions.com - date: September 4, 2005
Is there any way I can add a location on my disk such as "/home/akudewan/debs/" as an apt repository? I searched a lot, but didn't find anything.
How do I delete a local repository in git? [duplicate]
location: linuxexchange.com - date: February 1, 2013
This question already has an answer here:
How to fully delete a git repository created with init?
[SOLVED] SLES 11.1 disable ipv6 autoconfiguration
location: linuxquestions.com - date: March 23, 2011
On a SLES 11.1 PPC (220.127.116.11-0.3-ppc64) system, I am trying to disable ipv6 autoconfiguration. I do NOT want to disable ipv6 entirely, because I do want the machine to use the static ipv6 IP the network gods here have assigned it. I want to remove the automatically configured global address so there's no confusion about where ipv6 traffic is leaving from or arriving at.
I have the following in /etc/sysctl.conf:
Page: 1 2 3 4 5 6 7 8 9 10