namespaces

Accessibility of variables.

HI, i have small doubt related to the accessibility of variables. int i; //default the linkage is external const int i; //default linkage is internal extern int i; //explicitly assigning linkage as external class a { int l; //Default linkage is external void f() { int k; //default linkage is e...

C#: namespaces and classes structure

Coming from Java , I'm used to the package structure (com.domain.appname.tier) Now I've started working on a C# project , where all the projects have depth of 1: i.e ProjectA - Utilities.cs - Validation.cs - .... - Extraction.cs and all the cs files are around 2,500 lines long ... How do you order your classes and ...

Preserving subelement namespace serialization with lxml

I have a few different XML documents that I'm trying to combine into one using lxml. The problem is that I need the result to preserve the namespaces on each of the sub-documents' root nodes. Lxml seems to want to push any namespace declarations used more than once to the root of the new document, which breaks in my application (it is ...

Python: Why should 'from <module> import *' be prohibited?

If you happen to have from <module> import * in the middle of your program (or module), you would get the warning: /tmp/foo:100: SyntaxWarning: import * only allowed at module level I understand why import * is discouraged in general (namespace invisibility), but there are many situations where it would prove convenient, especially...

Is it a good idea to using class as a namespace in Python

I am putting a bunch of related stuff into a class. The main purpose is to organize them into a namespace. class Direction: north = 0 east = 1 south = 2 west = 3 @staticmethod def turn_right(d): return turn_to_the_right @staticmethod def turn_left(d): return turn_to_the_left # defined a short alias because ...

How do I find the file path from a namespace.class name?

I'm programatically looking ito a .aspx file and getting the file class name declared in its CodeBehind. For example, when analyzing myFile.aspx I read in its Page Directive and found its CodeBehind equals "myApplication\myPage.aspx.vb". Then I use the code below: [Code] Dim Assm As System.Reflection.Assembly = System.Reflection.Assem...

ASP.net c# publicly accessible functions in namespace

In my namespace I can have public classes which are accessible to all other pages in my namespace. How do I go about having public functions? Do I have to create a class with the functions in it? Or is there an easier way? ...

Why is my constructor being called over and over?

I've got the following h file: #ifndef GLOBAL_DATA_H_ #define GLOBAL_DATA_H_ class GlobalData { public: GlobalData(); ... private: ... }; namespace global_data { static GlobalData globalDataInstance; } #endif Countless files include the header file above, and access global_data::globalDataInstance. If I put a bre...

Multiple namespace declaration in C++

Is it legal to replace something like this: namespace foo { namespace bar { baz(); } } with something like this: namespace foo::bar { baz(); } ? ...

C++ Single Header File Structure

I want to speed up the build time of my c++ project, and I am wondering if my current structure may cause unnecessary recompilations. I have *.cc and corresponding *.h files, but all my *.cc files include a single header file which is main.h. In main.h, I include everything necessary and extern global variables and declare the function...

Having a problem with namespaces and set_include_path() in PHP

C:\xampp\htdocs contains Controller.php and ApplicationHelper.php. C:\xampp\htdocs\site contains index.php. Here is the error I am getting: Fatal error: Class 'site\controller\ApplicationHelper' not found in C:\xampp\htdocs\Controller.php on line 17 I'm new to the whole namespaces business but I'm not 100% sure that thats whats behin...

Type within namespace in c++

Suppose I defined A::B::int, how can I refer to the standard C++ int inside A::B? ...

Working of "imports namespace"

I knew from here that we have to do the explicit imports for child namespace because imports will not include the child namespace. But my question is that if I do "imports System" whether it will include all the classes/methods inside that namespace in the IL/native code or only referred ( used inside the application) will be included ...

Using a class file/reference it?

If you use a you assembly reference (myExample.dll), you add like this to the top using myExample; Now if you create a class file, how do you reference it? ...

use sfinae to test namespace members existence

Hello, I was trying to figure out if it is possible to use sfinae to test namespace member existence. Google is rather silent about it. I've tried the following code, but it fails. namespace xyz{ struct abc{}; } struct abc{}; struct test_xyz{ typedef char yes; typedef struct{ char a[2]; } no; template <class C> static yes test(...

Rails 2.3.8: namespace + default route (server-dependent routing issue)

Hello! I have FriendshipRequests controller under controllers/users/ namespace. The problem appeared after setting up stage server: same url is processed different locally and on the stage. locally (mac os X, ruby 1.8.7p174, frozen rails 2.3.8, rack 1.1.0) /users/friendship_requests/accept?req_id=3 routes to Processing Users::Frien...

Is there a specific reason nested namespace declarations are not allowed in C++?

The standard does not allow code like this: namespace Hello::World { //Things that are in namespace Hello::World } and instead requires namespace Hello { namespace World { //Things that are in namespace Hello::World }} What is the rationale? Was this simply not thought of at the time, or is there a specific reason it is not inc...

Namespaces qualified with :: in C++

What does it mean if namespace in C++ is qualified with ::? For example ::testing::Test. ...

Where to place joining classes?

Abstract example: If I have a system with domains of "Fleet" containing a "Vehicle" class, and "Customers" containing a "Driver" class, where would you place a joining class (which would detail lifecycle, insurance claims, and other information about the relationship)? Fleet and Customer concerns are equally important to the system and v...

Secure use of GAE application namespace

Hi there, I'd like to have a mapping of users to accounts, and then have users directed to a namespace corresponding to their account. Having looked at the appengine_config.py from the suggested example, there appear to be a few suggested ways to determine what the namespace ought to be, i.e. Server name Google Apps Domain Cookie I...