primitive

Java: JAXB and using char

Hello, I'm working on a project with JAXB but I run into a small problem with JAXB and the char datatype. char gender = 'M'; Translates after marshalling into: <gender>77</gender> So I think that char is mapped to integer, but I simply want to map it to a String. How can I do this? Is it even possible? ...

How to render primitives in wireframe in Open Gl ES

Hi, I can see how to render wireframe primitives in open gl. By using glPolygonMode, however this call seems to be missing from Open GL ES. Does anyone know how to render primitives in wireframe on Open GL ES? Thanks Rich ...

Parsing XML with PHP and SimpleXML where items are named <long>, <float> or <int>

I'm trying to parse data from Archive.org's search functionality. The data looks like this: <doc> <float name="avg_rating">5.0</float> <arr name="collection"><str>U-Melt</str><str>etree</str></arr> <arr name="format"><str>Checksums</str><str>Flac</str><str>Flac FingerPrint</str> <str>Metadata</str><str>Ogg Vorbis</str><st...

objective-c primitive arrays

I wanna have a mutable array with primitives in obj-c (selectors). What's the recommended way to do this? NSArray and those can only hold objects. ...

Fastest most efficient way to determine decimal value is integer in Java

Given a double variable named sizeValue and sizeValue contains something other than 0, what is the most efficient way to determine that sizeValue contains a value that is an integer? Currently i'm using sizeValue % 1 == 0 any other faster ways? ...

Quick question about primitives

Edited this question because of my bad examples.. Here is my updated question: Would the following be equal in speed and memory allocation: int b; for (int i = 0; i < 1000; i++) b = i; and for (int i = 0; i < 1000; i++) int b = i; ...

Are primitives different in java and c#?

I am manually converting code from Java to C# and struggling with (what I call) primitive types (see, e.g. http://stackoverflow.com/questions/1597154/do-autoboxing-and-unboxing-behave-differently-in-java-and-c). From the answers I understand that double (C#) and Double (C#) are equivalent. double (C#) can also be used in containers, e.g...

Definitions of "primitive", "value type", "struct", "class", "wrap" in Java and C#

I have been trying to understand the use of "primitives" in Java and C# and the difference between them (if any). I have asked a series of questions on SO and some of the answers seem to confuse the issue rather than clarify it. Some answers (and some MS documentation) appear to provide contradictory statements. From SO http://stackove...

.NET primitives and type hierarchies, why was it designed like this ?

I would like to understand why on .NET there are nine integer types: Char, Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, and UInt64; plus other numeric types: Single, Double, Decimal; and all these types have no relation at all. When I first started coding in C# I thought "cool, there's a uint type, I'm going to use that when negati...

Creating (boxed) primitive instance when the class is known

I need a method that returns an instance of the supplied class type. Let's assume that the supplied types are limited to such that an "empty" instance of them can be created. For instance, supplying String.class would return an empty String, supplying an Integer.class would return an Integer whose initial value is zero, and so on. But ho...

Are there any good 3rd party libraries build on top of openCL yet?

I'm thinking in particular of processing primitives, things like FFT, convolution, correlation, matrix mathematics, any kind of machine vision primitives. I haven't been able to find anything along these lines, does anyone know of any good projects that have sprung up? ...

Draw a polygon in C

Hi, i need to draw a polygon of "n" sides given 2 points (the center and 1 of his vertex) just that i suck in math. I have been reading a lot and all this is what i have been able to figure it (i dont know if it is correct): Ok, i take the distance between the 2 points (radius) with the theorem of Pythagoras: sqrt(pow(abs(x - xc), 2) +...

Flood fill algorithm

Hi, im working in a simple graphical library in C with turbo C++ because im developing a very primitive version of a paint style program, everyting works well but i can´t get the flood fill algorithm to work. Im using the 4 way flood fill algorithm, first i tried with the recursive version but it only work with small areas, filling large...

Check type of primitive field

I'm trying to determine the type of a field on an object. I don't know the type of the object when it is passed to me but I need to find fields which are 'long's. It is easy enough for Longs but the primitive long seems more difficult. I can make sure that the objects passed to me only have Longs not the primitives but I'd rather not. S...

Using int as a type parameter for java.util.Dictionary

When I try to declare a Dictionary as such: private Dictionary<String, int> map; The compiler gives me the following error: Syntax error on token "int", Dimensions expected after this token But it works fine with Integer. I'm vaguely aware that java treats int / Integer differently (I come from a .NET background), but I was hopi...

How do I set the line width in OpenGL relative to the viewing area of a frame buffer?

glLineWidth rasterises the width so it shows as that width on the screen. I want it to be that width on a frame buffer. Thank you. ...

How to get polygon antialiasing to work.

I'm using these function calls: glEnable(GL_BLEND) glEnable(GL_POLYGON_SMOOTH) glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE) It doesn't work and wont render. glEnable(GL_BLEND) glEnable(GL_POLYGON_SMOOTH) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) It doesn't anti-alias. ...

Lines do not render on an offscreen frame buffer with a completely black texture

If I have a frame buffer which has a textured binded to it which is simply black with full alpha and I try to draw a line to it, even if the line has full alpha it wont render. I'm not stupid, so the lines definitely aren't black. If the texture is white instead the line suddenly render correctly as if the colour of the texture behind it...

In C# are the terms "Primitive" and "Literal" interchangeable?

A discussion earlier today led me to question whether or not my understanding of primtives and literals is correct. My understanding is that a literal type is specifically a type which can have a value assigned using a notation that both human and compiler can understand without specific type declarations: var firstName = "John"; // ...

Rotate a quad around a centre point in OpenGL

Hello, I'm making a 2D game. I want to be able to render a texture on the screen after rotating it a certain amount around a centre point. Basically this is for a level rotation around a player. The player position being the rotation point and the direction of the player as the angle. This code wont work: def draw_texture(texture,offset...