namespaces

Namespaced resources

This is an excerpt from my config/routes.rb file: resources :accounts do |account| account.resource :profile, :except => [:new, :create, :destroy] account.resources :posts, :collection => { :fragment => :get }, :has_many => [:comments, :likes] # even more code end I...

PHP strategies for retrofitting a namespace around 3rd party code

I'm attempting to utilize a 3rd-party PHP library in a semi-developed web project. Unfortunately, as I am beginning to use the 3rd party code, I'm realizing that there is a number of variable and class name collisions. I was curious to know if there existed a strategy to retrofit a namespace around this new code. ...and yes, there's e...

Best plugin development practices to avoid polluting jQuery namespace?

I have created a jQuery plugin that allows the user to interact with a tree (creating, updating, deleting nodes). There are at least a dozen methods for interacting with the tree. Ideally, I don’t want to pollute the jQuery namespace with all of these tree-specific methods as I am doing now as each methods presents an additional opport...

What is the rationale behind UI namespace in Qt?

In the process of creating a user interface code from UI file Qt creates 2 classes with just the same definition. class UI_CustomeUIClassFromUIFile { //code generated from UI file thru UIC } namespace ui { class CustomeUIClassFromUIFile public : UI_CustomeUIClassFromUIFile{}; }using namespace ui; What is the reason for having 2 classe...

How to mitigate class declaration being far from its owner namespace declaration in a file?

So, I've seen how useful namespaces can be to organize declarations into their respective groups, but now comes an issue with this. The difference between making a library in C and a library in C++ is in C you must prefix your declarations with what they belong to, for example a library we'll dub MyMath might have a vector class, well t...

Change namespace of a deployed clickonce application

I made a bit of a namespace spelling mistake and I wish to correct it. My application currently uses Application.Settings to store a bulk of the user's information. If I refactor my namespace to be spelled correctly, will the application settings file essentially get wiped because it can't find the new namespace in it? ...

Creating an XML document with a namespaced root element with Nokogiri builder

I'm implementing an exporter for an XML data format that requires namespaces. I'm using the Nokogiri XML Builder (version 1.4.0) to do this. However, I can't get Nokogiri to create a root node with a namespace. This works: Nokogiri::XML::Builder.new { |xml| xml.root('xmlns:foobar' => 'my-ns-url') }.to_xml <?xml version="1.0"?> <root ...

Strategy for developing namespaced and non-namespaced versions of same PHP code

I'm maintaining library written for PHP 5.2 and I'd like to create PHP 5.3-namespaced version of it. However, I'd also keep non-namespaced version up to date until PHP 5.3 becomes so old, that even Debian stable ships it ;) I've got rather clean code, about 80 classes following Project_Directory_Filename naming scheme (I'd change them t...

Javascript + namespacing + FF issue

var utils = function() { function getMyPrivateName() { return "Caoimhin"; } return { messages: { getMyPublicName: function getMyPublicName() { return "Kevin"; }, sayHello: function() { document.writeln("hello " + getMyPublicName() + "<br/>"); ...

Ruby Equivalent of C# 'using' Statement

I've been getting into Ruby over the past few months, but one thing that I haven't figured out yet is what the Ruby equivalent of C#'s (and other languages) using statement is. I have been using the require statement to declare my dependencies on Gems, but I am getting lazy and would prefer to not fully qualify my frequently used class ...

XSD Namespace to C# Namespace

We are looking for a way to have C# autogenerate classes from an XSD and create C# namespaces using the namespace info in the XSD. Doesnt seem like you can create a structured (xxxx.yyyy.zzzz) C# namespace from the XSD? Is there a trick we're missing? Thanks ...

How to eliminate xmlns="" entries produced by XSLT transform of one XML doc to another XML doc.

Ok, I've seen numerous variations on this question, but none exactly answer what I'm trying to solve and perhaps I'm just too dense to see how to apply one of the other answers to what I'm trying to do. I have some XML that looks something like the following: <?xml version="1.0" encoding="utf-8"?> <message> <cmd id="api_info"> <a...

Serializing object with no namespaces using DataContractSerializer

How do I remove XML namespaces from an object's XML representation serialized using DataContractSerializer? That object needs to be serialized to a very simple output XML. Latest & greatest - using .Net 4 beta 2 The object will never need to be deserialized. XML should not have any xmlns:... namespace refs Any subtypes of Exception an...

Typedef inside/outside anonymous namespace?

In a .cpp file, is there any difference/preference either way? // file scope outside any namespace using X::SomeClass; typedef SomeClass::Buffer MyBuf; v/s namespace { // anonymous using X::SomeClass; typedef SomeClass::Buffer MyBuf; } ...

Referencing Other Functions from Name Spaced JavaScript

So I am trying to consolidate a bunch of code into some nice NameSpaced functions, but am having a tough time getting it to all work together. For example, I have this (edited down for clarity): YW.FB = function() { return { init: function(fncSuc, fncFail) { FB.init(APIKey, "/services/fbconnect/xd_receiver.htm...

How I should reference Custom Control in C# code behind file event trigger?

In Xaml page I reference my custom control this way: <MyNamespace:CustControl x:Name="Cust1" /> Now I want change the property of this custom control in MouseLeftButtonDown event trigger: private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { } But when I try to write something like CustControl.Is...

Why so many individual System.Web.* DLLs?

I've been thinking about ways to refactor a fairly expansive class/utility library I have, and one thing I think I want to do is split off any higher-level helper utilities that introduce new dependencies. I read some previous questions here, and one that I particularly noticed was a comment about how Microsoft freely uses namespaces acr...

Varying xpath-default-namespace in XML source files

I have a set of XML files that I am processing with an XSL transform. They have a default namespace, so my XSL transform must contain the declaration: xpath-default-namespace="urn:CZ-RVV-IS-VaV-XML-NS:data-1.2.2" The problem is that this value changes from time to time, and my transform suddenly stops working, until I look at an exampl...

C++ error C2065: 'cout' : undeclared identifier

!!!!solved!!! - VS2010 has a bug, works fine with eclipse Galileo I am working on the 'driver' part of my programing assignment and i keep getting this absurd error - error C2065: 'cout' : undeclared identifier I have even tried using the std::cout but i get another error that says: IntelliSense: namespace "std" has no member "cout...

In Python, how do I refer to an identifier by its absolute fully-qualified name?

I have a project with a directory structure that looks like: /foo/baz/__init__.py /bar/foo.py /bar/splat.py Problem is, /bar/splat.py refers to the foo.baz module. This fails with the error No module named baz because it's trying to search for this module within /bar/foo.py. I don't want Python to search the bar module, I want to t...