[QUOTE=Jitterz;46668720]Wanted to say thanks. This actually got me pointed in the right direction. The plan now is to still use a Dataset and then just write it to an xml file.
I keep getting overwhelmed with the scope of data I am dealing with so if anyone has any experience with that I would love to hear any advice you might have.[/QUOTE]
What kind of data are you intending to serialize?
Honestly, in my experience, the only really difficult part of serializing can be [url=http://en.wikipedia.org/wiki/Unswizzling]unswizzling[/url], but as that article suggests, that can generally be done by resolving references to some sort of concrete identifier.
I don't know if C# has similar functionality, but in Java, I have done unswizzling by using Java's Hash() function that is inherited onto all Objects. By default, it generally just returns the memory address of the Object.
With that in mind, when I am serializing a class, I just provide its own Hash, and then any references to other classes I resolve to their own Hashes.
Loading from file is then done in two passes: the first pass scans the file and builds the data-structures, nulling out all references (this can prove tricky; you need to make sure your classes can allow for null references, so you may want to make your actual initialization be a separate function), using some way to store the reference hashes, and storing the objects in a hashmap, using the object's hash as its key.
The second pass is then done by going over every object in the hashmap, and redirecting those reference hashes into the hashmap to get the actual objects.
By the end of it, you have a completely linked reconstruction of what you serialized.
I generally implemented this (again, in Java) by using a special interface I built (named ISerialize, as opposed to the built-in ISerializable) that enforced that functions have a Serialize() and Deserialize() method. Then, you make sure each class defines Serialize and Deserialize. Finally, you make sure you call these functions on every object you need to serialize in a deterministic manner.
If there's anything specific giving you trouble, I'd be more than willing to see what I can do to help you out.
[QUOTE=Gmod4ever;46668846]What kind of data are you intending to serialize?
[/QUOTE]
Honestly I assumed keeping a database would be really simple. I just need a local file that keeps track of all of the information entered into the program. I am currently not sure exactly how I am going to do that.
I have a Player class. There will be multiple Players so I currently have a List<Player> to keep track of them all. Player is really just a bunch of information Name, Phone, Win things like that, just int and strings. The problem I am having is that there could be 100's of Players. I also need to be able to pull specific information from any given Player. I also need that information to change, update and be there after the program closes and opens.
I am probably way in over my head, as I said earlier, I thought it wasn't going to be too complicated. I found that DataSet has a WriteXml() method. That is currently what I am pursuing.
Hey guys sorry to cross post from stackoverflow but no one views my question and I'm really stuck on this and can't move on.
The question: [url]https://stackoverflow.com/questions/27348528/opengles-blending-bug-alpha-is-accumulating[/url](same as here)
I'm making a live wallpaper for android, I will explain how it works as I believe it's related to the problem, I'm sorry for the long question but I need to explain everything because the problem is hard to describe.
I'm using OpenGLES 2.0, I have a GLSurfaceView and a wallpaper service implementation, I pass it my renderer to call the drawing methods, like most OpenGL live wallpapers.
The way I've implemented my renderer is: in the wallpaper service I have an independent thread that will call the draw method every X seconds, the GLSurfaceView is set to RENDERMODE_WHEN_DIRTY, so this update thread is what decides when drawing occurs.
Furthermore in the service there is a pause and resume method, when the visibility changes. So even if I exit the wallpaper the service will run, conserving the state of everything until it's resumed.
Now for the problem, I've gotten transparency working as you can see here:
[thumb]http://i.stack.imgur.com/3qAfd.png[/thumb]
But when I lose focus and regain to the wallpaper, I press the back button on android's wallpaper selector, or change the wallpaper and then come back to it. The alpha value of things will go up.
Here is 2 meshes, the one on the left has an initial alpha value of 0.1, the one on the right 0.5.
[thumb]http://i.stack.imgur.com/FKDqx.png[/thumb]
Now as I leave and come back, the GLSurfaceView onVisibilityChanged method will be called, it works as expected but as you can see the alpha values will increase for some reason, and keep increasing as I leave and go back:
[thumb]http://i.stack.imgur.com/2YLLu.png[/thumb]
1 time
[thumb]http://i.stack.imgur.com/NT8g7.png[/thumb]
2 times
The way I have the mesh drawing set up is in my fragment shader I will set the value of an uniform before drawing the mesh, and that uniform will multiply by the texture color.
Here is the fragment shader:
[code]
precision mediump float;
uniform vec4 u_color;
uniform sampler2D u_texture;
varying vec2 v_textcoord;
void main()
{
gl_FragColor = u_color * texture2D(u_texture, v_textcoord);
}
[/code]
Of course before drawing the mesh I set the blending and blendfunc:
[code]
GLES20.glEnable(GLES20.GL_BLEND);
GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
GLES20.glUniform4f(DayAndNightRenderer.BaseShader.GetUniform("u_color"), color.r, color.g, color.b, 0.5f);
texture.Bind();
mesh.Draw(GLES20.GL_TRIANGLE_FAN, DayAndNightRenderer.BaseShader);
GLES20.glDisable(GLES20.GL_BLEND);
[/code]
And the mesh drawing, even though the color uniform is set before drawing:
[code]
GLES20.glUniformMatrix4fv(shader.GetUniform("u_transmat"), 1, false, Transform.GetProjectedTransformationMatrix().ToFloatBuffer());
GLES20.glEnableVertexAttribArray(shader.GetAttribute("a_pos"));
GLES20.glEnableVertexAttribArray(shader.GetAttribute("a_textcoord"));
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, VBO[0]);
GLES20.glVertexAttribPointer(shader.GetAttribute("a_pos"), 3, GLES20.GL_FLOAT, false, Vertex.SIZE, 0);
GLES20.glVertexAttribPointer(shader.GetAttribute("a_textcoord"), 3, GLES20.GL_FLOAT, false, Vertex.SIZE, Vertex.POS_SIZE);
GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, IBO[0]);
GLES20.glDrawElements(primitive, size, GLES20.GL_UNSIGNED_INT, 0);
GLES20.glDisableVertexAttribArray(shader.GetAttribute("a_textcoord"));
GLES20.glDisableVertexAttribArray(shader.GetAttribute("a_pos"));
[/code]
The things I've tried so far:
- Changing the blend funcs, doesn't seem to affect the bug that is adding to the alpha value
- Reloading the shader between focus losses
- Clearing the framebuffer, I set GLES20.glClearColor(0f, 0f, 0f, 0f); on start and call GLES20.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); every frame
None of the above worked, and it's not some variable I use to set the alpha that's getting accumulated, the alpha of things is set to a constant as you can see in the code where I set the color uniform.
I'm clueless to what's causing this, it really only happens by losing focus of the wallpaper and getting back to it, on the first run without going back, it draws everything perfectly.
Here is the onVisibilityChanged method by the way:
[code]
@Override
public void onVisibilityChanged(boolean visible)
{
super.onVisibilityChanged(visible);
if (hassetrenderer)
{
if (visible)
{
OpenGLES2WallpaperService.updatehandler.Start();
glsurfaceview.onResume();
Log.i("DN", "State: running");
}
else
{
OpenGLES2WallpaperService.updatehandler.Stop();
glsurfaceview.onPause();
Log.i("DN", "State: not running");
}
}
}
[/code]
Thanks for reading, I'd appreciate any help.
-nvm-
Ugh. I'm stuck... I can't decide between java and C++. Java is cross platform, so if i made something, my windows friends could run it easily, but c++ would require a lot more work to get it to work for them too. I've been told c++ i more powerful, and it looks like most people in waywo are using C languages
you've got it the wrong way actually
you need java installed on your PC to run a .jar (which is what java compiles to)
any windows pc can run an .exe (which is what c++ compiles to)
very similar languages, but c++ is definitely more powerful
They aren't THAT similar. They're quite the contrary actually (besides the basic syntax which differs too).
I'd recommend C# more than both Java and C++. It's easier than C++ and more powerful than Java.
[QUOTE=cartman300;46676781]They aren't THAT similar. They're quite the contrary actually (besides the basic syntax which differs too).
I'd recommend C# more than both Java and C++. It's easier than C++ and more powerful than Java.[/QUOTE]
I dunno if it's more powerful than Java but at least it's more tolerable
[editline]9th December 2014[/editline]
Why are you even arguing one of these languages is more powerful than the others anyway. I can only vouch for C++ being able to do the weirdest shit of all three
i define more powerful as having more low-level features, which C++ definitely has more of over java
[editline]9th December 2014[/editline]
let me be clearer: c++ has easier to access low level features than java
[QUOTE=esalaka;46676850]I dunno if it's more powerful than Java but at least it's more tolerable[/QUOTE]
I have yet to see a dll written in java that can be loaded in a C application.
[editline].[/editline]
Without compiling to native or embeding the language that is.
[QUOTE=cartman300;46676899]I have yet to see a dll written in java that can be loaded in a C application.
[editline].[/editline]
Without compiling to native or embeding the language that is.[/QUOTE]
That has nothing to do with anything
So anyways, I finally fixed my grid. IT WORKS NOW. YES.
The fixed code is:
[code] cols = (int)((gridBounds.x + gridCellSize - 1) / gridCellSize) + 32;
rows = (int)((gridBounds.y + gridCellSize - 1) / gridCellSize) + 24;[/code]
And offsetting all the other coordinates as such.
I got these values by just taking the coordinates at the top left and getting their offset to be positive.
[QUOTE=BOT Ferris;46676656]Ugh. I'm stuck... I can't decide between java and C++. Java is cross platform, so if i made something, my windows friends could run it easily, but c++ would require a lot more work to get it to work for them too. I've been told c++ i more powerful, and it looks like most people in waywo are using C languages[/QUOTE]
I would advice against C++ as a first language, systems programming and complex OO is not a great place to start.
If its a choice betwheen Java and C++, pick java, but maybe also consider Javascript, Python, C or C#.
Cross platform shouldn't be your first concern, and is only a minor nuance.
[editline]9th December 2014[/editline]
Tip: Don't start to learn programming for the sake of getting something done (making something), it will be a disappointing experience if you do. Do it for the sake of learning programming.
[QUOTE=Cold;46677421]I would advice against C++ as a first language, systems programming and complex OO is not a great place to start.
If its a choice betwheen Java and C++, pick java, but maybe also consider Javascript, Python, C or C#.
Cross platform shouldn't be your first concern, and is only a minor nuance.
[editline]9th December 2014[/editline]
Tip: Don't start to learn programming for the sake of getting something done (making something), it will be a disappointing experience if you do. Do it for the sake of learning programming.[/QUOTE]
its not my first language
Hi, I'm using vb.net at collage and wondered how can I use an arraylist in my main forum, from another form etc?
[QUOTE=Cold;46677421]I would advice against C++ as a first language, systems programming and complex OO is not a great place to start.
If its a choice betwheen Java and C++, pick java, but maybe also consider Javascript, Python, C or C#.
Cross platform shouldn't be your first concern, and is only a minor nuance.
[editline]9th December 2014[/editline]
Tip: Don't start to learn programming for the sake of getting something done (making something), it will be a disappointing experience if you do. Do it for the sake of learning programming.[/QUOTE]
You advise against C++ for complex OO, and instead suggest Java? C++ isn't even an OO language, strictly, if anything it's multi-paradigm. It's got procedural, generic, and functional elements, especially with C++11.
I do agree that it's probably better to start with Java for the sake of ease of use.
[QUOTE=Tommyx50;46679865]You advise against C++ for complex OO, and instead suggest Java? C++ isn't even an OO language, strictly, if anything it's multi-paradigm. It's got procedural, generic, and functional elements, especially with C++11.
I do agree that it's probably better to start with Java for the sake of ease of use.[/QUOTE]
It contains systems programming and complex OO amongst other things, i never said it was purely OO and systems programming.
Its a super complex language, having a good understanding of what you're doing requires to have an understanding of all the aspects of a multi-paradigm language, the aspects of a systems programming language, and all the quirks created by C compatibility.
Its a lot of stuff to learn at once, you might as well take it in smaller bites and start with a different programming language.
Java is not my choice of programming language, but if its a choice between C++ and Java, Java is the easier choice.
Since he's talking about cross platform compatibility he probably wants to get stuff done you're better off picking something you could actually get anything done in.(any time soon)
I would normally suggest C# over Java, since most people consider it the better language, and it looks like the market is more and more heading there, but i am not sure about the current state of Mono, and the ease of use on Mac.
[editline]10th December 2014[/editline]
[QUOTE=BOT Ferris;46678670]its not my first language[/QUOTE]
Assuming you have equal understanding in both.
If you don't need to be native, if you don't need potential for high performance don't pick C++ and go with Java instead.
You'll get more stuff done.
If you don't have equal experience in both, just pick the one you have most experience in.
However i wouldn't worry about cross-platform, if you pick your libraries correctly, its only a minor problem.
[QUOTE=NixNax123;46676875]i define more powerful as having more low-level features, which C++ definitely has more of over java
[editline]9th December 2014[/editline]
let me be clearer: c++ has easier to access low level features than java[/QUOTE]
Right but then have fun doing anything high level
Like reading in an image and getting plain rgb data
Granted that is library stuff but the java library and .NET >>>>>>>>>> anything C++ has to offer.
[QUOTE=thrawn2787;46680777]Right but then have fun doing anything high level
Like reading in an image and getting plain rgb data
Granted that is library stuff but the java library and .NET >>>>>>>>>> anything C++ has to offer.[/QUOTE]
You realise that C++ has libraries too, right? Not only the C++ libraries, but all of the C ones, too?
And you also realise that these libs won't be like the Java ones which leak memory everywhere and completely thrash your program, because Java fails to allow them to manually deallocate memory?
EDIT:
I mean, you can pretty easily program in high-level in C++ nowadays, when you think about it. Can't be bothered with manual memory management? Well, you can either get one of the many libs which implement a garbage collector and use one of those, or use smart pointers. Really miss all those useful data structures like resizeable arrays? No problem, std::vector has got your back, as well as the many, many other features in the standard library! Hell, let's assume that manually writing out your for loops is too much for you - even then, no worries! C++11 has range-based for loops!
It feels like a lot of people judge C++ by their first unsuccessful frustrations or something. C++ does make the most sense, but perhaps too much sense for the beginner. C# is a good way to start, and if you feel you want to try something new and refreshing, you can [URL="http://en.cppreference.com/w/"]bridge yourself over to C++[/URL].
For anyone in the future that wants to learn C++, ignore all the old C++98/03 stuff and whatever you do don't write C with classes style code. There's a reason the author and the committee define C++11 as a new language that is easier for beginners, and still better for experts.
As for compiler, if you use VS2013, get the CTP_Nov2013. Keep in mind though that Microsoft is pretty out of date in general of the C/C++ standards, but this has the most features.
Saying "java library and .NET >>>>>>>>>> anything C++ has to offer." is possibly the most ignorant thing you can say.
In terms of productivity and utility they offer more than C++ and anyone saying otherwise is just biased. (Or at least C#/.NET does, I feel java's library is lacking because it doesn't have as big a backing any more, but I may be wrong.)
But, that doesn't make C++ worse. Native applications are needed just as much, everything is built upon them and there are a lot of cases where the extra performance and control is just not optional.
A lot of people also forget that they work best in tandem, you can interface native code with managed code when managed code just doesn't cut it.
[editline]11th December 2014[/editline]
Also C# has a lot of low level features that give you almost as much control as native code. It wouldn't be able to interface with it otherwise.
Of course that doesn't replace the need for native code, just in minor applications.
How the hell do I get the free stuff from GitHub education. I signed up a while ago and want to download Unreal engine but the education site has no sign in I can see?
I have a WebService for communicating with MySQL database, things like: SignUp(String username, String password) which returns 0 or 1 based if Sign Up was successful or not.
Web Service is hosted on local GlassFish server. I have a java client, how can I call SignUp() function from java client to Web Service and get the return data?
this is ruby
[code]gWords= File.foreach('german.txt').first(18)
eWords= File.foreach('english.txt').first(18)
cppFile= IO.readlines('germanVersion.cpp')
for i in 0..cppFile.length-1
for j in 0..17
cppFile[i].gsub! gWords[j], eWords[j]
end
end
puts cppFile [/code]
For whatever reason, this isn't working. I just get back the orginal cppFile. I think it has something to do with the array of words i'm using with gsub. Any ideas?
I started SFML for Visual Studio 2013 w/ C++. I figured out all the linker errors and everything, and now just a simple window crashes on startup. I tried using the 64 bit libraries for it, but there's apparently no such thing as a 64 bit visual studio so I actually don't know why they make 64 bit VS libraries. I get all kinds of "unresolved symbol" errors when I try to use the 64 bit libraries. If I try to call any draw, clear, or display methods, I get more unresolved symbol errors.
This is why I left windows in the first place. what the fuck am I doing so colossally wrong?
This is like debugging computer problems with my mom "There where errors and it said something about some kind of "linker" but then i pressed X before reading the rest"
- Give us the full Error
- What is your linker input/settings.
Tip, binaries are not compatible between vs versions, and debug applications should link against debug libraries, release applications againt release libraries.
Also if something crashes there is this cool thing called a debugger to help you find out what causes it.
If it crashes before the debugger attaches, check the return code in the output window (its showed as signed decimal, convert it to hex you get an NTSTATUS code)
You should use Google to figure out how to create a 64 bit binary.
Greetings, i have a problem with GDB (On OS X)
Here is what happens when i run my program :
[IMG]http://puu.sh/dq4Gb/8f6ff5d71e.png[/IMG]
Segfault, so i tried to debug it with GDB, but GDB won't detect the segfault
[IMG]http://puu.sh/dq4J5/5b026d9196.png[/IMG]
[IMG]http://puu.sh/dq4JJ/85eb000f43.png[/IMG]
That's strange, anyone know a *working* debugger or a way to fix this problem ?
Thanks.
[QUOTE=ExtReMLapin;46689714]Greetings, i have a problem with GDB (On OS X)
Here is what happens when i run my program :
[IMG]http://puu.sh/dq4Gb/8f6ff5d71e.png[/IMG]
Segfault, so i tried to debug it with GDB, but GDB won't detect the segfault
[IMG]http://puu.sh/dq4J5/5b026d9196.png[/IMG]
[IMG]http://puu.sh/dq4JJ/85eb000f43.png[/IMG]
That's strange, anyone know a *working* debugger or a way to fix this problem ?
Thanks.[/QUOTE]
GDB [i]IS[/i] a working debugger. Did you compile the application with -g?
Yes i did.
I managed to make another segfault and this second segfault is detected, but the first one is not.
-nevermind- How do i delete my posts?
Sorry, you need to Log In to post a reply to this thread.