namespaces

What is the best way to emulate "classes" in Javascript? (with or without a framework)

Update: I've wikified this so it can become a more useful resource. What is the best way to emulate classes (and namespaces) in Javascript? I need to create a Javascript library and have limited experience with the language. I always thought that it had native support for classes, but it is less related to Java than I had assumed. I...

Using .net 3.0 namespaces in .net 2.0

Is there anyway to make it possible to use .net 3.0 namespaces in a .net 2.0 application? I'm specifically looking to use the System.Windows.Media.Media3D namespace. Edit: I am looking to use the actual assemblies, not just the namespaces. Poor wording on my part. ...

Why are unnamed namespaces used and what are their benefits?

I just joined a new C++ software project and I'm trying to understand the design. The project makes frequent use of unnamed namespaces. For example, something like this may occur in a class definition file: // newusertype.cc namespace { const int SIZE_OF_ARRAY_X; const int SIZE_OF_ARRAY_Y; bool getState(userType*,otherUserType*)...

Uses for anonymous namespaces in header files

Someone asserted on SO today that you should never use anonymous namespaces in header files. Normally this is correct, but I seem to remember once someone told me that one of the standard libraries uses anonymous namespaces in header files to perform some sort of initialization. Am I remembering correctly? Can someone fill in the deta...

C++ namespaces: cross-usage

Consider the following example. It consists of two header files, declaring two different namespaces: // a1.h #pragma once #include "a2.h" namespace a1 { const int x = 10; typedef a2::C B; } and the second one is // a2.h #pragma once #include "a1.h" namespace a2 { class C { public: int say() { return a1::x...

Project Naming

As a beginner/intermediate developer one problem I run into as my projects get bigger and more abstracted away as i use more OOP principles I have a problem with naming things. Like when i have multiple projects or class libraries I don't know what to name them. I see things from xxx.Core to xxx.Main or have even seen xxx.BLL and xxx.D...

How can I convince skeptical colleagues about proper namespaces in .Net?

Hi all, My team is working on a conversion project to convert one product (but with many facets) from VB6 to .Net (we have over ~300k LOC). Before I got on board, the decision was made that regardless of the location of the assembly, or folder structure, all classes / structs will be in one namespace: . They even go as far as changing...

autoload with namespace

I'm wondering how autoload will work with the namespace in PHP 5.3. Has anyone with 5.3 tested this? Do you have to include a file before you can use its namespace? Or will the class name be given with namespaces to autoload? Will these examples work correctly? //file My\Some\Object1.php is not included yet $obj1 = new My\Some\Object...

Greasemonkey namespace..what is it for?

I'm learning how to use greasemonkey and was wondering what the @namespace metadata part is used for. Does it have to be a web address or can it be a folder/directory on my computer? Does it even need to be filled in or can I just ignore it? Thanks for the help :) ...

C# Open Source Project Namespace

Hi there, I am considering releasing one of my class libraries written in C# as open source. Before doing that, I am trying to do some refactoring so that it meets the demands of the general public :) I wonder what would be the best namespace schema to use? Basically, I see the following options: namespace MyTool: This just doesn't r...

Namespace Design and Class Awareness

I remember reading once (I believe the book was the .NET Framework Design Guidelines) that when you are designing a framework or class library that you should take care in how you arrange the classes in your namespaces. Specifically, classes in parent namespaces should have no knowledge of classes in child namespaces. Conversely, it is p...

Namespaces in C

Is there a way to (ab)use the C preprocessor to emulate namespaces in C? I'm thinking something along these lines: #define NAMESPACE name_of_ns some_function() { some_other_function(); } This would get translated to: name_of_ns_some_function() { name_of_ns_some_other_function(); } ...

C++ namespace and include

Why do we need both using namespace and include directives in C++ programs ? For example, #include <iostream> using namespace std; int main() { cout << "Hello world"; } Why is it not enough to just have #include or just have "using namespace std" and get rid of the other ? (I am think of an analogy with Java, import java.net.* ...

Namespaces and folder structures in c# solutions: how should folders on disk be organised?

First off, let’s agree that namespace should match folder structure and that each language artefact should be in its own file. (see http://stackoverflow.com/questions/4664/should-the-folders-in-a-solution-match-the-namespace ). The next question is how the folders should actually be organised on disk. Suppose I have ClassC in the A...

How to use XPath function in a XPathExpression instance programatically?

My current program need to use programatically create a XPathExpression instance to apply to XmlDocument. The xpath needs to use some XPath functions like "ends-with". However, I cannot find a way to use "ends-with" in XPath. I It throw exception like below Unhandled Exception: System.Xml.XPath.XPathException: Namespace Manager ...

How do I fetch all methods from a given namespace?

hello I want all the Method-ClassName from namespace like i have system.windows.Forms wehen in visual studio we rigt system.windows.Forms. it will suggest box of all the related method,class,enum extra i need to fetch the same ,how can i do that in C# Thanks ...

MS Robotics Studio: "contract is different from that of the namespace"

I'm trying to build a DSS service using MS Robotics Studio and VS 2008, but when I build, I get an error from dssproxy.exe saying: The class MyServiceName has a ContractAttribute but the contract is different from that of the namespace. and the build fails because dssproxy returns code 10. Does anyone know what this message means...

C#: How to remove namespace information from XML elements

How can I remove the "xmlns:..." namespace information from each XML element in C#? ...

How to resolve naming conflicts when multiply instantiating a program in VxWorks.

I need to run multiple instances of a C program in VxWorks (VxWorks has a global namespace). The problem is that the C program defines global variables (which are intended for use by a specific instance of that program) which conflict in the global namespace. I would like to make minimal changes to the program in order to make this work....

What is the significance of trailing slashes in a namespace URI?

I have been studying SOAP and WSDL in preparation for implementing a web service. One thing that I have encountered that puzzles me is that some of the URIs that I have seen use a trailing slash such as: http://www.w3.org/some-namespace/ while other examples that I have studied omit this trailing slash. I really have several questio...