What is the naming convention of thrift namespaces if I have a multiword name? - namespaces

In a thrift file, when I have a multiword namespace such as someAwesomeNamespace, what is the naming conventions to make this as a namespace in a .thrift file?
namespace rb someAwesomeNamespace
namespace rb SomeAwesomeNamespace
namespace rb some_awesome_namespace
namespace rb some-awesome-namespace

Short answer: There is none. Use whatever fits your needs (and what the syntax allows).

Related

Meaning of # in octave forge function reference

I'm using some packages from from Octave Forge. In the API documentation some of the functions are prefixed with #<AnOtherName>/..
As Example:
#lti/c2d
What is the meaning of this prefix with # and the additional name? What is the difference to "normal" functions?
lti is a class, #lti/c2d refers to the c2d method of the lti class.
In old-style class definitions, class methods for a class lti are M-files in a directory called #lti, so the c2d method would be defined in a file #lti/c2d.m.
New-style class definitions use a single classdef file to define all methods, but it is still possible to override functions for a specific class or type by creating M-files in a directory #<class>. For example, you can create an M-file #double/foo.m to create a function foo that exists only on inputs of type double.

XML Schema (XSD) to Java and C# class results in different serialization [duplicate]

I have a XSD file, from which I want to generate C# and Java classes as well.
I first set the namespace in the XSD according to my C# namespace where my classes resides. The generation (with the Microsoft tools) works fine and also the serialisation works great and I can validat them against the XSD - perfect.
Now I want to create java classes with JAXB.
The problem is that the classes which are going to be created have a different package structure then the one in C#. So when I set the XSD namespace to the package structure of java, it works fine. I can serialize and validate the XML.
Now my question(s):
Is there a way to solve this? (Have one XSD for both generation tools)
Do I lack a understanding of what the namespace actually is needed for?
Thank you
Edit: Since it seems to be that there is a missunderstanding, I added an example
XSD: targetNamespace = "http://foo.bar/mySubNs/model"
C# Modelnamespace: com.foo.mySubNs.model (which fits the XSD namespace)
all generated classes will have the same namespace provided though the MS codegen
Java Modelnamespace : com.foo.myOtherSubNs.model (which differs from the XSD namespace)
the generated classes will have the "C# namespace". As a result the classes will not compile.
If I would change the namespace during the code generation for java, I can compile the classes. So far so good. But I won't be able to validate the generated XML by that java classes against the XSD, since the namespace differs.
To marshall my objects in Java, I use JAXB like this:
ValidationEventCollector validationCollector = new ValidationEventCollector();
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = schemaFactory.newSchema(new File ("my/schema/location"));
// JAXB_CONTEXT is just an instance of "JAXBContext"
Marshaller marshaller = JAXB_CONTEXT.createMarshaller();
marshaller.setSchema(schema);
marshaller.setEventHandler(validationCollector);
marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
JAXBElement<MyClass> root = new JAXBElement<MyClass> ( new QName(MyClass.class.getPackage().getName(),"MyClass"),MyClass.class, node);
marshaller.marshal(root, new File("output/Path/obj.xml"));
To build my java classes from the schema I use a xjc-task in an ant build script:
<xjc destdir="${dir.src.gen}" removeOldOutput="no" extension="true">
<schema dir="${dir.schema}" includes="${file.schema}"/>
<binding dir="${dir.schema}" includes="*.xjb"/>
<produces dir="${dir.src.gen}" includes="**/*.java"/>
</xjc>
The XSD namespace doesn't have to match the package structure, at least not in Java. When generating the classes using JAXB just provide the package you want to put the classes into.
You must take your pick as to what model is the main one: XSD, C#, or Java code. Once you make that choice, you must let the other two vary as they may. The best choice would be to make your XSD the reference model, generate the code in both languages with their respective tools, and just accept the results.
You can also try to pick the XML namespace such that the code at both ends will be satisfactory, but don't try to force anything to the last letter. That's not how it's meant to work.

.NET Framework name space structure (Directives)

For example "Using System.Console". Here "System" is the namespace and "Console" is the class"
Okay that makes sence but what about directives such as "System.IO.Compression".
In the above example would "Compression" be the method?
In visual studio projects why does the IDE add using system; and then using system.console?
Would using system automatically call all the classes in the namespace anyway making the using system.console redundant?
System, System.Console, System.IO, System.IO.Compression are all namespaces.
namespace System
{
class Foo1{}
namespace Console
{
}
namespace IO
{
class Foo2{}
namespace Compression{}
}
}
Compression namespace is nested inside IO, and all nested inside System
If you Using System, you only can access class Foo1(), in the other words, Using... only access class and variable, not the namespace that nested inside
***EDIT: This article defines quite clearly about namespace: https://msdn.microsoft.com/en-us/library/dfb3cx8s(v=vs.140).aspx

How many namespace are there in salesforce

I know some name of salesforce provided namespace like System, Database, ApexClass, Messaging.
Can anybody give me the list of all Namespace in Salesforce?
There's a list of them in the Apex Developers Guide.
ApexPages Namespace
Approval Namespace
Auth Namespace
Canvas Namespace
ChatterAnswers Namespace
ConnectApi Namespace
Database Namespace
Dom Namespace
Flow Namespace
KbManagement Namespace
Messaging Namespace
Process Namespace
QuickAction Namespace
Reports Namespace
Schema Namespace
Site Namespace
Support Namespace
System Namespace

Nerd Dinner - how is the return type of the EF queries determined?

In Nerd Dinner's Entity Framework repository, the queries' return type corresponds to the model and not to the EF conceptual entity.
public IQueryable<Dinner> FindAllDinners()
{
return db.Dinners;
}
...
public ObjectSet<Dinner> Dinners // NerdDinner.Designer.cs, line 76
The type of Dinner is NerdDinner.Models.Dinner.
I noticed the namespace for NerdDinner.Designer.cs is the same as the namespace for the model (NerdDinner.Models). I am assuming it pulled this namespace because it's sitting in the Models folder.
Question:
Can someone confirm that the return type of the EF queries is driven by the namespace of the EF config and that the namespace of the EF config is decided by the physical location of the EF files?
What options are available to make this technique work if the namespaces/locations are different and Code First CTP is not an option? Is this specific namespace configurable?
They are the same type. You may not have noticed that the classes in the Models directory are partial classes, which are composed with the EF classes. Partial classes must be in the same namespace.