class

XSD.exe question about include files and code generation

If you have an XSD with an includes reference. Is it possible to generate 2 separate class files. 1 for the XSD, and 1 for the included XSD? My Scenario 4 XSDs, each of which share 15-20 element definitions in common. Rather than maintaining, I'd like to end up with the 4 XSDs all referencing a fifth file with the common definitions, an...

Trying to instantiate a class member in C++ with a variable name

Hello. I am writing a program for class that is asking us to create a class of "book". We are then supposed to create new instantiations of that class upon demand from the user. I am new to C++ so I am attempting to code this out but am running into a problem. The main problem is how do I instantiate a class with a variable if I do...

documenting class attributes

I'm writing a lightweight class whose attributes are intended to be publicly accessible, and only sometimes overridden in specific instantiations. There's no provision in the Python language for creating docstrings for class attributes, or any sort of attributes, for that matter. What is the accepted way, should there be one, to docume...

Include a Class in another model / class / lib

I need to use function "image_path" in my lib class. I tried this (and couple of other variations): class CustomHelpers::Base include ActionView::Helpers::AssetTagHelper def self.image_url(source) abs_path = image_path(source) unless abs_path =~ /^http/ abs_path = "#{request.protocol}#{request.host_with_port}#{abs_path...

Do I have to initialize simple class member variables?

Quick beginner's question: Do I have to initialize simple class member variables, or are they guaranteed to get assigned their default values in any case? Example: class Foo { int i; // is i==0 or do I need the following line for that? Foo() : i(0) {} }; Thanks! ...

Fluent NHibernate - good complete working Helper class for managing SessionFactory/Session?

I was going through nHibernate Helper Class question on SO... I would like to get a helper class for fluent nHibernate... can anyone provide/refer a proper OO type helper class for managing a singleton of the SessionFactory and then also for managing Sessions? ...

When it is necessary to use Classes in PHP

Hello, I am a wordpress plugin developer. I saw the source of many pluginsand many plugin use "classes" in them and some without classes. Many huge coded plugins like "wp-postratings" does not use Classes and some small plugins use Classes. edit: Since classes have private, public and protected access specifiers, i feel a taste of s...

Catch requests to non-existent classes (not autoload)

Is there a manner in which to catch requests to a class which does not exist. I'm looking for something exactly like __call() and __static(), but for classes as opposed to methods in a class. I am not talking about autoloading. I need to be able to interrupt the request and reroute it. Ideas? ...

if (self = [super init]) vs. if ((self = [super init]))

Was just doing a code review and started to wonder: I thought if (self = [super init]) checks whether assigning return value of [super init] to variable self was successful or not (value of operation). Thus (self = nil) would actually be TRUE. I thought if ((self = [super init])) checks what is the value of self after assignment (value...

Cannot find Symbol = new

Java is complaining! cannot find symbol symbol : constructor Bar() location: class Bar JPanel panel = new Bar(); ^ QUESTION: Why am I getting this error?...everything seems to be correct. this is the coding: public class JFrameWithPanel { public static void main(String[] args) { ...

How to mark array value types in PHP (Java)Doc?

It might be a bit difficult to explain, so I'll give some example code. Note that I'm using NetBeans IDE (latest). class Dummy { public function say(){ } } /** * Builds dummy class and returns it. * @return Dummy The dummy class. */ function say_something(){ return new Dummy(); } $s=say_something(); While developing in netbea...

How to see .class content in Eclipse?

Sometimes, in Eclipse , i press a combination of keys which take me to the editor page that shows contents of my .class file (bytecode). I never seem to be able to remember what that key combination is. Can someone please let me know? Or in other words, how can one see own bytecode? ...

What does it mean to pass a &variable to a function? E.g., string& insert ( size_t pos1, const string& str );

I understand passing a pointer, and returning a pointer: char * strcat ( char * destination, const char * source ); You're passing a variable that contains the address to a char; returning the same. But what does it mean to pass something using the reference operator? Or to return it? string& insert ( size_t pos1, const string& str ...

I can't put a string in a switch nor an array in a class

Okay, im making a pretty big file in my opinion, so i wanted to separate it into several files for cleaner code. so i have my main .cpp file and two header files holding my classes. well the header files dont hold strings, it aboslutely wont budge. i call the library in both my .cpp file and even tried it in my header file. another is...

Events in Classes

I find that I write a lot of code within my classes to keep properties in sync with each other. I've read about Events in Classes, but have not been able to wrap my head around how to make them work for what I'm looking for. I could use some advice here. For example, in this one I always want to keep myColor up to date with any change w...

How to override luabind class __finalize method?

How to override luabind class __finalize method? Trying to do this in such way: class A function A:__init() end function A:__finalize() end local original_finalize_function = A.__finalize A.__finalize = function(...) -- some custom logic if original_finalize_function then original_finalize_function(unpack(arg)) end end local...

Android - Run in background - Service vs. standard java class

In Android, if I want to do some background work, what is the difference between Creating a Service to do the work, and having the Activity start the Service VS. Creating a standard java class to do the work, and having the Activity create an object of the class and invoke methods, to do the work in separate thread. ...

Difficulty with MooTools Class.extend

Consider the following code: var Widget = new Class({ Implements: [Options], options: { "name" : "BaseWidget" }, initialize: function(options) { alert("Options are: " + JSON.stringify(options)); //alerts "Options are: undefined" this.setOptions(options); alert("My optio...

adhoc struct/class in C#?

Currently i am using reflection with sql. I find if i want to make a specialize query it is easiest to get the results by creating a new class inheriting from another and adding the 2 members/columns for my specialized query. Then due to reflections in the lib in my c# code i can write foreach(var v in list) { v.AnyMember and v.MyExtraMe...

template static classes across dynamic linked libraries

Hello, I have a templated class with a static value, like this: template <class TYPE> class A{ static TYPE value; }; in the code of a dll I assign the static value: code of DLL_1 A<float>::value = 2.0; I wish the value to be shared by all the dlls I'm using, i.e. I want that: code of DLL_2 printf("value on DLL_2 %f",A<flo...