FAQ Database Discussion Community


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...

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...

Reference C# type within XML schema?

c#,xml,namespaces,xml-namespaces
Is it possible to reference types within a C# project in an XML Schema file? For validation and intelli-sense I mean... Lets say I have the following: namespace Example { class myType { int test = 0; } } How would I reference the Example namespace within the schema file...

Does it matter how many models are in a single namespace?

asp.net-mvc,model,namespaces
In an MVC app, does it matter how many models are in the MyApp.Models namespace? I have just enough models to make it worthwhile splitting them into separate folders (e.g. /Models/Users, /Models/Emails, /Models/Messages, etc). MVC by default gives new models a namespace corresponding to the folder structure (e.g. MyApp.Models.Users, MyApp.Models.Emails,...

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)...

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...

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...

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"); }...

Enumerate namespaces and dynamically load them in ClojureScript

clojure,namespaces,clojurescript,reagent
This may actually be a bit of an XY-problem, so I'll try to explain what the goal is first. I'm building a ClojureScript application which is composed of a set of Reagent components. It provides a user interface where you can dynamically add or remove UI elements. These UI elements...

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...

How to use namespace System; in MFC application with VC++

c++,sql,visual-c++,mfc,namespaces
help me,am new, I want to use some features(i don't know the specific word to use) present in System namespace, but when i try to add it to my project by "using namespace System",i want this to use SQLCLIENT ,i saw below link giving answer but dont have a clue...

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...

'Class' is a namespace but is used like a 'type'

c#,visual-studio,namespaces
First, this is not the same as the many highly upvoted questions on this exact topic unless I'm missing one of them. All of them point that the issue is I have a namespace with the same name as the class. This is not the case (but it was). I...

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...

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>...

Get namespace of unqualified class name

php,namespaces
Consider the following PHP code namespace foo\bar; class MyClass {} namespace xyz; use foo\bar\MyClass; class OtherClass {} $a = new MyClass(); $b = new OtherClass(); $a is an instance of \foo\bar\MyClass, while $b is an instance of \xyz\OtherClass. These fully qualified class names, I can get by calling get_class($a) and...

Python: is there a way to use “unimported” objects in function definitions?

python,function,namespaces,python-module
I'm modifying a simple recursive function to draw a dragon curve using turtle: def draw_dragon(t, order, size, L=turtle.left, R=turtle.right): """ Draw a dragon curve """ if not order: t.forward(size) return size /= 1.41421 t.R(45) draw_dragon(t, order-1, size, L, R) t.L(90) draw_dragon(t, order-1, size, R, L) t.R(45) if __name__=="__main__": import turtle...

C++ header-only library avoid “using namespace” pollution

c++,c++11,namespaces
I have a header-only C++ library with sevaral namespaces. For example one header file may contain //header1.h namespace library{ namespace componentA{ template<typename T> class Someclass{}; } } And another one //header2.h namespace library{ namespace componentB{ template<typename T> class SomeOtherClass{ void Foo(const componentA::Someclass<T>& reference); void Bar(const componentA::Someclass<T>& reference); }; } }...

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...

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']);...

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 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...

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...

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...

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# 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...

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...

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...

How to use an operation which is defined in another namespace in c++

c++,namespaces,operator-keyword
I have a definition for an operation in a namespace and I want to use it in another name space, how I can do this: for example, assume that I have this: operation defined: namespace op { inline cv::Matx21f operator/(const cv::Matx21f &v, float a) { return cv::Matx21f(v(0) / a, v(1)...

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'],...

Should one forward declare classes from a namespaced library?

c++,design,namespaces,forward-declaration
I'm designing a C++ library that will be placed inside a namespace. If the users of my library only need a forward declaration of one of my classes and since you can't do forward declarations of things inside a namespace, e.g. class ns_name::class_name;, should I tell them to include the...

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...

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...

How to use namespaces properly in vb.net

vb.net,namespaces
I have a WebApplication project called WebApp and I have a Library Project called LibProj where I define a namespace like Namespace LibProj Public Class Employee Public Property Name As String End Class End Namespace Now I add the reference to WebApp and try to use the namespace with Imports...

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,...

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...

Class 'App\Http\Controllers\Excel' not found in Laravel

php,laravel,namespaces,laravel-excel
In my controller I have the code as below: Excel::create('Laravel Excel', function($excel) { $excel->sheet('Excel sheet', function($sheet) { $sheet->setOrientation('landscape'); }); })->export('xls'); In config/app.php in aliases array i have defined this: 'Excel' => 'Maatwebsite\Excel\ExcelServiceProvider', I dont know why i cant make it work this library... Any idea?...

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...

Xsd Schema Namespace

c#,xml,xsd,namespaces
Please consider below PspShoppingCartServiceRequest.Xsd <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:tns="http://www.example.com" elementFormDefault="qualified" targetNamespace="http://www.example.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:common="http://www.example.com/common" <xs:import namespace= "http://www.example.com/common" schemaLocation="common.xsd" /> <xs:element name="PspShoppingCartServiceRequest" type="tns:PspShoppingCartServiceRequest" /> <xs:complexType...

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...

silex file structure for custom service providers

php,namespaces,silex
I am working on a Silex project which requires some custom service providers and their related classes to be written. I am aware of the preferred file structure of silex projects but cannot anywhere find information on where custom classes should fit into this structure. All composer supplied libraries are...

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 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...

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()...

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...

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...

MonoDevelop 4.0.1: Creating a new namespace in a project (on Windows 8.1 64-bit)

c#,namespaces,monodevelop
How do I create a namespace on MonoDevelop 4.0.1 for the same project? I am following along the exercises from Practice Exercises C# Sharp where there are 11 lessons with multiple exercises each, and so far I am using only one namespace in the project. Instead of having all the...

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...

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...

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>...

Namespace for (DDD) entities cutting across domains

namespaces,domain-driven-design,modeling
I have a couple of business-related domains like Purchase, Marketing and Economy. Having the models arranged into a namespace* for each domain would be nice, but there are some entities cutting across domains, like an Item. How to organize those cross-cutting objects? * = As in C#/Java/Python namespaces....

How does extern work in namespaces?

c++,namespaces,global-variables,const,extern
I'm running a simple program similar to what I found here. It's meant to reduce code bloat when including constants in multiple files. It does this by using const global variables within a namespace with their respective extern forward declarations. globals.h #ifndef GLOBALS_H_ #define GLOBALS_H_ namespace Constants { // forward...

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...

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...

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,...

Rails: Rendering a template in a different namespace

ruby-on-rails,namespaces
How can I render an action of a controller which is in a different namespace? For example, if I have a login controller in a Webapp namespace Webapp::LoginController and I want to render the index action (not a partial!) in an events controller in the API namespace API::EventsController if the...

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...

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...

C# : Why is First namespace redundant?

c#,namespaces,projects-and-solutions,qualifiers
This is a little spooky. I'm thinking there must be a setting somewhere that explains why this is happening. In our solution there are about 50 different projects. For the most part, the libraries start with the namespace OurCompany. We have OurComany.This.That and OurCompany.Foo.Bar... etc. There is a namespace/class clash...

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...

C++: Does inheriting from a class bring it into the namespace?

c++,namespaces
Here's some contrived example code: template<typename T> void Do(T arg) { (void)arg->b; } namespace A { struct Foo { int a; }; } namespace B { struct Foo { int b; }; struct Bar : A::Foo { void Blah() { Do((Foo *)0); } }; } Which when compiled with gcc...

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?

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....

Safely creating namespaces in JavaScript

javascript,namespaces
I understand why namespaces are good - to prevent too many global definitions and to prevent code from being overwritten, but i'm trying to dig a bit further into the following syntax: // not safe, if there's another object with this name we will overwrite it var MYAPPLICATION = {};...

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,...

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...

Why no namespace prepended for function when using namespace directive?

c++,namespaces,linkage
This c++ file... namespace foo { class C { void m(); }; void f(); } using namespace foo; void C::m() {} void f() {} ..Compiles to an object file with these symbols: $ g++ foo.cpp -c $ nm foo.o -C 000000000000000a T f() 0000000000000000 T foo::C::m() Why does C::m()? get...

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

namespaces,classloader,symfony-1.4,autoload
I want to use this php library with namespaced classes in my Symfony 1.4 project: https://github.com/donquixote/cellbrush. I'm not quite familiar with the namespaces concept. So when i fisrt try the to use the main class of this library, according to its docs, i just did: $table = \Donquixote\Cellbrush\Table\Table::create(); And i...

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...

Javascript namespacing and OO organization

javascript,oop,namespaces,code-organization
I have my javascript code as follow: $(document).ready(function () { //call of global functions globalFunction1(); globalFunction2(); //create a new object inside globalFunction3(); } function globalFunction1() { // do something directly with jquery selectors var testObj1 = new object1($('#tree')); // this is called later in the function testObj.doSomething(); } function globalFunction2()...

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...

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>...

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...

Subroutines defined in required file assigned to wrong namespace after use of custom module

perl,module,namespaces
In a script I am working on, I have something similar to the following: require "environment.pm"; # Various definitions, including subroutine get_coll() use Custom::Module; In the Custom::Module file, I start with package Custom::Module; and end with 1; When I try to call get_coll() I get an error about it: (...

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 =...

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...

System.ComponentModel.DataAnnotations.Schema namespace conflict

c#,.net,entity-framework,namespaces
I am using MVC 4, .net 4, and Entity Framework 6. My projects are building on my dev machine which has Visual Studio 2010 installed but on my build server I get a namespace conflict... The type 'System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedAttribute' exists in both 'd:\Projects\tools\Apps\LAMS\packages\EntityFramework.6.0.2\lib\net40\EntityFramework.dll' and 'c:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.ComponentModel.DataAnnotations\v4.0_4.0.0.0__31bf3856ad364e35\System.ComponentModel.DataAnnotations.dll' I'm unsure...

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 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...

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...

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...

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...

Silex namespace : class MainController does not exist

php,class,namespaces,autoload,silex
I try to use Silex Framework, but i have a problem with namespaces I think. when I instanciate my class MainController i have the following error : Class "MainController" does not exist here the namespace declaration in my MainController.php : namespace App\Controllers; use Silex\Application; class MainController implements \Silex\ControllerProviderInterface { .......

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)...

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'...

How to add a name to namespace?

linux,networking,namespaces,ip
As I know, I can use the "clone" to create a process and a namespace, but the namespace created in this way has no name. For example, I create a network namespace with the parameter: CLONE_NEWNS, but in the command "ip netns list", there is no namespace list because the...

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...

Mediawiki custom namespaces id change

namespaces,mediawiki,identifier
I am currently working on an internal Mediawiki and we are using a lot of custom written extensions. Because we did no know better, defined custom namespaces for our own extensions and articles with an id that is smaller than 3000. For example: define('NS_bla', 1100); $wgExtraNamespaces[NS_bla] = "bla"; define('NS_bla_TALK', 1101);...

Namespace, class and compiler order…

c++,class,header,namespaces,source
I'm experiencing with OpenGL and I built and edit a Vector3 header that works perfectly that works with struct Vector3 but the problem starts when I tried create a Vector3 zero = Vector3(0,0,0) variable, the compiler doesn't let me build due to the compiling order so I copied a new...

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"; //...

PHP require files when use namespace

php,namespaces
I'm new to PHP namespace. and there is a problem when I use auto-load. ROOT/Application/Instance.php <?php namespace Application; class Instance { public static $_database; public function __construct() { self::$_database = new \Application\Module\Database(); } public static function database() { return self::$_database; } public static function ID(){ return md5(uniqid(mt_rand(), TRUE) . mt_rand()...

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,...

Typescript One File Per Class

file,class,module,namespaces,typescript
I have just started with Typescript, using Visual Studio 2015, and can't find a way to use classes in separate files. In a single file, there is no problem: module someModule { export class TitleScreenState extends Phaser.State { game: Phaser.Game; constructor() { super(); } //some code here } class GameRunningState...

xsl: template and namespaces

xslt,namespaces
My appologies for asking this question again. I know this has been answered here already several times, but it seems that I still don't get it. My XML (basically the XML output from Open Office draw, here simplified) <?xml version="1.0" encoding="UTF-8"?> <office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"...

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 =...

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...

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...

Namespace keyword in TypeScript

c#,namespaces,typescript,keyword
Trying to find out what does namespace keyword mean in TypeScript? Here's some reshuffle they've done recently to use namespace instead of module: https://github.com/Microsoft/TypeScript/commit/224e7630ea17c4547e97f85634f446b877955a67 In the absence of namespace spec, it looks like a rather pointless rename to make the language look C#-like. Or is there an obscure little difference...

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+...

Django URL namespaces - the template has to know its namespace?

django,url,namespaces
I've been tinkering with (my first) Django project that started out with Django 1.6 and has just recently moved to Django 1.8. I've also been working through Django Patterns & Best Practices, learning how I should have structured it all along :-) My project has several sub-apps and a typical...