namespaces

Should we be teaching beginners to use a global namespace?

NOTE: I am pretty much a beginner myself. This question concentrates on C++ usage, since that is the only language I have experience with. There seems to be a consensus on Stack Overflow to use using namespace std; in the code examples provided for C++. I originally learned it this way, and was never taught WHY this is a problem later o...

How to avoid conflicts when using services? (.NET C#)

Imagine I have this class namespace CommonLibrary { public class Report() { public DateTime Begin { get; set; } public int Count { get; set; } } } This is the return type of a WCF Service method. When I use svcutil.exe it regenerates the class from metadata: namespace CommonLibrary { [System.Code...

XLSX- how to get rid of the default namespace prefix x: ?

I'm generating XLSX spreadsheet using OOXML SDK, and I need to get rid of x: namespace prefix. How can I achieve this? using (SpreadsheetDocument doc = SpreadsheetDocument.Open("template.xlsx", true)) { //Save the shared string table part if (doc.WorkbookPart.GetPartsOfType().Count() > 0) ...

VBScript, MSXML and Namespaces

Given the following XML: <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; <soap:Body> <GetMsisdnResponse xmlns="http://my.domain.com/"&gt; <GetMsisdnResult> <RedirectUrl>ht...

WCF service reference namespace differs from original

I'm having a problem regarding namespaces used by my service references. I have a number of WCF services, say with the namespace MyCompany.Services.MyProduct (the actual namespaces are longer). As part of the product, I'm also providing a sample C# .NET website. This web application uses the namespace MyCompany.MyProduct. During initial...

How do you give a namespace an alias in C#

I have a large namespace: Foo.Bar.Space.Station.Bar and I was to alias is as something shorter like, Station. How do I do that in the using section? using Foo.Bar.Space.Station.Bar Object ??? so I can do this Station.Object obj = new ... instead of Foo.Bar.Space.Station.Bar.Object obj = new ... ...

Can I include iostream header file into custom namespace?

namespace A { #include <iostream> }; int main(){ A::std::cout << "\nSample"; return 0; } ...

Is there a need of namespaces in database?

Often I am frustrated by the fact that there are a lot of tables, views, stored procedure all placed under one hierarchy. I am looking for a way (like namespaces) that would group related tables under one banner. This would not only be easy to understand. Also i would avoid the need for coming up with fancy names. I am not aware of any p...

How can I group functions in an ASP.NET class?

I currently have a VB.NET class named "Customers" and it's been steadily growing in size and I now have a couple dozen functions in it. Is there a way of maintaining the functions in the same class? Since they still use common private methods, but group them by similarity. For example: Class Customers -GetData ---GetCustomerObject() -...

How do I import the entire package but exclude some in Clojure?

I want to import the entire weka.classifiers.functions package but dont want to import RBFNetwork class. (ns com.wekatest (:import (weka.classifiers Classifier Evaluation) (weka.classifiers.functions) (weka.core Attribute FastVector Instance Instances))) Thanks. Edit: (weka.classifiers.functions) doesnt impor...

In C++, what is a "namespace alias"?

What is a "namespace alias" in C++? How is it used? ...

Javascript Namespace Conflict

I have the following plugin, which takes a partial game name, bounces it off our DataQuery object to get a list of items from the server (basic autocompleter/selector). The problem I am having is this. I am using it on a page, where the selector appears in a dialog box. When the user is done, I 'destroy' the selector, and then recreate...

Type or namespace could not be found (Web Site)

I created an ASP.NET Web App project and it builds and works correctly now. However, I am trying to add this project to my website. So what I've done is I create a new Web Site from VS and then I added all of the .CS files from my Web App project to this Web Site. Even though the Web App project builds successfully, when I use this ...

Namespace correctness

I'm trying to question my own code correctness on the following minimalist example in which a header file lifts a identifier into the current namespace. #include <string> namespace mine { using std::string; // std::string lifted into mine struct agent { string name; }; } This is a suggestion I made recently ...

Python: How to import part of a namespace

I have a structure such this works : import a.b.c a.b.c.foo() and this also works : from a.b import c c.foo() but this doesn't work : from a import b.c b.c.foo() nor does : from a import b b.c.foo() How can I do the import so that b.c.foo() works? ...

Java+DOM: How do I elegantly rename an xmlns:xyz attribute?

Hello! I have something like that as input: <root xmlns="urn:my:main" xmlns:a="urn:my:a" xmlns:b="urn:my:b"> ... </root> And want to have something like that as output: <MY_main:root xmlns:MY_main="urn:my:main" xmlns:MY_a="urn:my:a" xmlns:MY_b="urn:my:b"> ... </MY_main:root> ... or the other way round. How do ...

What does the runtime do with XAML namespaces?

In every XAML document, there are one or more namespace declarations. ie: <Window x:Class="WindowsApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1 Height="300"> The declarations are in the form of a URL, leading me to ask: Does...

How do you structure your reusable libraries?

How do you organize your code so that it can easily be ported across business projects without carrying unnecessary bloat? For example (in .Net), let's say you have the following namespaces: namespace Computers - Hardware - Motherboard - GPU namespace Monitors - Display - Mirrors namespace Peripherals...

Alter namespace prefixing with ElementTree in Python

By default, when you call ElementTree.parse(someXMLfile) the Python ElementTree library prefixes every parsed node with it's namespace URI in Clark's Notation: {http://example.org/namespace/spec}mynode This makes accessing specific nodes by name a huge pain later in the code. I've read through the docs on ElementTree and namespa...

Variable functions with namespaces in PHP

Hey all, I'm wondering if there is a way to call variable functions with namespaces. Basically I'm trying to parse tags and send them to template functions so they can render html` Here's an Example: (I'm using PHP 5.3) // Main php file require_once 'template.php'; foreach (array("javascript","script","css") as $tag) { echo templ...