types

How do I display a byte array as a char array in the Eclipse Java debugger?

I want to view a byte array in the Eclipse (Helios Release, build id: 20100617-1415) Java debugger as a char array? Is that possible? How? For example, I want to display this: ...as: '\0', '0', 'G', '\22', etc. ...

How to retrieve the generic type used in a generic IEnumerable in .net?

We have a DAL that we're using with NHibernate.Search, so classes that need to be indexed are decorated with an attribute Indexed(Index:="ClassName"), and each property that needs to be be indexed has an attribute Field(Index:=Index.Tokenized, Store:=Store.No) . When one wants the index to drill down special objects, there's the attribut...

Extracting instances from a list based on a given Type variable

I fear this is going to be a big setup for a simple question. As to complexity of the answer, I fear what I might be getting into... I am building an application that will be used to help transform data from a source database with one table structure to a target database with a different structure. The target database will contain data ...

Dynamic type in method parameter.

I am passing in a dynamic type into a method and having some issues running the code. Wondering if you are able to pass a dynamic object into as a parameter using the out keyword. Below is the code. dynamic btApp = AutomationFactory.CreateObject("Test.Application"); dynamic btMessages; dynamic btFormat = btApp.Formats.Open("c:\\Temp/...

How to emulate a dependent type in Scala

I'm trying to define a generic residue class ring in Scala. A residue class ring is defined by some base ring (e.g. the integers) and a modulus (e.g. two), which is a value from the base ring. Both rings and their elements are objects, hence the type of the modulus would normally be a dependent type, depending on the base ring. I underst...

What is the most general python type to which I can add attributes?

Hi, I have a class Foo with a method isValid. Then I have a method bar() that receives a Foo object and whose behavior depends on whether it is valid or not. For testing this, I wanted to pass some object to bar whose isValid method returns always False. For other reasons, I cannot create an object of Foo at the time of testing, so I ...

When you make an ArrayList without specifying the object type, does it create it automatically when you add the first object?

For example, instead of doing ArrayList<ClassName> variableName; you do ArrayList variableName; then later you add an object of type "ClassName" variableName.add(objectName); will that automatically set the type of your array as ArrayList<ClassName> ? ...

How do I display a byte array as an array of hex bytes or unsigned decimal numbers in the Eclipse Java debugger?

I want to view a byte array in the Eclipse (Helios Release, build id: 20100617-1415) Java debugger as an array of hex bytes (2 digits each) or unsigned decimal numbers? Is that possible? How? For example, I want to display this: ...as: 0, 48, 71, 22, 139, 166, ... ...or as: 0x00, 0x30, 0x47, 0x16, 0x8B, 0xA6, ... (This is a simil...

Polymorphic class-constrained instances

I want to make all types that are instances of Enum and Bounded also an instances of Random. The following code does this and should work (with the appropriate extensions enabled): import System.Random instance (Enum r, Bounded r) => Random r where randomR (hi, lo) = inFst toEnum . randomR (fromEnum hi, fromEnum lo) where inFs...

Are C++ static simple types initialized in order?

My experience tells me that given an object: class Object { private: static int array[]; public: Object(int id); }; int Object::array[] = { 2937, 892 }; Object::Object(int id) { // do something } The initialization of array will happen before the invocation of any method on Object or the invocation of any method on an...

Cannot implicitly convert type 'System.Data.Linq.ISingleResult<CustomeProcedureName> to 'int'

Sorry for this simple question . I have a Stored Procedure that return an int value , I'm trying to call this sp from my asp.net linq to sql project . int currentRating = db.sproc_GetAverageByPageId(pageId); But i get this error : Cannot implicitly convert type `'System.Data.Linq.ISingleResult<PsychoDataLayer.sproc_GetAverageByPag...

Postscript font to EOT

Hi, I have a postscript font in my local language. Now to avoid errors in webpages i need them converted to EOT. How should i do this? ...

Prolog type definition in swi-prolog

Hi,in visual prolog there is "domains" section in a prolog program in which you can define types. Is there any similar thing in swi-prolog? In visual prolog a type is defined like: domains NewType = thing1; thing2 ...

f# generic type comparison

I'm trying to figure out if an obj returned from a call is of a certain type. Here is my code: type MyType<'T>= val mutable myArr : array val mutable id : int val mutable value : 'T and in some method that has MyType in scope... let a = someFunThatReturnsObj() // a could be of type MyType How do I figure out if a ...

Parameter in Python

Let's say there is a parameter n. Can n be any numbers? For example, question like this: Given a non-negative number num, return True if num is within 2 of a multiple of 10. This is what I am thinking: def near_ten(num): n = int #So I assume n can be any integer if abs(num - n*10) <=2: return True Return False Howe...

Managing user-defined types across various modules

What is the best way to manage common user-defined types across VBA modules? I use the same user-defined types in different modules. For example, I often need to represent (x,y) points, so I end up having this Type in different modules: Type XYpointType x As Double y As Double End Type I pass arguments of type XYpointType to...

Why are C# number types immutable?

Why are ints and doubles immutable? What is the purpose of returning a new object each time you want to change the value? The reason I ask is because I'm making a class: BoundedInt, which has a value and an upper and lower bound. So I was wondering: should I make this type immutable too? (Or should it be a struct?) ...

Consequences of changing __type__

I'm attempting to create what a believe (in my ignorance) is known as a class factory. Essentially, I've got a parent class that I'd like to take an __init__ argument and become one of several child classes. I found an example of this recommended on StackOverflow here, and it looks like this: class Vehicle(object): def __init__(self, ...

Collection of arbitrary types in VB.NET?

So I'm wondering if there is an answer in pure .NET for representing a collection of arbitrary data types. I know there's the old, late-bound, VB6 Collections, but I was looking for something like Generics, but either without having to specify the type at compile time, OR finding a clever way to allow the code to determine the type on i...

why doesn't this compile when using std::max and c++/CLI?

Can anyone please explain why the following will compile int a = aAssignments[i]->Count; int b = fInstanceData->NumRequiredEmpsPerJob[i]; fInstanceData->NumSlotsPerJob[i] = max(a,b); but fInstanceData->NumSlotsPerJob[i] = max((int)(aAssignments[i]->Count), (int)(fInstanceData->NumRequiredEmpsPerJob[i])); //why on earth does this not ...