Search Results

Search found 763 results on 31 pages for 'namespaces'.

Page 11/31 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • explicitly refer to the a class without a namespace in C#

    - by JoelFan
    The code I'm working with has a class called Environment that is not in any namespace. Unfortunately if I am in a class that imports the System namespace, there is no way to refer to the custom class called Environment. I know this was an unfortunate choice and should be refactored, but is there any way I can explicitly refer to the conflicting class? In C++ it seems the way to do this is by using ::, and in Java there is something called global:: How do I do it in C#?

    Read the article

  • Namespace constants and use as

    - by GordonM
    I'm having some problems with using constants from a namespace. If I define the constant and try to use as it, PHP seems unable to find it. For example, in my file with the constants I have code along the lines of the following: namespace \my\namespace\for\constants; const DS = DIRECTORY_SEPARATOR; Then in the consuming file I have: namespace \some\other\namespace; use \my\namespace\for\constants\DS as DS; echo (realpath (DS . 'usr' . DS 'local')); However, instead of echoing '/usr/local' as expected I get the following notice and an empty string. Notice: Use of undefined constant DS - assumed 'DS' If I change the code as follows: use \my\namespace\for\constants as cns; echo (realpath (cns\DS . 'usr' . cns\DS 'local')); I get the expected result, but it's obviously quite a bit less convenient than just being able to pull the constants in directly. You can alias a class/interface/trait in a namespace, are you not able to alias a constant too? If you can do it, then how?

    Read the article

  • Changing the namespace for a Web Reference

    - by kdmurray
    When I add a web reference to a project, it comes up with a default namespace of: com.wpdevs.myservice. This is the namespace I'd have expected it to use in the application. When I add the using statement to the project, I have to add: using MyProject.com.wpdevs.myservice; I'd like to find a way to eliminate having to reference the project name in the using statement. The project I'm putting together now is destined to be converted into a VS Project template and having that rather strange reference in there, or even having a per-project reference, isn't something I'd like to have in the project.

    Read the article

  • How do you add objects to a javascript namespace?

    - by Fletcher Moore
    var Test = (function() { return { useSub: function () { this.Sub.sayHi(); }, init: function () { $(document).ready(this.useSub); } }; })(); Test.Sub = (function () { return { sayHi: function () { alert('hi'); } }; })(); Test.useSub(); // works Test.init(); // explodes Above I am trying to create a Test namespace and add an object Sub to it. I was doing fine until I tried using the object in jQuery. The error is "Uncaught TypeError: Cannot call method 'sayHi' of undefined". If there is a better way to do this, I am open to it.

    Read the article

  • Is there a way to reference a certain class/interface/... by enclosing it with its namespace rather than a using directive "using namespace_name" ?!

    - by Ahmed
    Is there a way to reference a certain class/interface/... by enclosing it with its namespace rather than a using directive "using namespace_name" ?! As, I'm working on a website, which uses SAP .NET connector. I already added a reference for connector ddl, and while referencing its namespace "using namespace_name", or set class namespace to another one rather than connector namespace, I got error regarding connector classes with that error message "The type or namespace couldn't be found, are you missing a using directive or an assembly reference?". But while changing namespace name to connector namespace, everything is going well?! // Set namespace to be IDestinationConfiguration interface namespace. namespace SAP.Middleware.Connector { public class ConnectorConfiguration : IDestinationConfiguration { } } So, connector types forced me to set namespace of class to their namespace! Is this possible? If so, how?

    Read the article

  • friend declaration block an external function access to the private section of a class

    - by MiP
    I'm trying to force function caller from a specific class. For example this code bellow demonstrate my problem. I want to make 'use' function would be called only from class A. I'm using a global namespace all over the project. a.h #include "b.h" namespace GLOBAL{ class A{ public: void doSomething(B); } } a.cpp #include "a.h" using namespace GLOBAL; void A::doSomething(B b){ b.use(); } b.h namespace GLOBAL{ class B{ public: friend void GLOBAL::A::doSomething(B); private: void use(); } Compiler says: ‘GLOBAL::A’ has not been declared ‘void GLOBAL::B::use()’ is private Can anyone help here ? Thanks a lot, Mike.

    Read the article

  • Adding more namespace in the code file affects performace ?

    - by Harikrishna
    If we imports more namespace in the code file(cs file) then it affects on perfomance ? Like we should add namespace in the cs file as needed. That is adding more namespace in the cs file affects performance ? Like using System; using System.Data.Sql; using System.Collections.Generic; using System.Data; using System.IO; using System.Linq; using System.Text.RegularExpressions; using System.Windows.Forms; using System.Xml; using System.Data.SqlClient; using System.ComponentModel;

    Read the article

  • Porting C++-code from Windows to Unix: systemcalls colliding with name of functions

    - by marvin2k
    Hi I'm porting some crufty C++ Windows-code to Linux, which uses functions called "open" and "close" inside every class... Very bad style, or? Luckily that wasn't a problem in windows, since their systemcalls are named different. When I try to call the systemcalls open() or close() I'm getting some compiler error about "no matching function for call for class:open()". I can't rename all our functions named "class::open" and "class::close" in the whole code, and I have to use open() and close() since I'm working with serial ports. So my question is: How can I tell the compiler, which open I mean? How can I escape or hide the namespace of a class in C++?

    Read the article

  • Problem with inner classes of the same name in Visual C++

    - by starblue
    I have a problem with Visual C++, where apparently inner classes with the same name but in different outer classes are confused. The problem occurs for two layers, where each layer has a listener interface as an inner class. B is a listener of A, and has its own listener in a third layer above it (not shown). The structure of the code looks like this: A.h class A { class Listener { Listener(); virtual ~Listener() = 0; } [...] } B.h class B : public A::Listener { class Listener { Listener(); virtual ~Listener() = 0; } [...] } B.cpp B::Listener::Listener() {} B::Listener::~Listener() {} I get the error B.cpp(49) : error C2509: '{ctor}' : member function not declared in 'B' The C++ compiler for Renesas sh2a has no problem with this, but then it is more liberal than Visual C++ in some other respects, too. If I rename the listener interfaces to have different names the problem goes away, but I'd like to avoid that (the real class names instead of A or B are rather long). Is what I'm doing correct C++, or is the complaint by Visual C++ justified? Is there a way to work around this problem without renaming the listener interfaces?

    Read the article

  • Does it should be in a namespace?

    - by Knowing me knowing you
    Do I have to put code from .cpp in a namespace from corresponding .h or it's enough to just write using declaration? //file .h namespace a { /*interface*/ class my { }; } //file .cpp using a::my; // Can I just write in this file this declaration and // after that start to write implementation, or // should I write: namespace a //everything in a namespace now { //Implementation goes here } Thanks.

    Read the article

  • How do I get PyLint to find namespace packages?

    - by tjd.rodgers
    I have a virtualenv where I've installed two packages, both using the company.project_name namespace. So the first package is importable from company.project_name.one and the second from company.project_name.two. The challenge is that I can't seem to be able to run PyLint on either one of them. If I issue: $ pylint company.project_name.one I get: ************* Module company.project_name.one F: 1, 0: No module named project_name.one(fatal) I suspect that I'm probably doing something wrong. Is there a proper way to do this? Edit: I should have made it clear that company.project_name and company are namespace packages and not regular packages.

    Read the article

  • Namespaced controller redirect urls

    - by bajki
    Hello, i have probably a simple question. I have created a namespace panel with categories controller. After creating or editing a category, rails redirects me to website.com/categories/:id instead of website.com/panel/categories/:id. I've noticed that in the _form view, the @panel_categories argument of form_for() function points to /categories nor /panel/categories and that's causing this behaviour. Offcourse i can add a :url => '/panel/categories' param but i feel that it's not the best solution... Can you provide me any better solution? Thanks in advance Files: routes.rb: Photowall::Application.routes.draw do resources :photos resources :categories resources :fields resources :users, :user_sessions match 'login' => 'user_sessions#new', :as => :login match 'logout' => 'user_sessions#destroy', :as => :logout namespace :panel do root :to => "photos#index" resources :users, :photos, :categories, :fields end namespace :admin do root :to => "users#index" resources :users, :photos, :categories, :fields end end categories_controller.rb: http://pastebin.com/rWJykCCF model is the default one form: http://pastebin.com/HGmkZZHM

    Read the article

  • What is jQuery for Document.createElementNS()?

    - by C.W.Holeman II
    What is jQuery for Document.createElementNS()? function emleGraphicToSvg(aGraphicNode) { var lu = function luf(aPrefix){ switch (aPrefix){ case 'xhtml': return 'http://www.w3.org/1999/xhtml'; case 'math': return 'http://www.w3.org/1998/Math/MathML'; case 'svg': return 'http://www.w3.org/2000/svg'; } return ''; }; var svg = document.evaluate("svg:svg", aGraphicNode, lu, XPathResult.FIRST_ORDERED_NODE_TYPE, null). singleNodeValue; $(svg).children().remove(); rect = document.createElementNS(lu('svg'), "rect"); rect.setAttribute("x", "35"); rect.setAttribute("y", "25"); rect.setAttribute("width", "200"); rect.setAttribute("height", "50"); rect.setAttribute("class", "emleGraphicOutline"); svg.appendChild(rect); } The code is a simplified fragment from Emle - Electronic Mathematics Laboratory Equipment JavaScript file emle_lab.js. The Look-Up-Function, luf(), maps a complete reference to a shorten name for the namespace in the XPath string and createElementNS(). The existing svg:svg is located, removed and replaced by a new rectangle.

    Read the article

  • C++ Declaring an enum within a class

    - by bporter
    In the following code snippet, the Color enum is declared within the Car class in order to limit the scope of the enum and to try not to "pollute" the global namespace. class Car { public: enum Color { RED, BLUE, WHITE }; void SetColor( Car::Color color ) { _color = color; } Car::Color GetColor() const { return _color; } private: Car::Color _color; }; (1) Is this a good way to limit the scope of the Color enum? Or, should I declare it outside of the Car class, but possibly within its own namespace or struct? I just came across this article today, which advocates the latter and discusses some nice points about enums: http://gamesfromwithin.com/stupid-c-tricks-2-better-enums. (2) In this example, when working within the class, is it best to code the enum as Car::Color, or would just Color suffice? (I assume the former is better, just in case there is another Color enum declared in the global namespace. That way, at least, we are explicit about the enum to we are referring.) Thanks in advance for any input on this.

    Read the article

  • Declaring an enum within a class

    - by bporter
    In the following code snippet, the Color enum is declared within the Car class in order to limit the scope of the enum and to try not to "pollute" the global namespace. class Car { public: enum Color { RED, BLUE, WHITE }; void SetColor( Car::Color color ) { _color = color; } Car::Color GetColor() const { return _color; } private: Car::Color _color; }; (1) Is this a good way to limit the scope of the Color enum? Or, should I declare it outside of the Car class, but possibly within its own namespace or struct? I just came across this article today, which advocates the latter and discusses some nice points about enums: http://gamesfromwithin.com/stupid-c-tricks-2-better-enums. (2) In this example, when working within the class, is it best to code the enum as Car::Color, or would just Color suffice? (I assume the former is better, just in case there is another Color enum declared in the global namespace. That way, at least, we are explicit about the enum to we are referring.) Thanks in advance for any input on this.

    Read the article

  • C++: namespace conflict between extern "C" and class member

    - by plaisthos
    Hi, I stumbled upon a rather exotic c++ namespace problem: condensed example: extern "C" { void solve(lprec * lp); } class A { public: lprec * lp; void solve(int foo); } void A::solve(int foo) { solve(lp); } I want to call the c function solve in my C++ member function A::solve. The compiler is not happy with my intent: error C2664: 'lp_solve_ilp::solve' : cannot convert parameter 1 from 'lprec *' to 'int' Is there something I can prefix the solve function with? C::solve does not work

    Read the article

  • XSL transformation of SVG adds namespace attribute to new tag

    - by Steve
    I have a SVG file that I want to extend by adding onclick handlers to edges and nodes. I also want to add a script tag referring to a JavaScript. The problem is that the script tag gets an empty namespace attribute added to it. I haven't found any information regarding this that I understand. Why does XSLT add an empty namespace? XSL file: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <xsl:output method="xml" encoding="utf-8" /> <xsl:template match="/svg:svg"> <xsl:copy> <script type="text/ecmascript" xlink:href="base.js" /> <!-- this tag gets a namespace attr --> <xsl:apply-templates /> </xsl:copy> </xsl:template> <!-- Identity transform http://www.w3.org/TR/xslt#copying --> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <!-- Check groups and add functions --> <xsl:template match="svg:g"> <xsl:copy> <xsl:if test="@class = 'node'"> <xsl:attribute name="onclick">node_clicked()</xsl:attribute> </xsl:if> <xsl:if test="@class = 'edge'"> <xsl:attribute name="onclick">edge_clicked()</xsl:attribute> </xsl:if> <xsl:apply-templates select="@*|node()" /> </xsl:copy> </xsl:template> </xsl:stylesheet>

    Read the article

  • C++ namespace help

    - by Thomas
    Hi, If I have multiple class and I want to have them all come under the same namespace and in my project I just want to have one include and that will give me all of the classes how would I go about doing this? I have played around with this but keep hitting a dead end. Thanks in advance.

    Read the article

  • xsl defining in xml

    - by aditya parikh
    My first few lines in movies.xml are as follows : <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="movies_style.xsl"?> <movies xmlns="http://www.w3schools.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3schools.com file:///B:/USC/Academic/DBMS/HWS/no3/movie_sch.xsd"> and first few lines in movies_style.xsl are as follows : <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> Problem is if remove schema file linking from movies.xml file and keep tag only as <movies> then proper styled table is shown as output else nothing is displayed in browser and error is displayed in console as: "Unsafe attempt to load URL file:///B:/USC/Academic/DBMS/HWS/no3/movies_style.xsl from frame with URL file:///B:/USC/Academic/DBMS/HWS/no3/movies.xml. Domains, protocols and ports must match." Looks like some namespace mistake. Can anyone point out exactly what ?

    Read the article

  • Namespace with index action in Rails

    - by yuval
    I have an admin controller located inside /controllers/admin/admin_controller.rb I also have a pages controller located inside /controllers/admin/pages_controller.rb In my routes.rb file, I have the following: map.namespace :admin do |admin| admin.resources :pages end When the user goes to localhost:3000/admin, I'd like the user to see a page with a link to /admin/pages (Pages CRUD) and to / (To go back home). Since I am using a namespace, I cannot have an index action for /admin. How would I get this done and still have my controllers located inside my /controllers/admin folder (rather than using admin as a map.resources component and a has_many association to pages). Please note I am only interested in the show action of admin. Thank you!

    Read the article

  • Where to add an overloaded operator for the tr1::array?

    - by phlipsy
    Since I need to add an operator& for the std::tr1::array<bool, N> I wrote the following lines template<std::size_t N> std::tr1::array<bool, N> operator& (const std::tr1::array<bool, N>& a, const std::tr1::array<bool, N>& b) { std::tr1::array<bool, N> result; std::transform(a.begin(), a.end(), b.begin(), result.begin(), std::logical_and<bool>()); return result; } Now I don't know in which namespace I've to put this function. I considered the std namespace as a restricted area. Only total specialization and overloaded function templates are allowed to be added by the user. Putting it into the global namespace isn't "allowed" either in order to prevent pollution of the global namespace and clashes with other declarations. And finally putting this function into the namespace of the project doesn't work since the compiler won't find it there. What had I best do? I don't want to write a new array class putted into the project namespace. Because in this case the compiler would find the right namespace via argument dependent name lookup. Or is this the only possible way because writing a new operator for existing classes means extending their interfaces and this isn't allowed either for standard classes?

    Read the article

  • Possible Conflict with Class name & Property Name?

    - by coffeeaddict
    If you have a namespace that contains a property in ClassA and a class that has the name of that Property somewhere else in your project and both are in the same namespace this won't cause conflicts will it? So lets say I have a class named Car namespace Dealer { class Vehicle { // the main class that defines vehicle, so this is Dealer.Vehicle (Vehicle.cs) } } and a property over in some other class namespace Dealer { class Dealer { public Vehicle Vehicle { get { return _vehicle; } } } } so for the second it is really this for the property public Dealer.Vehicle Vehicle { get { return _car; } } so now you have Dealer.Vehicle and Dealer.Dealer.Vehicle. Wondering of that would cause a conflict ever. If both those classes are in the same namespace and

    Read the article

  • importing symbols from python package into caller's namespace

    - by Paul C
    I have a little internal DSL written in a single Python file that has grown to a point where I would like to split the contents across a number of different directories + files. The new directory structure currently looks like this: dsl/ __init__.py types/ __init__.py type1.py type2.py and each type file contains a class (e.g. Type1). My problem is that I would like to keep the implementation of code that uses this DSL as simple as possible, something like: import dsl x = Type1() ... This means that all of the important symbols should be available directly in the user's namespace. I have tried updating the top-level __init__.py file to import the relevant symbols: from types.type1 import Type1 from types.type2 import Type2 ... print globals() the output shows that the symbols are imported correctly, but they still aren't present in the caller's code (the code that's doing the import dsl). I think that the problem is that the symbols are actually being imported to the 'dsl' namespace. How can I change this so that the classes are also directly available in the caller's namespace?

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >