namespaces

Why isn't the Type class in the System.Reflection namespace?

Everything about Type is reflective in nature. Is it because Type is used more often than the rest of the classes in System.Reflection? Or because it functions more like a system class than a reflection class? In short, I've always wondered what the motivation behind the location of System.Type was. ...

Which namespace does operator<< (stream) go to?

If I have have some overloaded ostream operators, defined for library local objects, is its okay for them to go to std namespace? If I do not declare them in std namespace, then I must use using ns:: operator <<. As a possible follow-up question, are there any operators which should go to standard or global namespace? ...

Global Import/using Aliasing in .NET

Using import aliasing in one file/class, we can reference class library namespaces by assigning our own custom alias like this: ' VB Imports Db = Company.Lib.Data.Objects // C# using Db = Company.Lib.Data.Objects; And then we are able to reference the classes inside of Company.Lib.Data.Objects by using the Db alias that we assigned....

Accessing a class's containing namespace from within a module

I'm working on a module that, among other things, will add some generic 'finder' type functionality to the class you mix it into. The problem: for reasons of convenience and aesthetics, I want to include some functionality outside the class, in the same scope as the class itself. For example: class User include MyMagicMixin end # S...

When should clojure keywords be in namespaces?

In clojure, keywords evaluate to themselves, e.g.: >>:test :test They don't take any parameters, and they aren't bound to anything. Why then, would we need to qualify keywords in a namespace? I know that creating isa hierachies using derive requires namespace qualified keywords. Are there any other cases where there is a clear nee...

Reflection alternative for switch on enum in order to select namespace/class

Hi, I have an interface named IHarvester. There are 3 implementations of that interface, each under their own namespace: Google Yahoo Bing A HarvesterManager uses the given harvester. It knows the interface and all 3 implementations. I want some way of letting the class user say in which harvester it wants to use. And in the code ...

Getting "<kml:..." everywhere, updating a Kml file

I'm reading in a Kml file, changing the placemarks' names, and saving it again. var KmlFile = XDocument.Load("C:\\Inetpub\\wwwroot\\GeotagService\\Kml\\Photographs.kml"); XNamespace KmlNamespace = "http://www.opengis.net/kml/2.2"; // find the Placemarks in the Photos folder IEnumerable<XElement> Placemarks = KmlFile.Element(KmlNamespa...

Can a single XML schema have multiple targetNameSpaces?

I have a complexType defined in targetNameSpace as say "http://xyz.example.com" and used in many places. Now i want to use it in my newly created XSDs with different namespace say "http://abc.example.com". Can i do this? Or do i have to use the same namespace? ...

"using namespace" for Doxygen comments

All classes of my library are defined within a namespace. When I create a mainpage for Doxygen I have to explicitly use this namespace within comments to make Doxygen generate links. I would like to use something like "using namespace" for the whole comment block. An example: /** * \mainpage My Library * * Use MyLibraryNamespace::MyCla...

How do I add a default namespace with no prefix using XMLSerializer

Hi Using C# and .Net 3.5; I am trying to generate an XML document that contains the default namespace without a prefix using XMLSerializer. eg. <?xml version="1.0" encoding="utf-8" ?> <MyRecord ID="9266" xmlns="http://www.website.com/MyRecord"&gt; <List> <SpecificItem> using the following code string xmlizedString = nul...

Long/compound namespaces when using C++/CLI

I'm working on a project where a mixture of C# (95%) and C++/CLI (5%) are used. The namespace naming convention I'm aiming for is the good old Company.Technology.Etc.. This works perfectly fine for C#. Now, can I carry this across to C++ classes? I read here that compound namespaces aren't supported in C++. Am I stuck with the clumsy ...

Is there any JAX-WS implementation that support dynamic namespace in generated client ?

I generated a JAX-WS client (proxy API) using JAXWS-RI wsimport.bat from a WSDL having as namespace "http://a.mydomain". I'd like to reuse the same generated proxy against a service having as namespace "http://b.mydomain" but targetnamespace "http://a.mydomain" is harcoded all over the generated classes. Does anybody know any good solu...

Declaring an enum within a class

In the following code snippet, the Color enum is declared within the Car class in order to limit the scope of the enum and to try not to "pollute" the global namespace. class Car { public: enum Color { RED, BLUE, WHITE }; void SetColor( Car::Color color ) { _color = color; } Car::Color Get...

Porting C++-code from Windows to Unix: systemcalls colliding with name of functions

Hi I'm porting some crufty C++ Windows-code to Linux, which uses functions called "open" and "close" inside every class... Very bad style, or? Luckily that wasn't a problem in windows, since their systemcalls are named different. When I try to call the systemcalls open() or close() I'm getting some compiler error about "no matching fun...

How to have a class in a namespace that has the same name that is part of another namespace in a .net class library

ok...this gets confusing for me to explain, so i will show a class from one namespace and a seperate namespace... Company.Product.Domain (this represents the class that contains methods specific to that class, i named it "Domain" just so you can see how I'm using the same name in a separate namespace Company.Product.Domain.Data.Contra...

[c++] Resolving namespace conflicts

I've got a namespace with a ton of symbols I use, but I want to overwrite one of them: external_library.h namespace LottaStuff { class LotsOfClasses {}; class OneMoreClass {}; }; my_file.h using namespace LottaStuff; namespace MyCustomizations { class OneMoreClass {}; }; using MyCustomizations::OneMoreClass; my_file.cpp int main(...

Is it possible to autoload a file based on the namespace in PHP?

Would what mentioned in the title be possible? Python module style that is. See this example for what I exactly mean. index.php <?php use Hello\World; World::greet(); Hello/World.php <?php namespace Hello\World; function greet() { echo 'Hello, World!'; } Would this be possible? ...

How to name multiple versioned ServiceContracts in the same WCF service?

When you have to introduce a breaking change in a ServiceContract, a best practice is to keep the old one and create a new one, and use some version identifier in the namespace. If I understand this correctly, I should be able to do the following: [ServiceContract(Namespace = "http://foo.com/2010/01/14")] public interface IVersionedSer...

WCF REST: Is it possible to remove the namespace added to my response XML?

I want to remove the default xmlns (namespace) added to my service's response (see image below) Is there a way to do this? This because in order to consume this service from a C# windows app, I have to add the namespace to every data object's header - DataContract that I will be serializing. ...

do the Python libraries have a natural dependence on the global namespace?

I first ran into this when trying to determine the relative performance of two generators: t = timeit.repeat('g.get()', setup='g = my_generator()') So I dug into the timeit module and found that the setup and statement are evaluated with their own private, initially empty namespaces so naturally the binding of g never becomes accessib...