fully-qualified-naming

Fully qualified machine name Java with /etc/hosts

大憨熊 提交于 2019-12-07 01:55:34
问题 I am trying get the fully qualified name of my machine (Windows 7 x64) in Java. On my machine, I've updated the c:\Windows\system32\drivers\etc\hosts file such that it has an entry like this: 10.44.2.167 myserver myserver.domain.com All our systems have an entry in the \etc\hosts file (in the above format) which I cannot change. The following code always returns "myserver" and I am never able to get the fully qualified name. InetAddress addr = InetAddress.getLocalHost(); String fqName = addr

Get use statement from class

时光怂恿深爱的人放手 提交于 2019-12-06 23:53:42
问题 Not quite sure of the best title but I will explain what I am asking as best I can. Assume I have the following file: MyCustomClass.php <?php namespace MyNamespace; use FooNamespace\FooClass; use BarNamespace\BarClass as Bar; use BazNamespace\BazClass as BazSpecial; class MyCustomClass { protected $someDependencies = []; public function __construct(FooClass $foo, Bar $bar) { $someDependencies[] = $foo; $someDependencies[] = $bar; } } Now if I were to use reflection, I could get the fully

Using fully qualified function calls in Erlang?

◇◆丶佛笑我妖孽 提交于 2019-12-05 12:27:25
I have just learnt how to upgrade a module in Erlang and I know that only the function calls that use the fully qualified names (eg. module:function() ) gets "relinked" to the current version loaded into the VM, but the function calls that do not specify the module's name do not get "relinked" to the current version, but keep using the older one. Is there a rule of thumb on when to use a fully qualified function call and when it's OK to call a function just by its name? Is it a bad idea to call all functions using their full name (like module:function() )? Erlang applications normally make use

Get use statement from class

和自甴很熟 提交于 2019-12-05 03:19:24
Not quite sure of the best title but I will explain what I am asking as best I can. Assume I have the following file: MyCustomClass.php <?php namespace MyNamespace; use FooNamespace\FooClass; use BarNamespace\BarClass as Bar; use BazNamespace\BazClass as BazSpecial; class MyCustomClass { protected $someDependencies = []; public function __construct(FooClass $foo, Bar $bar) { $someDependencies[] = $foo; $someDependencies[] = $bar; } } Now if I were to use reflection, I could get the fully qualified class names from the type hints in the construct. However, I would recieve FooNamespace\FooClass

How does the automatic full qualification of class names work, in Python? [relevant to object pickling]

ぃ、小莉子 提交于 2019-12-04 11:31:34
(It is possible to directly jump to the question, further down, and to skip the introduction.) There is a common difficulty with pickling Python objects from user-defined classes: # This is program dumper.py import pickle class C(object): pass with open('obj.pickle', 'wb') as f: pickle.dump(C(), f) In fact, trying to get the object back from another program loader.py with # This is program loader.py with open('obj.pickle', 'rb') as f: obj = pickle.load(f) results in AttributeError: 'module' object has no attribute 'C' In fact, the class is pickled by name ("C"), and the loader.py program does

namespaces, classes and free functions - when do you need fully qualified names

你说的曾经没有我的故事 提交于 2019-12-03 07:44:19
问题 In my example below, why do I have to fully qualify the name of the free function in the cpp to avoid linker errors and why does it work for the class function without? Can you explain the difference? ctest.h: namespace Test { int FreeFunction(); class CTest { public: CTest(); ~CTest(); }; } ctest.cpp: #include "ctest.h" using namespace Test; // int FreeFunction() -> undefined reference error int Test::FreeFunction() -> works just fine { return 0; } CTest::CTest() -> no need to fully qualify

namespaces, classes and free functions - when do you need fully qualified names

穿精又带淫゛_ 提交于 2019-12-02 21:12:07
In my example below, why do I have to fully qualify the name of the free function in the cpp to avoid linker errors and why does it work for the class function without? Can you explain the difference? ctest.h: namespace Test { int FreeFunction(); class CTest { public: CTest(); ~CTest(); }; } ctest.cpp: #include "ctest.h" using namespace Test; // int FreeFunction() -> undefined reference error int Test::FreeFunction() -> works just fine { return 0; } CTest::CTest() -> no need to fully qualify name, i.e. Test::CTest {} CTest::~CTest() {} Thanks for your time & help. int FreeFunction(void); is

Dealing With Duplicate Fully Qualified Names

て烟熏妆下的殇ゞ 提交于 2019-12-02 05:56:44
问题 Like the title says, is there a way to deal with this? I have imported two separate third party libraries and they have a fully qualified class name conflict. Right now both libraries are being imported in jar form, and it appears that in some environments (command line invocation, Eclipse) the correct class is found and in others (Maven) the wrong class is found and I get a missing method exception. If no solution can be found, I can fall back to re-factoring one of these libraries and

Dealing With Duplicate Fully Qualified Names

醉酒当歌 提交于 2019-12-02 00:45:15
Like the title says, is there a way to deal with this? I have imported two separate third party libraries and they have a fully qualified class name conflict. Right now both libraries are being imported in jar form, and it appears that in some environments (command line invocation, Eclipse) the correct class is found and in others (Maven) the wrong class is found and I get a missing method exception. If no solution can be found, I can fall back to re-factoring one of these libraries and rebuilding the jar, but I would rather not have to repeat that work every time the library has an update.

What is the fully qualified name of a friend function defined inside of a class?

巧了我就是萌 提交于 2019-11-30 06:33:40
问题 What is the fully qualified name of a friend function defined inside of a class? I recently saw an example analogous to the following. What is the fully qualified name of val() below? #include <iostream> namespace foo { class A { int x; public: A(int x = 0) : x(x) { } friend int val(const A &a) { return a.x; } }; } int main() { foo::A a(42); // val() found using ADL: std::cout << val(a) << std::endl; // foo::val(a); // error: 'val' is not a member of 'foo' // foo::A::val(a); // error: 'val'