namespaces

How should I name packages if I don't have a domain associated with me?

So most Java resources when speaking of packages mention a com.yourcompany.project setup. However, I do not work for a company, and don't have a website. Are there any naming conventions that are common? An email address, perhaps? ...

How can I "unuse" a namespace?

One of the vagaries of my development system (Codegear C++Builder) is that some of the auto-generated headers insist on having... using namespace xyzzy ...statements in them, which impact on my code when I least want or expect it. Is there a way I can somehow cancel/override a previous "using" statement to avoid this. Maybe... unu...

Namespaces and Operator Overloading in C++

When authoring a library in a particular namespace, it's often convenient to provide overloaded operators for the classes in that namespace. It seems (at least with g++) that the overloaded operators can be implemented either in the library's namespace: namespace Lib { class A { }; A operator+(const A&, const A&); } // namespace Lib ...

Same class, different namespaces, a way to simplify?

I'm working with a webservice that offers almost duplicated code across two namesspaces. Lets say for example PigFeet and HorseFeet, both namespaces contain a Feet class and other code that works with the Feet class requires it to be part of that same namespace. Right now In my code I'm forced to do something like this: if( _animalTyp...

What is the best way to solve an Objective-C namespace collision?

Objective-C has no namespaces; it's much like C, everything is within one global namespace. Common practice is to prefix classes with initials, e.g. if you are working at IBM, you could prefix them with "IBM"; if you work for Microsoft, you could use "MS"; and so on. Sometimes the initials refer to the project, e.g. Adium prefixes classe...

What is tempuri.org?

Why does tempuri.org exist? Why does each XML Webservice require its own namespace, unique from any other on the web? ...

How do you handle arbitrary namespaces when querying over Linq to XML?

I have a project where I am taking some particularly ugly "live" HTML and forcing it into a formal XML DOM with the HTML Agility Pack. What I would like to be able to do is then query over this with Linq to XML so that I can scrape out the bits I need. I'm using the method described here to parse the HtmlDocument into an XDocument, but...

Do you really use your reverse domain for package naming in java?

For a long time ago, I have thought that, in java, reversing the domain you own for package naming is silly and awkward. Which do you use for package naming in your projects? ...

How to handle a class name conflict when porting old code?

I'm trying to port an old library (that doesn't use namespaces as far as I can tell) to modern compilers. One of my targets can't tell the difference between System::TObject and ::TObject (without a namespace). System::TObject is native to the compiler. I've tried a using directive, i.e. using ::TObject; But that doesn't do it. The ob...

XML Data Binding with Namespaces

I want to use data binding with an XML document to populate a simple form that shows details about a list of people. I've got it all set up and working like so right now: <Window x:Class="DataBindingSample.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Ti...

POST request in namespaced resource controller going to index action instead of create

I have a namespaced controller for some admin functionality. My create form does not work -- it ends up routing the request to the index action instead of the create action. Why isn't the POST getting routed to the create action as it should (being RESTful)? routes.rb: map.namespace :admin do |admin| admin.resources :events ...

Which is better for a rails site? /{login} or /user/{login}

Which is better (for the user, for longevity, for performance, for whatever) to have: http://{site}/{login} e.g. http://wildobs.com/adam_jack or http://{site}/user/{login} Pros of former: User feels more special. URLs are shorter. Cons of former: Cannot have users w/ logins matching keywords, and keywords likely grow over time....

Do you prefer explicit namespaces or 'using' in C++?

When using C++ namespaces, do you prefer to explicitly name them, like this: std::cout << "Hello, world!\n"; Or do you prefer using namespace: using namespace std; cout << "Hello, world!\n"; And if if you prefer the latter, do you declare your usings at file or function scope? Personally I prefer to explicitly name them - it's mor...

Best approach with dynamic classes using Python globals()

Hi! I'm working on a web application that will return a variable set of modules depending on user input. Each module is a Python class with a constructor that accepts a single parameter and has an '.html' property that contains the output. Pulling the class dynamically from the global namespace works: result = globals()[classname](para...

How do I print a groovy Node with namespace preserved?

When I use this code to output some XML I parsed (and modified) with XmlParser XmlParser parser = new XmlParser() def root = parser.parseText(feedUrl.toURL().text) def writer = new StringWriter() new XmlNodePrinter(new PrintWriter(writer)).print(root) println writer.toString() the namespace declarations on the roo...

Can I change the Dojo namespace to something other than dojo?

I know you can do it for jQuery using jQuery.noConflict. Is there a way to do something similar with Dojo? ...

Ruby support for XML namespaces

Hello, I work at a small company and our production system uses a hand-rolled RESTful API, implemented in Java with JAXB. We now find that we're taking on customers who use Ruby on Rails, and I have to come up with a reference implementation to show customers how to use our API in Ruby. I'd love to be able to just tell them to use Acti...

Namespace collisions

How is it possible that .NET is finding the wrong 'MyType' in this scenario? I have a type A.B.C.D.MyType in a project that I'm working on, and I'm referencing a DLL that has a type A.B.MyType? I do not have any 'using A.B;' statements anywhere in my code, and I do have 'using A.B.C.D;'. When I compile, the compiler thinks any naked ref...

Polluting the global namespace

I think most C++ programmers here would agree that polluting the global namespace is a bad idea, but are there times when this rule can be ignored? For example, I have a type that I need to use all over a particular application - should I define it thus: mytypes.h typedef int MY_TYPE; foo.cpp MY_TYPE myType; Or use a namespace: m...

How to host a rooted namespace extension in Windows Explorer

There is a method to create a namespace extension rooted in a particular folder. It involves creating folder with a name like: My Custom NSE.{785EE551-DEE1-4F57-A8C9-0EF76F346A29} And Windows Explorer will automatically host the NSE of that clsid at that location. But for the life of me i cannot find the syntax anymore. It used to b...