FAQ Database Discussion Community

## C++ Unable to overload function in class (and namespace) [duplicate]

c++,function,class,compilation,namespaces
This question already has an answer here: How come a non-const reference cannot bind to a temporary object? 11 answers I just created a cool class in a namespace and therefore I wanted to create 2 functions. They should have the same name, but different parameters. But every time...

## Javascript utility function to safely create a namespace

javascript,namespaces
What is the best and most failsafe way to dynamically and safely create namespaces in JS? I need a utility function for a small utility library I'm working on currently. Basically, I want it to check if any part of my namespace already exists, and is an object, otherwise this...

## c++ operator overloading and associated namespace

c++,namespaces,operator-overloading,clang,argument-dependent-lookup
The following simplified example compiles in gcc and Visual Studio, but fails in clang !? namespace N { struct A {}; template <typename T> double operator+ (T a, double d) {return d;} template <typename T> double operator+ (double d, T a) {return d;} } void test() { N::A a; double...

## how to use class of other project in a solution (internal)? [duplicate]

c#,namespaces
This question already has an answer here: How to use a Class from one C# project with another C# project 7 answers Environment : In C#, I have a solution with many project. They were added with *.csproj files. Problem : In a project, you can use classes of...

## XML, XSL namespaces

xml,xslt,namespaces
I'm new to XML especially namespaces. I made all the documents and everything seems to work fine, but I don't know whether I'm really using namespaces (which is requirement). Except that my html file are not valid because off this: "Attribute xmlns:xsi not allowed here." and "Attribute xmlns:xslformatting not allowed...

## Namespaces with multiple cyclic inclusion

c++,header,namespaces,include,forward-declaration
I've 3 classes that belong to a namespace "MyNS". "A" uses the "B" and "C", while both "B" and "C" use "A". Here are the structure of my headers: //mynamespace.h #ifndef SOMENAMESPACE_H #define SOMENAMESPACE_H namespace MyNS { class A; class B; class C; } #endif /*******************************************************/ //A.h #ifndef A_H #define...

## Can we add php comments before declaring namespace

php,oop,namespaces
I would like to add php comments before declaring namespace. <?php /* * This is custom namespace * Purpose : to give an example of namespace **/ namespace myNameSpace{ class myNewClass{ /* code */ } } ?> This does not throw any errors but I am not sure if this...

## Ruby namespacing

ruby-on-rails,ruby,namespaces
I'm pretty new to ruby, coming from a php background, but something is not clicking with me. So, let's say I have a Ruby on Rails application and I am versioning my API like so: app |_controllers |_api | |_v1 | | |_application_controller.rb | | |_user_controller.rb | |_application_controller.rb |_application_controller.rb With...

## friendship and namespace issue

c++,namespaces
I'm having troubles with friendship between a class of a namespace and a function as below: How to tell that the friend function is outside of the namespace? Thanks namespace NS { class Class { public: Class(); virtual ~Class(); private: void Foo(); friend void Bar(Class&); }; } void Bar(NS::Class& c)...

## How to differentiate elements in an XSD by namespaces

xml,xsd,namespaces,schema
Given the following XML snippet: ... <ns1:Method> <Parameter1 /> <Parameter2 /> </ns1:Method> <ns2:Method> <Parameter3 /> </ns2:Method> ... Is it possible to write an XML Schema definition, that differs the complexType of Method by its namespace, so that multiple different types named Method are possible? In this example the Method element...

## TYPO3-Upgrade 4.5 to 6.2: namespaces

namespaces,typo3,typo3-6.2.x
I'm updating an old TYPO3 to latest verison 6.2.12. As I do so I replace deprecated classes with the proper namespaces. E.g. t3lib_div to \TYPO3\CMS\Core\Utility\GeneralUtility or t3lib_extmgm to \TYPO3\CMS\Core\Utility\ExtensionManagementUtility. But I cant find the proper namespaced class for t3lib_svbase. Any suggestions? . And I absolutely have no clue what I...

## C# Obtaining Namespace Based on CSProj settings

c#,.net,c#-4.0,visual-studio-2013,namespaces
Is there a way to obtain the .csproj Default Namespace and Visual Studios understanding it without using preprocessor directives? For example: CS Project 1 has a Default Namespace of SomeCompany.ProductA CS Project 2 has a Default Namesapce of SomeCompany.ProductB CS Project 1 has a cs file that exists in BaseClasses/MySpecialBase.cs...

## Parsing XML with undeclared prefixes in Python

python,xml,parsing,namespaces,xml-namespaces
I am trying to parse XML data with Python that uses prefixes, but not every file has the declaration of the prefix. Example XML: <?xml version="1.0" encoding="UTF-8"?> <item subtype="bla"> <thing>Word</thing> <abc:thing2>Another Word</abc:thing2> </item> I have been using xml.etree.ElementTree to parse these files, but whenever the prefix is not properly declared,...

## Namespace entries in PSR-1 standard?

php,namespaces,standards,psr-1
I am looking for the correct way (if either is correct please let me know) to write namespaces in PHP classes that follow PSR-1 standard. I looked around but didn't see anything specific. Is the correct way to use Namespace Foo\Bar; or is it correct to use curly braces such...

## XSD from XML Java Jaxb

java,xsd,namespaces,jaxb
I need to generate in Java the xsd file which using jaxb maven plugin (http://mojo.codehaus.org/jaxb2-maven-plugin/xjc-mojo.html) will produce an XML like the following: <data xmlns = "http://foo.com"> <childData xmlns = "http://bar.com" /> </data> I don't want to edit the jaxb autogenerated classes or something like that. I've already checked similar topics...

## XSLT- Pre Define NameSpace

parsing,xslt,namespaces
Hi I have an XML that upon each delivery has a different unique named Namespace that I cannot pre determine with standard processes. <ABC xmlns:this="urn:uuid:9b1f15a9-69de-11d2-b6bc-fcab70ff7331" version="1.1"> <Extensions> <Identification>urn:uuid:9b1f15a9-69de-11d2-b6bc-fcab70ff7331</Identification> <Extension> <SrcPackage> <this:ABDList> <TaggedValue>111</TaggedValue> </this:ABDList> <this:SubBegin>0</this:SubBegin> </SrcPackage> <MatPackage>...

## Laravel 5 - constantly repeating use statements

php,namespaces,laravel-5,autoload
Is there a central place where I can put 'use' statements so I don't have to keep doing things like this with every single controller I create? <?php namespace App/Http/Controllers use Session; use Auth; use Input; use Log; use Carbon; use Response; use Illuminate\Routing\Controller; class BlaBlaController extends Controller {} Just...

## Fatal error: Class 'Psr\Log\AbstractLogger' not found in Logger.php on line 30

php,namespaces,rackspace-cloud,rackspace,psr-3
I'm getting this error: Fatal error: Class 'Psr\Log\AbstractLogger' not found in /var/www/html/rackspace/vendor/rackspace/php-opencloud/lib/OpenCloud/Common/Log/Logger.php on line 30 This is my Logger.php file <?php /** * Copyright 2012-2014 Rackspace US, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with...

## KDB+ / Q Accessing root namespace from namespace

namespaces,q,kdb
how can I access functions/variables in the root namespace once I jumped into another namespace. Example like this: q)\d .cfg q)domIV:1000 q)\d . q)n:1000 And then later on I know how to access the variable domIV from the other namespace, but I dont know how to access the variable n...

## Require xml namespace prefix on attribute in child node

c#,xml,powershell,namespaces,xml-namespaces
I am attempting to make modifications to a ClickOnce deployment manifest. One thing I need to do is setup the manifest to deploy an icon to the desktop. To do this you need to add the createDesktopShortcut attribute with a true value to the Deployment node. For Example, this is...

## Constructor function - in simple namespace - Javascript

javascript,object,namespaces,prototype
In want to define a function-constructor inside a namespace. The way in which I defined the constructor till now was a simple constructor function without NS, combined with prototypal inheritance. The code looked kind of like: function mySuperObject() { var self = this; self.p1 = ""; self.p2 = "jkejie"; //...

## Accessing the __all__ list of the parent module of a class instance

python,class,python-2.7,module,namespaces
I have an instance of a class SomeClass that is defined within a module m. For the behavior of SomeClass, I need to access the following list: m.__all__ How can I access this list from an instance of SomeClass? Instances of SomeClass have the following built-in: SomeClass.__module__ However, this is...

## Inherit a class with same namespace and same class name

c#,class,inheritance,namespaces,.net-assembly
I manage to work it out in 2 Classes, but I failed in 3. Let's say I have an assembly A.DLL which have namespace = "City" and a class= "NY" (I will refer this class in my question as "A") In My new project My namespace is = "City" and...

## How to Move a class to another dll and change the namespace without altering the method usage

c#,.net,namespaces,refactoring
I have a dll where I have one class which logs to a "channel", another Program listens to the "channel" and writes the logs to the screen. The problem with the dll is that its grown over time and now there are many dependecies in it. I want to remove...

## how to add new account in outlook with Name Space C#2003

c#,outlook,namespaces
public void sendEMailThroughOUTLOOK() { if(MessageBox.Show(PublicFunction.L_Get_Msg("msg",28),"MessageBox",MessageBoxButtons.OKCancel)== DialogResult.OK) { try { // Create the Outlook application. Outlook.Application oApp = new Outlook.Application(); //set default account send mail Outlook.Account account = GetAccountForEmailAddress(oApp,"[email protected]"); // Create a new mail item. Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem); // Set HTMLBody. //oMsg.HTMLBody= "<html> <p...

## R cannot load package forecast due to namespace error

r,namespaces,packages
I tried installing all the dependant packages and also tried another repo source as recommended in another post here. R version 3.2.0 x64 install.packages("fracdiff") install.packages("Rcpp") install.packages("RcppArmadillo") install.packages("colorspace") install.packages("forecast", dep=T) install.packages("forecast", repos=c("http://cran.rstudio.com"),dep=T) library("forecast") then I get Loading required package: zoo Attaching package: ‘zoo’ The following objects are masked from ‘package:base’: as.Date,...

## Usings and assembly references are not automatically imported from C# snippet

c#,.net,visual-studio,namespaces,code-snippets
I'm trying to write a C# snippet with this content: ... <References> <Reference><Assembly>Microsoft.VisualBasic.dll</Assembly></Reference> </References> <Imports> <Import><Namespace>Microsoft.VisualBasic</Namespace></Import> <Import><Namespace>System.Text</Namespace></Import> <Import><Namespace>System.Xml</Namespace></Import> </Imports> ... As explained in the MSDN docs, im following the good structure:...

## C++11 cannot resolve nested namespace

c++,namespaces,nested
say I create a class Foo in foo.h under namespace Fooo like follows: foo.h: namespace Fooo { class Foo { }; } and its corresponding source file: foo.cpp: namespace Fooo { Foo::Foo() { } } I write another source file util.cpp to create some utility functions for the Foo class...

## ExtJS5 Namespace Confusion

extjs,namespaces
I am completely confused on the namespaces in ExtJS5 application. I am using a common folder under the sencha workspace where I keep code I will be using for multiple pages (multiple SPA's). In one application definition I have the following snippet: Ext.define('Admin.Application', { extend: 'Ext.app.Application', name: 'Admin', namespaces: ['ALT'],...

## Disabling default namespaces

namespaces,rust
Rust seems to use some namespaces by default. For example, I don't have to use std::string::String and can simply type String. How can I define my own struct String without clashing with std::string::String? And where can I find a list of the namespaces that are included by default?

## Python class and global vs local variables [duplicate]

python,class,namespaces,global-variables
This question already has an answer here: Python class scoping rules 2 answers I have a problem understanding what is happening with the outcome of the following pieces of code: my_str = "outside func" def func(): my_str = "inside func" class C(): print(my_str) print((lambda:my_str)()) my_str = "inside C" print(my_str)...

php,namespaces

## pyinstaller with namespace packages

python,namespaces,package,pyinstaller
I have a module/package structure where I am using namespace packages, I have multiple user made libraries which I keep in separate repositories, and they have fairly generic names like db, io, utils and so on. To avoid conflict with other packages I have a top level/namespace package named acme,...

## The type or namespace name could not be found Master Page

c#,namespaces
I am using this tutorial for getting the content of Masterpage to content page. http://stackoverflow.com/a/13620436/4725592 But when I try to get the content of the master page with this syntax, I gets the following error The type or namespace name could not be found The syntax : string getProcess =...

## Adding default namespace conditionally using xslt

xml,xslt,namespaces,xml-namespaces,ibm-datapower
Requirement: Check whether a default namespace declaration xmlns="http://www.origoservices.com present in the request xml. If not, add the default namespace declaration. Sample Request xml 1: <message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <m_control> <control_timestamp>2014-11-05T09:30:38.308</control_timestamp> <retry_number>0</retry_number> <expected_response_type>synchronous</expected_response_type> <responder_id>Exchange Life 1</responder_id>...

## Namespace prefix NS1 for href on %tagElement% is not defined, setAttributeNS

svg,safari,namespaces,xml-namespaces,setattribute
I got this error in safari while trying to convert svg to base64 url via code: $svgCopy =$('svg').clone() html = $('<div>').append($svgCopy).html() imgSrc = 'data:image/svg+xml;base64,' + btoa(html) imgEl.src = imgSrc The problem is that when you set attribute with NS (setAttributeNS) safari sets NS\d+ namespace and do not sets xmlns:NS\d+...

## Mysqli inside namespace

php,methods,mysqli,namespaces
I need to use mysqli and prepared statements inside a namespace, this is working fine up until the point where I try and bind parameters, it connects find and prepare works but form there on I get an error saying call to undefined method. I have already googled this and...

## Deleting namespace in Socket IO

node.js,namespaces,socket.io,typescript
This question has been asked before here, but I've implemented the answer and the problem has persisted. I'm working in typescript and I have a Room class that encapsulates a namespace (among other things), and a RoomManager class that maintains a list of rooms. I recently added functionality where a...

## Single using statement, multiple MVC views

c#,asp.net,asp.net-mvc,namespaces,html-helper
I've written a few extension methods (HTML helpers) and would like to use them throughout multiple views, this... @using My.Extensions.Namespace @Html.MyExtension() ...obviously works. But it means including the using statement in every single view (there'll be many). If this is the only approach, that's fine, but I'm interested if there's...

## How to specify module in namespace?

ruby-on-rails,module,routing,namespaces
I want to do something like: namespace :dashboard do get 'speed' get 'engine' get 'oil' get 'errors', :to => 'warn_system#errors', :module => false end Only errors link to another controller. dashboard_speed GET /dashboard/speed(.:format) dashboard#speed dashboard_oil GET /dashboard/oil(.:format) dashboard#oil dashboard_engine GET /dashboard/engine(.:format) dashboard#engine dashboard_errors GET /dashboard/errors(.:format) dashboard/warn_system#errors {:module=>false} For the last...

## Usage of enum name as value identifier in Objective-C

objective-c,enums,namespaces,declaration,redefinition
Referring to this post it seems that there is no possibility in Objective-C to define two enums with the same value as in this example: enum AnEnum { AnyValue }; enum AnotherEnum { AnyValue // Error: Redefinition of enumerator 'AnyValue' }; I would like to understand the backgrounds why an...

## autoloading nested classes with composer

php,namespaces,psr-0,psr-4
I have created a very basic validator class. My base code is in a my src/ folder, which gets autoloader with "kevdotbadger\\Validator\\": "src/" this works fine, so that when I instantiate a new "kevdotbadger\Validator\ Validator is gives me src/Validator.php My Validator.php class then loads a bunch of sub-classes in my...

## Are namespaces in PHP “inherited”?

php,drupal-7,namespaces
EDIT: Yes the problem was using \ at the beginning of the use statement. As M1ke pointed out, use goes from the root element. Original post I think is a PHP question but it may be Drupal. I'm working on a headless Drupal project where is using a class (which...

## Accessing PHP classes outside of namespace

php,mysqli,namespaces
I'm trying to extend mysqli outside of my namespace. Whenever I run it it can't find mysqli inside the namespace. How can I access mysqli outside of the namespace? Here is my code: <?php namespace xBell\Database; class Database extends mysqli { public function __construct() { $hostname = \eBot\Config\Config::getInstance()->getMySQLIP();$username =...

## Namespace “manufacturing” when I include [closed]

c++,namespaces,g++
I have a namespace problem that is driving me bat-sh*t crazy. There is a namespace called "Utility" written by another programmer here that I am using in some of my code. One file gives me nothing but problems. This file includes < algorithm > and I must have it. I've...

## Read from xml files with or without a namespace using XmlDocument

c#,xml,namespaces
I have some code that reads from xml files with a namespace using XmlDocument.My challenge is that i have the namespace of the file i'm reading hard coded for now and i pass that to the XmlNamespaceManager.I would like for my approach to be a little more flexible.To read from...

## The name 'Thread' does not exist in the current context

c#,visual-studio-2013,namespaces
When I put this code Thread.Sleep(2000); it gives me the error: The name 'Thread' does not exist in the current context`. I already included the namespace using System.Threading;. See System.Threading.Thread.Sleep() on MSDN....

## Laravel Interfaces

php,laravel,interface,namespaces
I used the following tutorial to get an idea about interfaces: http://vegibit.com/what-is-a-laravel-interface/ But I wanted to change the directory of where I am putting my interfaces to "App/Models/Interfaces". And so I did. But now I cannot get it to work anymore. Here is my code: Routes.php App::bind('CarInterface', 'Subaru'); Route::get('subaru', function()...

## Support namespaces/references Java to C# equivalent in Android-Visual Studio

java,c#,android,namespaces
I am working on a application where I am translating code from Java to C# to create a custom MapView in offline mode on android. I am using this tutorial that is written in Java and there are a few namespaces that I am unable to comprehend where the creator...

## Namespace scope in C#

c#,namespaces,scope
Does the name of namespace also define the scope in the class? For example, I have namespace that is named by solution by default. Lets say in Program.cs name of namespace is "MySolution". in the next file interface that I have created, name of namespace is "Interfaces" When I go...

## Delete modules to clean namespace?

python,module,namespaces,package
I am working on a pretty huge Python package. Inside several modules, different programmers import other modules to do calculations. For the sake of this discussion, let's stick to numpy. Common practice, when importing modules is defining an alias for easier programming, so let's say in a module foo.py there...

## How do I access DbContext.Entry Method (TEntity) in my generic repository class?

c#,entity-framework,namespaces,dbcontext
This should be really obvious but for some reason I can't figure it out. So in my generic repository class I have an update method to update an entity: public void Update<TEntity>(TEntity entity) where TEntity : class, IBusinessEntity { try { if (entity == null) { throw new ArgumentNullException("entity"); }...

## Include ggplot2 function in package

r,plot,ggplot2,namespaces,r-package
I am trying to include the following ggplot2 helper function in a package [it wraps labels in grid_facet(.~variable, labeller = "plot.label.wrap")]: #' Label wrapper for ggplot #' #' Include in the facet_grid option of ggplot. #' @param variable #' @param value #' @return wrapper #' @export plot.label.wrap <- function(variable, value)...

## Displaying XML nodes with XSL but keeping the order on XML - With multiple namespaces

html,xml,xslt,dom,namespaces
I have the following multi namespaces XML file: objects.xml <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="objects.xsl"?> <objects xmlns:objA="http://www.mywebsite.com/objectA" xmlns:objB="http://www.mywebsite.com/objectB" > <objA:objectA> <objA:attrA1>Instance 1 Value 1</objA:attrA1> <objA:attrA2>Instance 1 Value 2</objA:attrA2> </objA:objectA> <objB:objectB> <objB:attrB1>Instance 2 Value 1</objB:attrB1>...

## Leiningen REPL not autoloading project.core namespace [duplicate]

clojure,namespaces,read-eval-print-loop
This question already has an answer here: how to load ns by default when starting repl 2 answers I'm new to Clojure so this could very well be an easy question. I'm having an issue with the REPL while using Leiningen. Previously, I had created an app project while...

## Zend 1 3d party NameSpaces autoload don't working

php,zend-framework,amazon-web-services,namespaces,autoloader
I'm trying to implement Amazon WebServices PHP SDK into my Zend 1 project, but it seems to fail loading the classes. I have got the library into library/Eplan/AmazonCloudSearch and after investigation it seems that in order to be able to load the namespace I need to call the registerNamespace method...

## How to get all namespace in project by assembly? [duplicate]

c#,reflection,namespaces
This question already has an answer here: Finding all Namespaces in an assembly using Reflection (DotNET) 6 answers I want get all namespace in main project by method assembly.(Not all aseembly) I read below question but not useful. Getting all types in a namespace via reflection for example class...

## Where is the Conversion Namespace in Windows Store Apps

.net,namespaces,windows-store-apps,windows-8.1
I am trying to write my first Windows Store App and am using some code from an old project. I am developing on a Windows 8.1 Pro machine with Visual Studio 2013 Express. I have no idea what people are calling the version of .NET I'm targeting and therefore, cannot...

## I can't use Autoloader from Symfony2 in Symfony 1.4 for load this namespaced classes

namespaces,classloader,symfony-1.4,autoload

## how to solve the type and namespace could not be found

c#,namespaces,mono
I am trying to make a cross platform application using MONO. i developed the project into c#(windows) and I want to run that project into Linux. For that purpose i am using MONO.But when i am running my project then I am getting error that the type and namespace could...

## Get rid of Visual Studio Namespace error message

c#,.net,wpf,xaml,namespaces
this is unfortunately a very beginner question: I am doing the very simple WPF tutorials and I am stuck on a namespace problem. I want to do a simple hierarchical treeview binding on a custom object according to the tutorial. I put the object into a custom namespace "MyNameSpace" and...

## Why are these global variables when they have namespace scope?

c++,namespaces,scope,global-variables,forward-declaration
In the following code, this is calling the variables in the globals.cpp namespace actual global variables. globals.h #ifndef GLOBALS_H_ #define GLOBALS_H_ namespace Constants { // forward declarations only extern const double pi; extern const double avogadro; extern const double my_gravity; } #endif globals.cpp namespace Constants { // actual global variables...

## Javascript variable is set in one function, but undefined in another function

javascript,jquery,namespaces,scope
I have the following Javascript, eventManager: { $musicGenres : null, //$musicGenres is the selector for a div-container of inputs musicGenres : [], // Functions handle : function(selectors) { selectors = (typeof selectors === 'undefined') ? { 'musicGenres' : '#musicGenres' } : selectors; // selectors default values... this.$musicGenres =$(selectors['musicGenres']);...

## Class 'App\Http\Controllers\Artisan' not found in Laravel 5

php,laravel,namespaces,laravel-5,artisan
I am in new Laravel and trying to learn by coding. I created migration and seed and both working fine when I call them from terminal, but I wanted to try this code in my HomeController and I get a big error. Error FatalErrorException in HomeController.php line 23: Class 'App\Http\Controllers\Artisan'...

## Rails namespaced models give uninitialized constant errors

ruby-on-rails,ruby,namespaces
I have two models in namespace project like this: class Project::Foo and class Project::Bar They have this relationship in app/models/project/foo.rb has_many :bars in app/models/project/bar.rb belongs_to :foo However when I want to call Project::Foo.create(...) or even Project::Bar.create(...) I get a NameError with uninitialized constant Foo or Bar respectively. Do I need...

## Why is ::class appended to PHP class in Laravel 5.1

php,namespaces,laravel-5
In Laravel 5.0 code like this is used for names-pacing/loading classes: 'providers' => [ /* * Laravel Framework Service Providers... */ 'Illuminate\Foundation\Providers\ArtisanServiceProvider', 'Illuminate\Auth\AuthServiceProvider', 'Illuminate\Broadcasting\BroadcastServiceProvider', 'Illuminate\Bus\BusServiceProvider', ] However, am seeing this in Laravel 5.1 'providers' => [ /* * Laravel Framework Service Providers... */ Illuminate\Foundation\Providers\ArtisanServiceProvider::class, Illuminate\Auth\AuthServiceProvider::class,...

## How to follow DRY principles in different namespaces Rails 4.2?

ruby-on-rails,api,ruby-on-rails-4,namespaces
Basically I've developed an app which has two namespaces: admin, api and the public one (simply resources :users for instance). All works fine, however I'm repeating myself quite a bit as some of the controllers in api for instance could easily be used in admin. How can I DRY my...