Usually there are a lot of models in a Ruby on Rails project, so:
Is it a good practice to namespace them (in modules/folders)? What are the downsides?
EG:
Shop
category.rb
details.rb
Products
category.rb
base.rb
etc
(instead of ShopCategory, to have Shop::Category?)
Should also the controllers be namespaced in the same man...
without telling me to buy a book, would anyone be interested in answering the following question?
if i am in a namespace with a class named foo. and i wanted to build another class called bar. how would i proceed to make foo, aware of bar and vice versa? at what cost? keep in mind that there could potentially be a whole microcosm of us...
What’s the .net namespace constant thingy for the forward slash "/"
So instead of:
somePath + "/" + someFile
I can do:
somePath + .net.namespace.forwardslash + someFile
Not really much difference but maybe neater?
...
In Python, a namespace package allows you to spread Python code among several projects. This is useful when you want to release related libraries as separate downloads. For example, with the directories Package-1 and Package-2 in PYTHONPATH,
Package-1/namespace/__init__.py
Package-1/namespace/module1/__init__.py
Package-2/namespace/__in...
http://mailmarkup.org/hcl/hcl1%5F0-documentation.xsd
I am trying to apply some CSS to the above link. It looks perfect in Firefox and Opera, but it is absolutely horrible in IE. It seems the fonts are not being applied and no styles are being applied to namespace prefixed elements. Any ideas? Here is the CSS:
http://mailmarkup.org/...
I need to add an xmlns to the root element in the output of this XSLT transform. I've tried added <xsl:attribute name="xmlns"> but it's disallowed.
Has anyone got any ideas how I could solve this?
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:template match="/">
<xsl:variable name="roo...
I'd like to obtain the title of a program from the running processes name, using C#.
Example:
I know a program is called "msn.exe", and i want to obtain the title (name), "Windows Live Messenger" from the application. How would i go about doing that? Googling has left me at a loss.
...
Namespaces are really useful and PHP had no support for them until the recent few releases, AFAIK.
When I'm using Zend Framework, I have to remember long names with underscores - like Zend_Form_Element_Button or Zend_Form_Decorator_HtmlTag and so on.
If I use namespaces, this might be possible, and so much easier:
namespace Zend {
cl...
Hi,
I'm currently writing a little cmd line app that will take an entire visual studio solution, copy it to a new folder and change the namespaces of all the projects.
Looks like its going to take some regex magic to get this working properly (and quite a bit of effort).
Am I reinventing the wheel? - is there anything in visual studio ...
Suppose you have a class with an enum defined within it:
class MyClass {
typedef enum _MyEnum{ a } MyEnum;
}
Is there a way to access the value a from another class without having to refer to it as MyClass::a? If the enum were contained within a namespace rather than a class, than "using namespace ;" solves the problem - is there a...
Hi folks,
I need a way to check out all namespaces used by a type via reflection.
namespace My.Program.BaseTypes
{
using System;
using System.Text;
using My.Program.Extenders;
using My.Program.Helpers;
using My.Program.Interfaces;
public class MyTypeBase
{
public MyTypeBase()
{
}
...
I am trying to make a WebForms project and ASP.NET MVC per this question. One of the things I've done to make that happen is that I added a namespaces node to the WebForms web.config:
<pages styleSheetTheme="Default">
...
<namespaces>
<add namespace="System.Web.Mvc"/>
<add namespace="System.Web.Mvc.Ajax"/>
<add namespac...
I have some XML that I am trying to transform to HTML using XSLT, but I can't get it to work for the life of me. Can someone tell me what I am doing wrong?
XML
<ArrayOfBrokerage xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.test.com/">
<Brokerage>
<BrokerageID>91</BrokerageID>
<LastYodleeUpdate>0001-01-01T0...
I'm writing a C++ program that has a large number of classes. In my head I can visualise them as distinct collections. For example there's a collection of classes for reading and storing config data, and another collection for drawing a user interface with various widgets.
Each of those collections could be neatly stored inside separate...
The story so far:
I have a rails app with a model named "Term". All is well until trying to install Cucumber. Upon running
rake cucumber
I get
Term is not a class (TypeError)
This happens because Cucumber includes another gem, 'term-ansicolor' (to do the nifty colored text output in the console), and term-ansicolor defines a modul...
I'm working with a legacy class that looks like this:
class A
{
enum Flags { One = 1, Two = 2 };
};
I'd like to pull out all the enums into a new namespace defined in a new header:
// flags.h
namespace flags {
enum Flags { One = 1, Two = 2 };
};
Then pull these enums back into the class so that I can include just the flags.h...
I am using a DataContractSerializer to serialize an object to XML. The main object is SecurityHolding with the namespace "http://personaltrading.test.com/" and contains a property called Amount that's a class with the namespace "http://core.test.com". When I serialize this to XML I get the following:
<ArrayOfSecurityHolding xmlns:i="htt...
When a friend function is included in the namespace, its definition needs to be prefixed with namespace to compile it, here is the sample code:
test.h:
#ifndef TEST_H
#define TEST_H
namespace TestNamespace
{
class TestClass
{
public:
void setValue(int &aI);
int value();
private:
int i;
fr...
I didn't know you could do this:
def tom():
print "tom's locals: ", locals()
def dick(z):
print "z.__name__ = ", z.__name__
z.guest = "Harry"
print "z.guest = ", z.guest
print "dick's locals: ", locals()
tom() #>>> tom's locals: {}
#print tom.guest #AttributeError: 'function' object has no attribut...
I've been fighting with this for some time now, and haven't been able to find a clear answer to this yet.
As I understand correctly I can store data in an XML file, validate it using an XSD and then display the data neatly using an XSLT.
However I've been having issues trying to perform XPath queries to select the data I wish to displa...