namespaces

'Helper' functions in C++

While refactoring some old code I have stripped out a number of public methods that should actually of been statics as they a) don't operate on any member data or call any other member functions and b) because they might prove useful elsewhere. This led me to think about the best way to group 'helper' functions together. The Java/C# wa...

What's wrong with my XPath/XML?

I'm trying a very basic XPath on this xml, and it doesn't find anything. I'm trying both .NET and this website, and XPaths such as "//PropertyGroup", "/PropertyGroup" and "//MSBuildCommunityTasksPath" are simply not working for me (they compiled but return zero results). ...

Select Element in a Namespace with XPath

I want to select the topmost element in a document that has a given namespace (prefix). More specifically: I have XML documents that either start with /html/body (in the XHTML namespace) or with one of several elements in a particular namespace. I effectively want to strip out /html/body and just return the body contents OR the entire r...

When have we any practical use for hierarchical namespaces in c++?

I can understand the use for one level of namespaces. But 3 levels of namespaces. Looks insane. Is there any practical use for that? Or is it just a misconception? ...

The Rails Way - Namespaces

I have a question about how to do something "The Rails Way". With an application that has a public facing side and an admin interface what is the general consensus in the Rails community on how to do it? Namespaces, subdomains or forego them altogether? ...

How to retrieve namespaces in XML files using Xpath

Hello, I have an XML file that starts like this: <Elements name="Entities" xmlns="XS-GenerationToolElements"> I'll have to open a lot of these files. Each of these have a different namespace but will only have one namespace at a time (I'll never find two namespaces defined in one xml file). Using XPath I'd like to have an automatic ...

How can I wrap BOOST in a separate namespace?

I'm looking to have two versions of BOOST compiled into a project at the same time. Ideally they should be usable along these lines: boost_1_36_0::boost::shared_ptr<SomeClass> someClass = new SomeClass(); boost_1_35_0::boost::regex expression("[0-9]", boost_1_35_0::boost::regex_constants::basic); ...

how do you organize your namespaces?

So I have logical entities (person, country, etc.), gui elements / controls, data and navigation controllers / managers, then things like quadtrees and timers and I always struggle with cleanly separating these things into logical namespaces I usually have something like this: Leviathan.GUI.Controls Leviathan.GUI.Views Leviathan.Entit...

Should Usings be inside or outside the namespace

I have been running StyleCop over some C# code and it keeps reporting that my using statements should be inside the namespace. Is there a technical reason for putting the using statements inside instead of outside the namespace? Edit: There appears that there is no difference after compliation. The reasons for putting them inside the n...

What are XML namespaces for?

This is something that I always find a bit hard to explain to others: Why do XML namespaces exist? When should we use them and when should we not? What are the common pitfalls when working with namespaces in XML? Also, how do they relate to XML schemas? Should XSD schemas always be associated with a namespace? ...

What are some non-standard ways to use namespaces?

I am interested in unprecedented, cool, and esoteric ways to use namespaces. I know that many advanced developers "hack" namespaces by, for example, using them as references to string constants. In the string constants example, the idea is to implement DRY (DRY = Do Not Repeat Yourself) and you can keep all your strings in one file. ...

How do you find the namespace/module name programatically in Ruby on Rails?

How do I find the name of the namespace or module 'Foo' in the filter below? class ApplicationController < ActionController::Base def get_module_name @module_name = ??? end end class Foo::BarController < ApplicationController before_filter :get_module_name end ...

can I expose a class from another .net namespace as a class in my namespace?

Can I expose a class from another .net namespace as a class in my namespace? I use a class - antlr.collections.AST - as the return type for a function belonging to a class in my namespace; as a result, the user has to have using antlr.collections; using myNamespace; at the top of their files in order to use my function. Can I make m...

Add a namespace to elements using XSLT

I have an XML document with un-namespaced elements, and I want to use XSLT to add namespaces to them. Most elements will be in namespace A; a few will be in namespace B. How do I do this? ...

Ideal number of classes per namespace branch

What number of classes do you think is ideal per one namespace "branch"? At which point would one decide to break one namespace into multiple ones? Let's not discuss the logical grouping of classes (assume they are logically grouped properly), I am, at this point, focused on the maintainable vs. not maintainable number of classes. ...

In what namespace should you put interfaces relative to their implementors?

Specifically, when you create an interface/implementor pair, and there is no overriding organizational concern (such as the interface should go in a different assembly ie, as recommended by the s# architecture) do you have a default way of organizing them in your namespace/naming scheme? This is obviously a more opinion based question b...

What is the impact of having namespaces in multiple DLLs?

I've inherited a VB.net project that generates 2 DLLS: one for the web app, and another for the "business layer". This is for a sub-app of a larger web site. (Using VS2005). The problem is that that something doesn't smell right with the DLL & namespace structure, and I'd like to know if there are any performance impacts. The main web...

Unnamed/anonymous namespaces vs. static functions

A little-used feature of C++ is the ability to create unnamed (anonymous) namespaces, like so: namespace { int cannotAccessOutsideThisFile() { ... } } // namespace You would think that such a feature would be useless -- since you can't specify the name of the namespace, it's impossible to access anything within it from outside. Bu...

How come classes in subfolders in my App_Code folder are not being found correctly?

I am getting the following error when I put class files in subfolders of my App_Code folder: errorCS0246: The type or namespace name 'MyClassName' could not be found (are you missing a using directive or an assembly reference?) This class is not in a namespace at all. Any ideas? ...

What is the difference between "global::System" and "System" in .NET?

I just upgraded a VS 2005 project to VS 2008 and was examining the changes. I noticed one of the .Designer.cs files had changed significantly. The majority of the changes were simply replacements of System with global::System. For example, protected override System.Data.DataTable CreateInstance() became protected override global::S...