MattEvans 473 Veteran Poster Team Colleague Featured Poster

Java is easier to debug than C++, unless you already know C++ inside out, C++ is a tiny bit faster at matrix calculations, otherwise java and C++ are comparable, they both use DirectX and OpenGL interfaces, and the VirtualMachine layer is passed-through very quickly. I'd rather have portable code that takes 10 extra nanoseconds per minute than native code that doesnt. (my time relationship there is based on nothing but unfounded conjecture)

VB is actually not bad if you use DirectX-in-VB, I made some 2D a long time ago, and there's certainly no loss in potential from using what some people would claim is a "restricted" language. I've never tried DirectX3D in VB, but I think it's supported.

EDIT: to be honest, you'll be learning DirectX or OpenGL rather than a programming language for the graphical part, and they're both similar. The programming language you use is more the programming language you think is best for implementing the object relationships and general aspects of the game engine. Pick your poision based on the packaging.

Matt

MattEvans 473 Veteran Poster Team Colleague Featured Poster

whoever actually "made" java, certainly made it as a tribute to (their addiction to) the strong stuff, i don't think i could do a day's programming without replacing my bodily fluids with caffiene juice.

if i released a programming language, i'd probably call it nicotine.

Matt

MattEvans 473 Veteran Poster Team Colleague Featured Poster

you don't need to extend thread to make a timer, there's already two (javax.swing.Timer and java.utils.Timer) personally i prefer java.utils.Timer, but more often than not i use javax.swing.Timer to avoid conlict issues in swing applications.

if you absolutely must use a thread, you don't need to extend it... I had some code to use a Thread as a Timer; (incedently - you can't call some old Thread methods like you could in previous versions without experiencing crashes..) the method doesn't extend thread, just creates a thread and listens to its run() calls.

But, i've lost that code, and can only find some code that's very wasteful, it creates a new Thread instance every 10th of a second, and eats up the stack like some kind of.. stack monster.

Read this page:

http://www.velocityreviews.com/forums/t149589-a-good-example-of-timer-thread.html

it was actually quite difficult to find on google, i'd say 99 times out of ten people use the Timer objects rather than writing thier own.

Matt

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Ok, so I use Windows Live Mail Beta, don't know why, but they "invited" me ages ago, and it looks quite attractive, so I keep it. Sometimes, I get these yellow errors: "Windows Live Mail was unable to complete this request", today though, they're not going away. Also I get javascript/object errors on the page, my javascript works fine, my computer is well configured to access all content. So, I go to the live support, seems pretty cool in theory; but I'm greeted with more javascript errors, and the "support technician" gives me a link to "fix my computer so Windows Live Mail will work". Somehow that seems backwards.

Instructions consist of: clearing cache, I don't mind that; clearing cookies, I ABSOLUTELY DO MIND THAT, now I have to login everywhere again; registering a dll, dno whether it was or wasn't registered before, but I'm guessing it was; setting some trusted/privacy options; and allowing the applications over my firewall, but I have my firewall off for an hour anyway.

WINDOWS LIVE MAIL STILL DOESN'T WORK!

The root cause error that I believe to be causing the problem is a script error on the page: 'Web.UI.Editor.Strings' is not an object. You'd think a company like Microsoft would be well experienced in providing reliable, well tested code.

I think Microsoft most certainly need to buck their ideas up w/ re. to compatibility and support in the future, no-one will care about "new Windows" if a competitor offers something …

MattEvans 473 Veteran Poster Team Colleague Featured Poster

well, that seems to work, i'm still reusing objects 'cos my code structure's like that now, but now they're runtime objects. Interesting tho, Seems that Delphi's garbage collection is quite rough so I should probably do the polite thing and clean-up in the next version.

with re. to TXMLDocument, if it wraps MSXML, is it portable? (i.e. will a program that uses it work on Linux?)

Matt

MattEvans 473 Veteran Poster Team Colleague Featured Poster

i honestly have no idea what a Java sheet is; but if I had to hazard a guess, it's one of the original sheets of paper that a Mr. John Java-Jones used to plan, design, and eventually implement Java upon, back in the year-of-our-lord 1308.

very rare if you can get your hands on one, very rare indeed.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

well, you need to make the button extend JButton (or Component) to be able to add it to a form; try with JButton because otherwise you'll have to write your own graphic routines and action notifiers; try this code:

[LEFT]import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
/**
 * NButton - Nick's JButton.
 * 
 * @author (Nick Saika) 
 * @version (1.0 - 2006)
 */
public class NButton [B]extends JButton
[/B]{
    /**
     * Constructor for objects of class Btn
     */
    public NButton(String s) 
    {
      [B]  this.setText(s);[/B]
    }
    public NButton(String s, ActionListener al)
    {
        [B]this.[/B]setText(s);
        [B]this.[/B]addActionListener(al);
    }
    
}[/LEFT]

as you can see, your class is now acting alot more like a button (it's writing its own label and adding its own actionlistener as apposed to adding changing them on another object). Now, your JFrame will accept it as if it were a button/component aswell.

Matt

MattEvans 473 Veteran Poster Team Colleague Featured Poster

there's at least one mistake in the diagram; the line labeled "rho" is actually not rho; you need to calculate the length of that line to work out phi, so rename the line rho on the diagram to the line B.

rho now is equal to the "radius" and is constant for all values that fall on the sphere's surface.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

thats alot; that (xampp) is exactly what i was looking for.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Do you want to set the server up for local testing purposes or for hosting a site from home?

do you know how i'd set up a server for local testing purposes? i posted a thread "connect to self" sometime ago, that outlines what/why i want to do (it).

Matt

MattEvans 473 Veteran Poster Team Colleague Featured Poster

I've attached a new image showing how to get rho,phi and theta values on a sphere; bear in mind these equations have only been tested mentally, so look carefully at the proofings. You may find that some of the axes are expressed upside down, that's a common mistake I make.

You'll notice that there's no longer a Z (distance from viewplatform (eye) to the surface of the circle) in terms of the Y and Z (that is; origin-to-origin displacement Z). It's no longer calculatable by those terms as it was before because the theta value (well, third dimension) affects that distance.

Once you have these; converting them to UV is dependant on your system of mapping UV co-ordinates to rho, phi and theta values. I'm assuming that you derive the UV co-ordinates from rho, phi and theta values, and in that case it'll be easy. I can't tell you how; because UV isn't finite/has no referenceable standard that I know of.

On your sphere, the vector from the eye point to the matrix is the vector from the origin of the camera/viewplatform to a vertex on a shere as it would be if it were a point in global space (so after rotation, scale etc), bear in mind the vertexes location is not the UV co-ordinate.

The modelview matrix is a mixture of the transform matrix * of a model and the transform matrix of the viewplatform/camera/eye. If the object is never moved but the eye …

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Is it possible to make my computer both a server and a client in a LAN? Some of the projects I'm working on are internet based, and opening pages and scripts from disk doesn't have quite the same results as accessing it from a network; biggest difference is with Flash objects with javascript interfaces, they just don't work unless the page is online.

So, would it be possible (by any means), to open my computer, type some kind of path, and open up a page on my pc as if the folder it was in was a website; or even create pretend "domains" on my hard-disk? The protocols I'd like to simulate are HTTP and FTP.

Reason is, my internet connection isn't the most reliable; it takes a while to wait for a working window, and that may be the only time I can bugtest, also, I can end up in places without Internet and only my laptop, and have to sideline certain projects.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

A java compiler is an often overlooked prerequisite for developing java applications. o_O

Download Borland's free JBuilder2005 personal edition, you'll probably need the java software development kit aswell. (Available from Sun's website) although methinks JBuilder 2005 installs an SDK.

This kind of app is quite well suited to VB to be honest; but Java is actually easier to learn, and definately easier to work with/in than VB.

Matt

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Assuming you've read in the values from a files, and placed the button "values" onto the buttons as labels:

boolean gotOperator = false;
String operand1 = new String();
String operand2 = new String();
String operator = new String();
float result;
JLabel display = new JLabel();
public void actionPerformed(ActionEvent e) {
  String buttonLabel = ( (JButton) (e.getSource())).getText();
  if (!gotOperator) {
    try {
      //Assume user hasn't picked first operand. Using parseFloat() inside toString()
      //causes a NumberFormatException if the button caption isn't numeric.
      //this is like using an isNumeric() function; there is no such function
      //in java that I know of.
      operand1 = operand1 + Float.toString(Float.parseFloat(buttonLabel));
      display.setText(operand1);
    }
    catch (NumberFormatException ex) {
      //If button caption is the decimal point, it needs to be appended to the first
      //operand.
      if (buttonLabel.equals(".")) {
        operand1 = operand1 + ".";
        display.setText(operand1);        
      }else{
        //Otherwiste, assume user just picked an operator
        operator = buttonLabel;
        gotOperator = true;
      }
    }
  }
  else {
    try {
      //User has picked an operator.
      operand2 = operand2 + Float.toString(Float.parseFloat(buttonLabel));
      display.setText(operand2);
    }
    catch (NumberFormatException ex) {
      //if (buttonLabel.equals("=")) {
      //Assume user pressed equals, even if they didn't; still need to calculate
      //the result for 2 operands in order to do consequetive calculations.
      if (operator.equals("+")) {
        result = Float.parseFloat(operand1) + Float.parseFloat(operand2);
      }
      else if (operator.equals("-")) {
        result = Float.parseFloat(operand1) - Float.parseFloat(operand2);
      }
      else if (operator.equals("*")) {
        result = Float.parseFloat(operand1) * Float.parseFloat(operand2);
      }
      else if (operator.equals("/")) {
        result = Float.parseFloat(operand1) / Float.parseFloat(operand2);
      }
      //Set the first operand (of the next calculation) to the result of this …
MattEvans 473 Veteran Poster Team Colleague Featured Poster

you can bring the numbers from the text file easily enough, do you know how to do java file access?

getting operators from text in actual methods is more difficult, you'll either have to pre-write possible methods in your java app and chose one based on comparison, or make your app extensible/updatable and allow your user to write classes to handle their custom operations.

Matt

MattEvans 473 Veteran Poster Team Colleague Featured Poster

It's not annoying if someone has a problem; and the question doesn't seem like a homework request either.

If you're reading exressions from a file, you need a way to parse the contents of the file and recognise operands; java DOES have a simple evaluate function, so you can do Integer.decode(String : s) : int to automatically calculate very simple things (I think, +, - and *). Unfortunately there's no similar Float.decode() or Double.decode() functions.

For more complex things, you'll have to do a String recognitition on every character that COULD be an operand, while buffering values that are numbers; as you reach "lower levels" of the calculation, calculate the results, then keep moving upwards until you get the result of the whole calculation.

Can get very complicated if you want to offer an equivilant inline calculation spec as Java, if you always have 2 operators and an operand it's far easier, if I had the String "5 + 4" I could split it by "+" then add the contents of split[0] and split[2], if it didn't split, I could then try splitting by "*" and so on.

I don't know if Java supports regular expressions in the String.split() function, that would be much helpful; although I suppose you'd never know where your operators were before the split.

Java is quite different from VB; there are methodical similarilities but the structure is far from. How would you do it in VB? the same method will …

MattEvans 473 Veteran Poster Team Colleague Featured Poster

it actually only converts a Y to a Z (2D), the value of Z also has to be in terms of the X to be a sphere; to convert them to a spherical system, rho will equal Z, phi will equal Y, and theta will be in terms of Z and X, the sphere co-ordinates and/or mapping to UV depend on the rotation, translation and scale of the sphere at any moment in time.

EDIT: no, rho will equal (distance from sphere to viewing platform) - Z, and phi will equal the distance from the Y origin of the viewing platform to the Y co-ordinate (as clicked on the Canvas)

do you have the java3d demos? look for ..\jdkx.x\j3d\demo\index.html and check out, PickTest and IntersectTest. These methods work by flagging collisions as the graphics are rendering as opposed to calculation positions from current transform3d objects.

Intersect test is quite good, shows picking of points rather than objects.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Mm indeed, but it doesn't have to be abstract, I suppose it helps programmers write the extensions (can't compile unless you override abstracts) and even more so in an IDE.

I have an app, and the means I used for creating buffers was to pass a JPanel (or generated Image) right to the "bottom" of the system, either to generate images or work on existing images; not ideal I know. Incidently, what's the actual class of Image that's returned with a call to createImage()?

Matt

MattEvans 473 Veteran Poster Team Colleague Featured Poster

I am an Architect who is 10 years experienced in Software Development. Its very good that you are seeking help for class programs rather than getting them done as that's the right thing to do. I would be willing to be guide and tutor for $15 an hour. You can choose the time between 6pm and 10 pm EST and the days you want.

Thanks,
Bharat.
Phone 203 428 4124

By any definition, that's not the right thing to do. If they're school/college/uni class programs, (and not just program classes) maybe you should consider a different course.

Still; I earnt a lot doing other people's schoolwork for money, and on the upside, It taught me and my clients valuable business skills.

Matt

MattEvans 473 Veteran Poster Team Colleague Featured Poster

If you do want to ever create an Image, you can use: JPanel.createImage(width, height, null) (it's a member function of quite a few panels, frames, etc). If you want to load an image from a file or webserver use Toolkit.getDefaultToolkit().getImage((url|path)). Images/Graphics can be weird, I've never understood why Image is an abstract class.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

If you were only using a circle, not a sphere, it's simple trigonometry; sphere is abit more difficult though, do you have to take rotation (of the sphere) into account?

For a circle though; see attached image, and you must know:

- The distance (D) from the viewing platform to the center of the object
- The distance (Y) from the line Y=0 (relative the sphere AND viewing platform) to the point where the click is received from.
- The radius (R) of the object.

This won’t work directly with spheres, it assumes a cylindrical object lateral to the viewing platform, with a zoom factor of 1, and no transformations.

The point you’ll get is X,Y,Z where (X,Y) are the clicked co-ordinate, and Z is the result of:

t = asin(Y/R)
B = cos(t) x R
Z = D – B

If the X and Y values are within a distance (the object’s size as centred around the line X = 0, Y = 0) from the point X = 0, Y = 0; then the point is on the surface of the object, at the point X,Y,Z relative to the viewing platform.

To map that to a texture co-ordinate is different, it depends on your texturing system/method of creating the object; you can find the point relative to the object as opposed to relative to the viewing platform by subtracting the value of Z from the value of …

MattEvans 473 Veteran Poster Team Colleague Featured Poster

The most important thing you need is a concept; then play around with java (use borland jbuilder or another context-helpful IDE), read the very, very basics to find out about the syntax. once you've done that, you just need to map your concept into objects that can interact to bring your concept into reality.

Depending on the style of games you're after, you may need to download and learn abit about 3D graphics and 3D programming. Java has an optional extension, Java3D, which is pretty simple and powerful enough for most situations.

Often, the hardest thing to do is to make the objects interact effectively (effective meaning quickly and without error) without restricting the potential for expandability, it's best to try and build up some good libraries that you can use to make a game than jump straight in and attempt to write your own hypercomplex game.

The next most difficult thing is getting your, now perfectly perfect, pieces of abstract code onto a medium that can be viewed by the user, it helps if you write your libraries with a visual representation always in mind, it can ruin an otherwise perfect structure to have to write-in layered 2d painting or 3d object manipulation routines; java3d uses a good structure for its objects anyway, so use that structure; or write a structure that complements it.


So, in order:

- Learn java syntax while thinking up a concept, often the concept will take alot …

MattEvans 473 Veteran Poster Team Colleague Featured Poster

with char arrays, it could be:

ispalindrome := true;
 
for i := 0 to arr.length /2 do
ispalindrome := ispalindrome and (arr[i] == arr[arr.length - i]);

just take the same principle with memory addresses, but bear in mind that only works if the word has an even number of characters.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

The solution was to put an instance of the XMLDocument object on my form at design time.. Not perfect because I have to reuse it for an exponential number of XML documents, and now I have to think carefully about forking/threads.

I can't understand the problem in my code, if it wasn't working atall that would make more sense, but sortof working is much more confusing. I'm gonna check the properties of the standard dropped-on-form XMLDocument and a runtime constructed XMLDocument later, for now though I'm hoping I have the order of operations right to avoid instance corruption.

Has anyone else experienced similar outcomes when using XMLDocument components created at runtime?

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Either I'm doing something very wrong, or the XMLDocument component is a terribly written component. I keep getting Access violation at #ADDRESS Read Of #ADDRESS errors, no explanation just a peek at the CPU showing the error occurs all of the place depending on which test I'm doing. Basically, all I want to do is look at the document, and see if the correct node is one of a list of child nodes, the documents below are very scaled down from what I'm trying to use, but if it isn't working at this scale it isn't gonna work at any.

All attempts to either search for the node with name vtest or check the name of the node that contains the data within vtest result in access violations. All attempts to read nodes any deeper than the top level result in access violations, doing anything with DocumentElement causes access violations, although something with that did work about an hour ago, still, the command was about n1.n2....n8 dots deep, and would only return the same data/access violation pattern as with any other attempt.

The tests below are the results when trying to assign the leftside function to anything, specifically though, i'm adding it to a listbox directly/inline.

What's up with this? It seems like it's capable of doing what I want it to, infact, it seems like its being deliberately malicious :P xml isn't much use if it can't cope with custom tags.

Here's the code from …

MattEvans 473 Veteran Poster Team Colleague Featured Poster

I'm having another problem now.

Is there a way to get the data in a TMemoryStream object into a String; it seems to support multiple object types for the buffer parameter, but not String. When I use the code below, the output is not the string in the file, it's the right length, but the values are wrong... I've tried ANSI, unicode and UTF-8 encoding, i've tried with html and txt data files, i've tried PChar, Byte arrays and char arrays as buffers, and everytime I get a slightly different string of non-standard characters... If I use String as the buffer directly, it creates an empty string :|

At present I'm using:

procedure TForm1.Button1Click(Sender: TObject);
var
  fStream : TMemoryStream;
  fBuffer : PChar;
  sResult : String;
begin
ftpClient.Host := 'ftp.fusiongroupuk.com';
ftpClient.Username := [EMAIL="'currentversion@fusiongroupuk.com'"]'currentversion@fusiongroupuk.com'[/EMAIL];
ftpClient.Password := 'password';
try
  ftpClient.Connect(True);
  ftpClient.TransferType := ftBinary;
  fStream := TMemoryStream.Create();
  ftpClient.Get('ftpTest.txt', fStream);
  fStream.Read(fBuffer,fStream.Size);
  SetString(sResult,fBuffer, Length(fBuffer));
  lstStatus.AddItem(sResult, nil);
except
    on E : Exception do
      ShowMessage(E.ClassName+' error raised, with message : '+E.Message);
end;
MattEvans 473 Veteran Poster Team Colleague Featured Poster

OK, I found the IndyFTP control, and things are coming along OK, only problem atm is at my FTP server end not letting me have acceptable access anonymously :eek:

I'll post updates on my learning progress, I'm finding Delphi VERY similar to VB.

[edit]I'm amazed it was so simple, if anyone ever needs to do this, put an IndyFTPClient called ftpClient, a button and a listbox called lstStatus onto a Delphi form, and add this code to the Form unit:[/edit]

procedure TForm1.Button1Click(Sender: TObject);
begin
ftpClient.Host := 'ftp.fusiongroupuk.com';
ftpClient.Username := 'currentversion@fusiongroupuk.com';
ftpClient.Password := 'password';
try
  ftpClient.Connect(True);
  ftpClient.Get('ftpTest.html', 'c:\ftpTestResult.html');
except
    on E : Exception do
      ShowMessage(E.ClassName+' error raised, with message : '+E.Message);
end;
end;
procedure TForm1.ftpClientStatus(ASender: TObject;
  const AStatus: TIdStatus; const AStatusText: String);
begin
  lstStatus.AddItem(AStatusText, nil);
end;
end.
MattEvans 473 Veteran Poster Team Colleague Featured Poster

Hi there. I'm new to this forum, and new to Delphi, my programming experience goes from BASIC > Visual Basic, C++ (DirectX not MFC or GDI), and Java/Java3D. I did a little Pascal programming in college a few years ago, but what I remember isn't sufficient to help me much with Delphi.

I'm looking for some good learning resources, specifically some that can help me get my client-side distribution app working. The app is going to be used to search for, and if neccessary install updates to my Java program, which will be stored on a server with datestamped files for each class/resource file.

If things go well with this little utility, I'll integrate features to allow users to write command/JIT scripts for the program, and test their JIT scripts in a console environment.

Basically, this program will be the "face" of my Java application.

I've been playing around with Delphi and find it most comparable to Visual Basic, which I do have alot of experience in.

To get things started I want the program to load an HTML file, but not display it. I tried out the browser control, but I don't really want to open the page for display then get a hold of the information, I want to directly download the HTML page into a data object and then run through the raw HTML (infact it will probably be XML), to see if the relevant file has changed or been moved. This …