MattEvans 473 Veteran Poster Team Colleague Featured Poster

Just FYI, the __vfptr = CXX0030 thing is because the debugger thinks that d3ddev is pointing to an actual instance of a D3D device, if there's some error in the call to CreateDevice, and for whatever reason the device isn't created, then the pointer doesn't get assigned a value, and it'll have an 'undefined' value (since you don't initialize the pointer to anything). Basically, if you declare & initialize d3ddev like:

LPDIRECT3DDEVICE9 d3ddev = NULL;

Then, should the CreateDevice call fail to initialize that variable, the debugger will give a less confusing message, i.e. it will report d3ddev as still being NULL (and it shouldn't try to dereference it and complain about a bad virtual function table, which is what that __vfptr is all about)

MattEvans 473 Veteran Poster Team Colleague Featured Poster

The function call CreateDevice returns a HRESULT (error code), so do:

HRESULT result = CreateDevice (...);

the possible values are defined as D3D_OK, D3DERR_DEVICELOST, D3DERR_INVALIDCALL, D3DERR_NOTAVAILABLE, D3DERR_OUTOFVIDEOMEMORY ( see http://msdn.microsoft.com/en-us/library/bb174313(VS.85).aspx).

So do something like:

switch ( result ) {
  case D3DERR_DEVICELOST: std::cerr << "device lost"; break;
  ... etc ...
}

Just to find out what (if anything) DX thinks is going wrong.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Ah ok. There shouldn't be any problem with doing what you're doing from a DLL. I have only ever written DX applications that are staticly linked and DLLs that don't do anything DX, so I don't know for sure if there are any specific issues with DX calls in DLLs, but I would think that it's unlikely to be a problem.

What is the return value from CreateDevice?

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Oh, and the reason that a D3DPRESENT_PARAMETERS object 'just works' is that the D3DPRESENT_PARAMETERS is a value (structure) type not a pointer type.

Learn this distinction ASAP.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

You're just creating a pointer variable without actually setting it to anything, so what you're getting is 'worse' than a null pointer, it's a pointer to some random location. The message in the screenshot is caused by the debugger trying to treat whatever's at that random location as a direct3d device, which it almost certainly isn't.

You have to call a function (and I don't remember which one) to actually create and return a direct3d device, then store a pointer to it in a LPDIR...CE9 variable.

Are you following a tutorial or trying to assume/guess how to do things? I would suggest looking at some working source code that uses the API before trying to use it yourself.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

It's because you are using an orthographic projection, in an orthographic projection, a higher depth doesn't make objects appear smaller.

See : http://www.songho.ca/opengl/gl_projectionmatrix.html

So, if you want this effect, use gluPerspective, with a FOV (first parameter) of about 45.. (90 is waaay too wide a field-of-view, it will make the 'viewer' seem infinitly small). You may well need to scale your objects, to make them 'the right size' under this new projection

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Matrix transforms are perhaps harder to initially understand than applying offsets and rotations directly to points, but it's IMO the 'right choice' to use matrices, because it makes everything in the future easier. (e.g. to do anything more complicated, you either have to use matrices anyway, or do what matrices would do in longhand)

What level would you say that you're at? What are you having trouble with at this moment/ what was the last thing you had trouble with?

MattEvans 473 Veteran Poster Team Colleague Featured Poster

What kind of 2D library? Graphics, or physics? or something else?

I like this book alot, it says collision detection, but it also has a lengthly intro to many of the concepts of simulated 'space and time': http://www.amazon.com/exec/obidos/tg/detail/-/1558607323?tag=realtimecolli-20. Is 3D rather than 2D, but it's (a hell of) alot easier to convert 3D stuff to 2D than the other way around.

But, I don't have masses of books, (infact, I only really have that book, and this one, http://www.amazon.com/Calculus-Analytic-Geometry-George-Simmons/dp/0070576424, which is way to deep for what I tend to need), so perhaps there are more appropriate choices.

For basic 2D math.. A 'middle-level' education textbook should probably suffice.. In UK terms, an A-level or equivalent textbook should have enough material to understand most things you'd need to do w.r.t to 2D geometry, linear algebra, integration/differentiation, and that's a good basis for doing a whole lot of stuff.

Often, the hardest thing to work out is where & how to actually apply what you know, and what extra you'll need to know in order to do x. If you can classify exactly what x is, searching for how x is usually done, reading that material, following references / researching what you don't know, and recursing tends to work quite well, and you'll pick up useful transferable stuff along the way.

A quick question, what sort of mathematical architecture are you using? By that I mean, when you think about your code, do …

MattEvans 473 Veteran Poster Team Colleague Featured Poster

It's easy enough to arbitrarily set the rotation point, e.g. this will work:

case 'E':
case 'e':
{
	//Rotation of the red square.
	glMatrixMode(GL_MODELVIEW_MATRIX);
	glLoadMatrixd(redTransformationMatrix);
	glTranslated(200.0, 600.0, 0.0);
	glRotated(1.0,0.0, 0.0, 1.0);
	glTranslated(-200.0, -600.0, 0.0);
	glGetDoublev(GL_MODELVIEW_MATRIX, redTransformationMatrix);
	glutPostRedisplay();
	break;
}

The general rule is, translate to the origin, rotate, and then translate back again.

However, you are making your life abit more difficult by offsetting the square outside of the matrix.. that is, you are doing matrix transforms, and then offseting by 200, 600 in that space.. you'll find it easier to initialize your matrix to that 200, 600 offset, and then always draw the square at 0,0 in the space of your matrix transform.

That is, if you do this:

void init()
{
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	[b]glTranslated (200.0, 600.0, 100.0);[/b]
	glGetDoublev(GL_MODELVIEW_MATRIX, redTransformationMatrix);
}
...
void display()
{
...
	glPushMatrix();
	glLoadMatrixd(redTransformationMatrix);
	glColor3d(1.0, 0.0, 0.0);
	[b]DrawSquare(0.0, 0.0, 0.0);[/b]
	glPopMatrix();
...
}

Then, you can just do this:

case 'E':
case 'e':
{
	//Rotation of the red square.
	glMatrixMode(GL_MODELVIEW_MATRIX);
	glLoadMatrixd(redTransformationMatrix);
	glRotated(1.0,0.0, 0.0, 1.0);
	glGetDoublev(GL_MODELVIEW_MATRIX, redTransformationMatrix);
	glutPostRedisplay();
	break;
}

You will find, when you do get it rotating properly, that any subsequent translation will be in the local space of the previous transform. That is, what you consider to be moving in 'x' will actually be moving in the rotated x direction. If that's what you want, great, otherwise, you can keep transforming in global 'x' by reversing the translate multiplication order, like this:

case 'D':
case 'd':
{
	//Translation of the red …
Nick Evan commented: Your knowledge of 3d-development is somewhat frightening ;) +17
MattEvans 473 Veteran Poster Team Colleague Featured Poster

You setup an orthographic projection matrix, and then in the pushmatrix/popmatrix block, you load a matrix in model space, this 'undoes' your projection until the matrix is popped...

You could either replace this:

glPushMatrix();
glLoadMatrixd(redTransformationMatrix);
glColor3d(1.0, 0.0, 0.0);
DrawSquare(200.0, 600.0, 100.0);
glPopMatrix();

with this:

glPushMatrix();
[b]glMultMatrixd[/b](redTransformationMatrix);
glColor3d(1.0, 0.0, 0.0);
DrawSquare(200.0, 600.0, 100.0);
glPopMatrix();

Which will work in this case, or much better, use the projection matrix aswell.

The projection matrix is automatically multiplied onto the modelview matrix during vertex transform, and that's typically where glOrtho/glFrustum/etc are used. Eg:

//  VIEWPORT AND BUFFER CLEAR FIRST, BECAUSE THEY ARE MATRIX-MODE INDEPENDANT

glViewport(0, 0, windowX, windowY);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

// SETUP ORTHOGRAPHIC PROJECTION

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, windowX, 0.0, windowY, -1.0, 1.0);

// NOW RESET THE MODELVIEW

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

// ... ETC...
MattEvans 473 Veteran Poster Team Colleague Featured Poster
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">

minor bug with this, the doctype is html 4, so xml namespaces are illegal.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

You can't really modify the .a file, it contains already compiled code and symbols. You can however modify the source code and rebuild the library with whatever changes you need. Exactly how to do that will depend on what platform you're on and what changes you want to make, but downloading the source code http://www.talula.demon.co.uk/allegro/wip.html is probably the place to start.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

In your for loops, you are adding 2 to i and k. You probably want to add 1 to i and k, since your trying to get 2*i and 2*k-1, i.e the odds and evens... so it looks like you are skipping half of the points by adding 2 instead of 1. I can't see where (or if) you're performing the redundant multiplication in the code that you posted, but when I made that change, the result needed to be divided by 2 to be correct (it was correct before for ranges like, 0-1, 0-10 etc, so if that's not the problem, what ranges ARE you trying?).

Second question, pass a function pointer as an argument.. the signature of your function is long double () ( long double ), so change your simps function to be:

long double simps (double begin, double end,long double h,double n, [b]long double ( *f ) ( long double )[/b] )

and that's actually all you need to do.. you can pass any function in place of cos, now, providing that the signature is exactly the same.

Btw, the signature for forward delcaring simps will change to:

long double simps(double,double,long double,double,long double(*)(long double));

Actually, I may aswell just go ahead and post the modified version, all changes emboldened:

/*
 * Simprule.cpp
 *
 *  Created on: Mar 14, 2009
 *      Author: keith burghardt
 */
# include <iostream>
using namespace std;
#include <cmath>
#include<iomanip>
double begin,end,area,h;

long double [b]coswrapper[/b](long double x){
	return(//State …
MattEvans 473 Veteran Poster Team Colleague Featured Poster

looks like you have not called glEnable ( GL_DEPTH_TEST ); otherwise, post code

MattEvans 473 Veteran Poster Team Colleague Featured Poster

It seems that GLFW doesn't properly initialize the opengl state machine until you call glfwOpenWindow.

Move the call to glEnable ( GL_DEPTH_TEST ); to somewhere after the call to glfwOpenWindow. It should work then.

You don't need to call glEnable ( GL_DEPTH_BUFFER_BIT ), at best it's meaningless and at worst it's trying to enable something random.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Some things:

- Check the return value of LoadBitmap ( i.e. does the bitmap load atall? ).

- You are loading the file "art" ( without a file extension ). If you want to fopen "art.bmp" file, you have to say so. Also check that the bitmap file is in the application's working directory, or use an absolute path to the file instead.

- You should really call glGenTextures to get a new texture index. All texture indices might work without doing this on some OpenGL implementations, but you shouldn't rely on that being the case.

- You're 'not allowed' to call glDisable within a glBegin/glEnd block.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

From main, (after calling glutInit and before calling glutMainLoop), call your bitmap load function, put the return value into a global int variable ( e.g. texture1 ), repeat for however many textures you want, ( i.e. texture2, texture3, etc.. ).

When you want to 'switch a texture on' call glBindTexture ( GL_TEXTURE2D, textureX ). You must do this OUTSIDE of a glBegin/glEnd block.

For every vertex, also send a texture co-ordinate. This is done the same way as you send normals, but you will nearly always want to do this once-per-vertex, e.g.:

[b]glBindTexture ( GL_TEXTURE2D, texture1 );[/b]
glBegin ( GL_QUADS );
[b]glTexcoord2f ( 0, 0 );[/b]
glVertex3f(-1.0f,-1.0f,0.0f);
[b]glTexcoord2f ( 0, 1 );[/b]
glVertex3f(1.0f,-1.0f,0.0f);
[b]glTexcoord2f ( 1, 1 );[/b]
glVertex3f(1.0f,1.0f,0.0f);
[b]glTexcoord2f ( 1, 0 );[/b]
glVertex3f(-1.0f,1.0f,0.0f);
glEnd ( );

This will draw the entire texture on a single polygon. You don't need to call glEnd yet if you want to keep using the same texture for all of the faces.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Why don't you want to use tables?

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Please post all of the "undefined reference" errors.

Did you get a different error when you tried with -lgmp?

You are using GMP, yes?

If so, did you compile GMP yourself, or use a packaged version?

MattEvans 473 Veteran Poster Team Colleague Featured Poster

I assume you're including headers from the gnu multiple precision library?

If so you need to tell the linker the name of the library.. e.g.

gcc multiply1.c -lgmp

If that doesn't work.. make sure you have the library installed and in one of the "normal" library directories.. If it's not in one of the normal directories:

gcc multiply1.c -lgmp -L/directory/name/here
MattEvans 473 Veteran Poster Team Colleague Featured Poster

The nicest solution (in terms of future flexibility), is to encode your data in either a bitmap image or a text file.

Alternatively, if you just want to initialize an array of arrays:

// made smaller (4x4) so it fits in a post neatly...
string MAP[4][4] = {
{"|I|", "|I|", "|I|", "|I|" },
{"|I|", "|I|", "|I|", "|I|" },
{"|I|", "|I|", "|I|", "|I|" },
{"|I|", "|I|", "|I|", "|I|" }
};

But you're right, you can't initialize one 'row' at a time. It has to be done all at once.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

That "the behaviour when dereferencing an invalid pointer is undefined" is fact.

Other than that, the best you'll get (in terms of an explanation for why you get this output) is speculation or some implementation-specific reason. On my implementation (GCC) reasonable evidence (see second code I posted) suggests that local variables in any function get allocated from the same starting address (assuming the calls come from the same level).

(EDIT: and that would be sufficient explanation for your output, providing std::ostream::operator<< allocates at least one local variable)

There's no requirement for "reclaimed" memory to be zeroed or otherwise restored (by reclaimed, I mean memory under deleted pointers or under auto variables that go out of scope). The most efficient implementation strategy is to just leave the contents of such memory untouched, hence, before reclaimed memory is overwritten, it will tend to contain its old value. (You shouldn't rely on this, either)

Nick Evan commented: Excellent posts in this thread! +12
MattEvans 473 Veteran Poster Team Colleague Featured Poster

The behaviour when dereferencing an invalid pointer is undefined. So I can only speculate on the underlying reason: it probably has to do with how and where stack variables are allocated, e.g. sequential function calls within a given scope might allocate stack variables from the same starting place, so stuff that's stack-allocated in the first call to cout << is likely to overwrite anything that was stack allocated on the prior call to treble. When it's done all in one call to cout <<, the value is fetched back before calling any other function, and thus before it's likely for it to have been overwritten, and it appears to work ok.

You can occasionaly predict how the thing is going to behave, e.g., I was pretty sure that this would happen:

double num = 5.0;
double* ptr = 0;
ptr = treble(num);
treble( 2.0 );
cout << endl << "Three times num = " << 3.0*num << endl << "Result = " << *ptr;

Outputs:
Three times num = 15
Result = 6

On my machine, but I wouldn't bet on it being the same as yours, and I'd never rely on it working like that on mine.

A clearer example:

#include <iostream>

int fn_a ( void )
{
  int a = 0;
  std::cerr << &a << std::endl;
}

int fn_b ( void )
{
  int b = 0;
  std::cerr << &b << std::endl;
}

int main ( void )
{
  fn_a ( …
MattEvans 473 Veteran Poster Team Colleague Featured Poster

You don't imply any memory management in the description of the problem: there's no necessity that the nodes/lists even be allocated with new, e.g.:

Node a, b;
a.next = &b;

You wouldn't want any automatic delete to occur in this case, since you never call new ( a and b will be correctly de-allocated when they leave scope). If you can get away with allocating everything you need up-front and then deleting it when its no longer needed (or by not calling new atall as above), then do it that way.

If you must assume that one object 'owns' another, and your sure that all objects are allocated with new, then have have node's destructor delete the node pointed to as 'next' and its own vertex list node, and have each vertex list node delete its 'next' vertex node on destruction. Then call delete on only the first node. That is assuming that any given VNode is only reachable from a single Node, is that a correct assumption?

but it seems like a lot to make two separate list classes just to run on program.

This is why we generally use std::list / std::vector / etc.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

To me, Javascript/HTML/CSS animation always feels like an ugly hack: sure there are libraries available to assist with the lack of any built-in support for graphics*; but then there are libraries to render 3d scenes in graphing calculators [ just because you 'can' doesn't always mean you 'should' ]. Flash & Silverlight provide built-in support for graphics, the dedicated plugin runtime environments are better tailored & optimized for that kind of thing.

* ( support for static images doesn't count as "graphics support" )

Of course, there's usually better availability of JS than there is for Flash or Silverlight [ I don't install the plugins for either, personally ]. For simple animations, or animations that should be seamlessly integrated into a webpage, use an animated image format and/or JS. It depends how complicated you want animation to be really - simple fixed animation can usually be done as an image / videoclip anyway.. complex interactive animation is not really suited to JS ( in that it's not the best option available ).

As to why there aren't any available JS animation design studios.. No idea. Someone will probably consider it: crazier things have been developed.

For Q2: Javascript isn't displayed: it's just used to move things around/change properties of HTML+CSS objects. Of course, there may be discrepancies in timing under different environments.. or outright difference in the way a feature is implemented in JS; but it's ( very ) much more likely that the difference is …

MattEvans 473 Veteran Poster Team Colleague Featured Poster

What your asking is very probably against the terms of the licence of the software.

If you're wanting to 'test' on Vista as in try out the product on a new OS, consider contacting a spokesperson from Borland ( or, easier yet, looking for a trial version ). If you need the software permanently on two PCs, buy another licence, or buy a site licence.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

In my comment about the document being on a server; I'm pointing at the sillyness you also note in the W3C's wording: that of an implied concept of a browser 'removing' a document from some kind of tangible 'window'. Regardless of caching ( which isn't mandated by HTML either and is thus an 'implementation detail' ), the document is never actually 'moved' anywhere, just copied. When a browser actually unloads a document is even more difficult to define, though. It's not effecient to actually 'unload' all pages when going back and forth through them. ( EDIT: or, in terms of video memory, it's effecient to 'unload' the graphical manifestation of a page when ALT+Tabbing.. is this desired?.. This part of the standard hasn't really been updated since tabbed browsing/more interactive sites became popular, but, it's what you/we have to deal with )

I want webpages to stay mostly static, yes. Do what you want within reason at the server, but send HTML + CSS + simple JS to the client.. This model is 'traditional', and works for nearly everything that a person might use the World Wide Web ( i.e. a browser ) for. The 'application' model ( i.e. GUIs, realtime, events, etc ) is nearly always better served by actual applications; be those Internet-enabled or otherwise. There's too many reasons why for me to list here without writing a small essay, but I'm sure you know what I mean..

I wouldn't suggest going backwards; just moving forwards …

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Really not nonsense, There's nothing in standard HTML + JS that mandates the existance of a _window_ let alone an event when it closes. Each browser handles its idea of a 'window' in a different way. Maybe this is a shortcoming in HTML + JS, but, that's just the way it is.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Did you try using a full path to specify the file? i.e:

house->LoadFromX("C:\\Documents and Settings\\<user>\\Desktop\\Projects\\3DGameFramework\\3DGameFramework\\fachwerk33T.x");

Try this temporarily. The initial working directory of your application is not necessarily the folder where source files are located; you can normally set the application's working directory either from the IDE ( if appropriate ) or from a shortcut, etc.

The windows explorer addressbar thing; do View > Toolbars > Address Bar, and then right click the toolbar and uncheck "Lock the Toolbars".. you should then be able to move the address bar into the correct place ( from what you've said, it's showing but is too small/wrong place to see properly ).

MattEvans 473 Veteran Poster Team Colleague Featured Poster

I'm not suprised that you're finding it hard to get hold of Maya 4.0, it's pretty ancient. What kind of plugin is the one you need? Is it one of those Maya pseudo-dlls or a MEL script? If it's a MEL script then you can look right at the plugin source and probably fix it up for a later Maya version; if not, you may have a problem. Have you tried the plugin with a more current Maya version? Maya PLE is free for non-commercial use; theres no harm in downloading it just to check if the plugin works or not...

Overall, I'd suggest migrating to an new engine... Working with a now-unsupported engine is guaranteed to be a source of pitfalls..

MattEvans 473 Veteran Poster Team Colleague Featured Poster

The first meta tag in that page is in the wrong place... move it to be inside the head section. Try validating the code aswel, correct any errors and see if it still has a problem.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

It's not a kludge to have an outer style affect the list ( including the bullets/numbers ) and have an inner style affect the content of items themselves. Use 'relative' styles if possible , e.g use font-size: 80%; on the outside, font-size: 125%; on the inside. If you have no way to speak 'relatively' e.g. if you're setting font-face for the list and want to restore it within items; plan this from the beginning and make style selectors that summarize and apply properties to the 'outer' body text, and text inside list items. Then use deep, more specific selectors to affect certain lists and their outer areas differently, etc, etc. You may find that it becomes quite less of a problem than you imagine it may be.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Fixed it. Turns Out I was using the wrong function in my mouse function.

Cool; good to know it's working :)

Disregard my last post; although, the -g3 flag is quite useful to remember ( with full debug info you can see all the values passed into methods aswell as the method names ).

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Ok, the method NodeGL:plot is very small, the only thing that could be wrong in that method itself is the array not being instantiated ( or being too short ), however, there could be something wrong higher up ( the pointer 'this' can be 0 sometimes! ).

To get more useful info from the debugger, you need to add an option when compiling: recompile all of your files with the option -g3 to emit debugging information ( I hope that works on your G++ version, I'm using G++4 ).. after recompiling -- you need to recompile ALL of the files with this option, so not just the hex3.cpp file, but the file(s) for bezier, node, etc aswell -- after doing that, run the application with GDB again, and post the output of backtrace if you dont mind.. that will tell me ( and I can tell you ) whether or not it's an error within the code in the method NodeGL:plot, or an error higher in the call chain.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

>_< oops, sorry;

$ gdb ./hex3
[b](gdb) run[/b]
..wait for error..
(gdb) backtrace
MattEvans 473 Veteran Poster Team Colleague Featured Poster

There is probably something wrong in your not-shown classes ColorGL &| BezierGL, since the code runs fine with all reference to those classes commented.

Have you got a debugger? I'm guessing if your PC is saying 'Segmentation fault' that you're using some breed of Linux? If so, run your application from the command like like this... gdb ./a.out ...and when it segfaults, do... backtrace ...and you'll have a much better idea where your error is ( since gdb is an interactive debugger, and 'backtrace' gives you the callstack before the error ).

If you're not on Linux.. er.. dno, what are you on? I've never seen Windows say 'Segmentation fault'... Visual Studio has an integrated debugger, but you'll have to work out how to use it yourself.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Initially, the click handlers for all objects are assigned to the size change function. When you click an object for the first time, the size is changed, and the click handler for that object is re-assigned to the function that performs a size restore. When you click again, the size is restored, and the click handler is assigned to size change again. The statements like: this.onclick = sizeRestore; don't actually call the function; they infact use the name of the function as an identifier. You can tell the difference between a call to a function and a use of the name of a function because a call always has parenthesis even if the function has no arguments, i.e. sizeRestore( ); .

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Right.. not entirely sure what you're after; I can't work out which you want:

1: The first 'click' to perform 'sizeChange' and the next click to perform 'sizeRestore' ( and then to repeat for subsequent clicks ).
2: The click 'down' to perform 'sizeChange' and the release of the click to perform 'sizeRestore'.
3: Something else?

If you want number 1:

//Note: this is NOT the only way to do this.
var animElements = document.getElementById("both").getElementsByTagName("p");
  for(var i=0; i<animElements.length; i++) {
    animElements[i].onclick = sizeChange;
    }
  function sizeChange() {
    if (!this.currentWidth) this.currentWidth = 150;
    doWidthChangeMem(this,this.currentWidth,170,10,10,0.333);
    this.onclick = sizeRestore;
    }
  function sizeRestore() {
    doWidthChangeMem(this,this.currentWidth,150,10,10,0.5);
    this.onclick = sizeChange;
    }

If you want number 2, use the first example, but use mousedown and mouseup instead of mouseover and mouseout.

If something else, be more clear about exactly what you intend to do.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Only one rule from me.. Don't set out to "work with divs to create a pure CSS layout", unless you're entering some wannabe-elitist competition. Use whatever's appropriate and whatever works best: tables, frames, etc.

Nothing but a table does what a table does, and nothing but a frame does what a frame does. Those elements would have been W3C-deprecated in the last recommendation if they were redundant, and they are certainly not redundant. There is no suggestion by anyone worth listening to that the table or the frame tag are, or will soon be, deprecated*, and there is no reason to punish yourself by ignoring these valid, useful, elements. Just don't use tables for anything you can do easily in CSS ( note 'easily' ), and avoid frames like the plague unless you're making a certain kind of site: frames are great for offline API documentation minisites, and sites that are supposed to be read like books, but they are, of course, quite awful for most sites.

The font tag was deprecated, because it's redundant and difficult; don't use the font tag.

In a way, it makes me laugh that certain people took this WAI guideline so far: http://www.w3.org/TR/WAI-WEBCONTENT/#gl-table-markup, yet will blissfully ignore the rest of the WAIs recommendation, to the detriment of many. One can create a usability atrocity without using a single table, frame or font tag; and equally, one can create a blissful user experience with a frame and some layout tables. …

Venom Rush commented: Your response was brilliant ;) Thanks +1
MattEvans 473 Veteran Poster Team Colleague Featured Poster

Alternatively, try this trick, if you don't mind presetting the available colors ( in a way, it's better because those colours can be defined in the CSS ). This works by dynamically changing the class of the containing element, the CSS 'cascade' effect sorts out the rest:

<html>
  <head>
    <title>Color changing magic with a classname trick</title>
    <style type="text/css">
      div.red_links a
      {
        color:red;
      }
      div.blue_links a
      {
        color:blue;
      }
    </style>
    <script type="text/javascript">
      function set_linkcolor( to )
      {
        document.getElementById( "color_state" ).className = 
              to + "_links";
      }
    </script>
  </head>
  <body>
    <div id="color_state" class="red_links">
      <ul>
        <li><a>An anchor</a></li>
        <li><a>Another</a></li>
        <li><a>And another</a></li>
        <li>Some normal text</li>
        <li>Some more..</li>
        <li>And some more</li>
      </ul>
    </div>
    <span onmousedown="set_linkcolor( 'blue' )" 
         onmouseup="set_linkcolor( 'red' )" 
         style="border:solid 1px black;">
      Click me!
    </span>
  </body>
</html>
MattEvans 473 Veteran Poster Team Colleague Featured Poster

This seems to work fine for me (Opera):

<html>
  <head>
    <title>Hanging indents..</title>
    <style type="text/css">
      p.question, p.answer
      {
        margin-left:1.2em;
        text-indent:-1.2em;
        padding-bottom:0;
        padding-top:0;
        margin-top:0;
      }
      p.question
      {
        margin-bottom:0;
      }
      p.answer
      {
        margin-bottom:1em;
      }
    </style>
  </head>
  <body>
    <p class="question">Q: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p class="answer">A: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p class="question">Q: etc...</p>
    <p class="answer">A: etc....</p>
    <p class="question">Q: etc...</p>
    <p class="answer">A: etc....</p>
  </body>
</html>
MattEvans 473 Veteran Poster Team Colleague Featured Poster

browsers,wont,usually,break,a,string,unless,it,has,some,breaking,characters,in,it,such,as,spaces,so,either,this,text,will,extend,forever,or,it,will,get,cut,off,depending,on,the,browser,mostly.

this isnt a daniweb issue,it's more of an issue with a convention in the way text is processed/rendered at the client.

that said, it is relatively easy to fix, just run through the uploaded post data and insert extra breaking chracters as required.

~s.o.s~ commented: Clever! +20
MattEvans 473 Veteran Poster Team Colleague Featured Poster

Thread moved; to a board where you're more likely to get the best coverage..

Personally.. I wouldn't worry about uninstalling Windows if it's really playing up - Windows is only a program. Back up all of your data, of course; in a safe place, and virus scan or selectively bring back your data if you think it might be affected with something..

You have nothing to lose if you back everything up, except a cost in time of setting everything back up again.. That said, wait until / if someone responds who knows more about your specific problem..

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Yuk.. it's a real hack to serve diff pages to diff browsers, especially when using HTTP headers to determine the browser. How many browsers are you gonna target? What happens when the browser version changes? What happens if the browser identifies itself as a different browser? ( that's not farfetched )

Just go for a minimalist design that doesnt put too high a requirement on browser nuances, avoid floats and abs/rel positioning where possible, and you're laughing all the way to the server. Take a look at some 'popular' commercial or organization sites, most are very simple structurally; just neat, tidy and consistent looking. That's probably not what you want to hear, halfway through a project, but, certainly consider it in future.

Also, don't avoid using tables to prove a point - they tend to be identical across browsers - perhaps because they're so 'outdated' they've become well standardized.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

As long as its always the negative of what it should be; you're ok to put in a * -1, you could also try swapping the cos and sin exprs around, so that movex is the sin, and movey is the cos. I wouldn't worry about it, the problem arises when you're using a diferent idea of what up/down left/right and 0 rads is to the maths itself.. In 2D, I always find that 0 rads in a formula ends up pointing over to the right on screen rather than the oft-desired up, but thats easily solved by adjusting the input angle. It's a good idea to establish a convention early on, and encapsulate it away so you can change your easily mind later.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Using the Javascript XmlHttpRequest object ( all common modern browsers have it, although it sometimes has a different name ), you can issue a HTTP request to any page or program on your server, and then process XML replies as a DOM structure, or plaintext replies, as plaintext ( the reply from a page is the page content ). So yes, you can; research XmlHttpRequest, and AJAX. If you use the XML method, you avoid having to do any kind of parsing - the DOM is a ready-formed structure that's quite easy to work with.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

O_o There is no such thing as this; not in Java anyway. It would require some kind of dynamic/run-time typing... You won't get that for free in a compiled language like Java, or C++.

One way to go about this would be to have 'helper objects' that contain the variables specific to an ability, and a interface/abstract method like doAbility( ) . Keep them in a dictionary/map/hash within each character; using a string key with the ability name. Instead of calling character.DoubleSlash( ) , you'd call character.getAbility( "DoubleSlash" ).doAbility( ) or similar. To link the two objects together ( i.e. so a 'DoubleSlash' helper can access the data in a Character; use a 'character' variable : either local to each helper ( perhaps provided as a constructor paramater ), or pass the character using the ability into the doAbility() function.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Er.. this was a hot-ish topic last week: http://www.daniweb.com/forums/thread88858.html

C# is a Microsoft lock-in, Java doesn't work (yet) on any major consoles. I would say, neither of these languages will replace C++ in games, perhaps another language will, and perhaps it'll be the next revision of the C++ standard http://en.wikipedia.org/wiki/C++0x.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Ah, that's a different number; When I submit this reply, I will have 731 posts, but my reputation score is different - it's based on people clicking that "add to mattevans' reputation" link, which is strictly independant from the number of posts I've made. Optimistically, there is a correlation between my number of posts and my reputation points, but that'd only be because more people see my posts, there being more of them, thus there being a higher probablity of my posts being read by someone who appreciates them, or of course, is annoyed enough by them to give 'anti reputation points'.

The titles like 'Master Poster' are based on number of posts; although certain users can change their title to anything they want - Dani for example sets her title to 'The Queen of Daniweb', other people can do that aswel. I can't, I guess you can't either.

To find them out what the un-changed title will be at any number of posts.. well, I don't know if there's a table showing this publically available; but : http://www.daniweb.com/forums/memberlist.php?&order=DESC&sort=posts&pp=50 go through the list of members ordered by post count if you want; it'll tell you many of the titles.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

so can i click on add to your rep to increase the green dot for U

You can; but as far as I know, all reputation given in coffee house boards isn't counted towards (any?) of the scores.

EDIT: Oh.. you can't click on the picture of the dot itself if that's what you meant.. you click on "Add to bobbyraw's Reputation".. Except, you can't give yourself reputation either.