News:

When one conveys certain things, particularly of such gravity, should one not then appropriately cite sources, authorities...

Main Menu

The Programming Thread

Started by Renegnicat, October 27, 2009, 05:10:25 PM

Previous topic - Next topic

LoneMateria

Quote from: "AlP"
Quote from: "LoneMateria"Has anyone used Ruby?  I've heard mixed reviews about Ruby on Rails.
Yeah I've used it a fair bit. It's a good dynamically typed language. I slightly prefer the syntax and semantics to Python. Python is also good and it seems to have a lot more in the way of libraries available, so I generally use that instead these days. Ruby on Rails is an exception in that regard. I haven't used it but a colleague of mine did for his web site and his opinion of it was favorable. But then he'd previously been using PHP for his site, which is awful.

Yeah i've had my run in with PHP.  The first forum site I was a part of my friend owned and he made me an Admin.  He was using VBulletin and he purchased a RCS (RPG Creation System) that was written by some other company.  He essentially put it on the site and was Beta testing it for them.  There were many glitches and errors in it and with my very limited knowledge of C++ at the time I was searching through the code looking for the errors, which surprisingly I excelled at finding.  No logic errors but syntax errors.  But it was a pain in the ass and it's the main reason why I never learned PHP.

Anyway side note about Rails have you used it?  I remember there are other languages using the Rails framework however I can't think of them right now.  The only framework I have experience with is the .Net framework but I really enjoy it.  It makes crossing languages easy.  I liked C# on the .Net but when I wrote a program in C++ using .Net it was easier to use since the framework is the same.
Quote from: "Richard Lederer"There once was a time when all people believed in God and the church ruled. This time was called the Dark Ages
Quote from: "Demosthenes"A man is his own easiest dupe, for what he wishes to be true he generally believes to be true.
Quote from: "Oscar Wilde"Truth, in matters of religion, is simpl

AlP

I haven't used rails myself. If I was writing a web app I definitely wouldn't use .net. C# and .net are awesome on the desktop but MS has failed in the web app space. If you're thinking about writing a web app look at App Engine. Free hosting is good. I believe is supports Python and Java and it has its own framework, which has the typical Google emphasis on scalability.
"I rebel -- therefore we exist." - Camus

LoneMateria

I'm gonna keep that in mind.  I'd use ASP.Net if I was really interested in producing some webpage.  Just because anything you make you can use either C#.Net or VisualBasic.Net to code with.  However you have to find a company that hosts Windows servers >.<  I know linux is better at least in this instance.
Quote from: "Richard Lederer"There once was a time when all people believed in God and the church ruled. This time was called the Dark Ages
Quote from: "Demosthenes"A man is his own easiest dupe, for what he wishes to be true he generally believes to be true.
Quote from: "Oscar Wilde"Truth, in matters of religion, is simpl

Renegnicat

ASP is the spawn of the devil. Bloated and resource intesive. Just browsing the damn webpages slows my computer to a crawl.
[size=135]The best thing to do is reflect, understand, apreciate, and consider.[/size]

LoneMateria

Quote from: "Renegnicat"ASP is the spawn of the devil. Bloated and resource intesive. Just browsing the damn webpages slows my computer to a crawl.

But it allows you to write C# or Visual Basic Code right on your webpages instead of having to make a stand alone application or a JApplet and then put that in there.  Everything is in one spot.
Quote from: "Richard Lederer"There once was a time when all people believed in God and the church ruled. This time was called the Dark Ages
Quote from: "Demosthenes"A man is his own easiest dupe, for what he wishes to be true he generally believes to be true.
Quote from: "Oscar Wilde"Truth, in matters of religion, is simpl

Renegnicat

Keep in mind that C# was created for an environment that presumed a lot more speed and resources than is typically given on the internet. In my opinion, the idea of allowing a programming language directly into the webpages is a very powerful one. But the language shouldn't be from the .net framework. It should be light-weight and flexible. For all the power of .net, it's very resource intensive! my modem just can't handle .aspx pages.

It's the right idea. But it needs to be implemented in a better way.
[size=135]The best thing to do is reflect, understand, apreciate, and consider.[/size]

AlP

GWT lets you write web pages in Java instead of JavaScript. It also gives you a framework and tools. Unlike (as far as I know) ASP.NET, it translates the Java into JavaScript that runs client side, so the performance is better for people with low bandwidth. You can use GWT with AppEngine now I think. Hint =).
"I rebel -- therefore we exist." - Camus

Renegnicat

Nice! I'll have to use that!  :yay:
[size=135]The best thing to do is reflect, understand, apreciate, and consider.[/size]

LoneMateria

Quick question for those who know Java.  So like I mentioned I like C# and C# is essentially the exact same thing as Java.  Well in C#'s .Net framework I can create a groupbox where it can put a border around a region then everything I want can be put into that region.  If I remember correctly when I stick an object in that region its X,Y coordinates start with 0,0 at the groupboxes XY.  I think I might be confusing in my description so here is an example.  Say I have a window and I create a Groupbox at 100,100.  Now I add an object say a button into that group box and I put it at position 10,10 in that groupbox.  It would really be at 110,110 however say I decide to move my groupbox.  I move it to 250,250 then the button will be at 260,260.

Anyway like i've mentioned before the game I'm working on is using Java.  And I decided that I can make the game real easy (relatively) if I use group boxes instead of using some math formula to draw out my objects everywhere.  However Java doesn't have that feature.  What I've looked up their equivalent is is the border feature.  The following site is where I see its code.

http://java.sun.com/docs/books/tutorial/uiswing/components/border.html

However from their example it doesn't look like I can add objects to it so I won't be able to use it in my game.  Am I just mistaken or is there something i'm missing here?  (This is the end of my question but i'm going to describe how I want my game to function so if you aren't interested just skip the next paragraph)

In my game I got the idea the other day to use group boxes.  (It came to me in a flash of brilliance)  Because my game is going to be split screen.  The top section will have the battle grounds and the bottom will have the game board (bejeweled or Puzzle Quest equivalent).  So when the group box came to mind I thought I could take it a bit further.  I'm going to have abilities to use in the fight on the left which I can groupbox out and my center line that divides the screens and has a timer and a turn counter (plus possibly one or two other things) could be in it and i might have nested groupboxes for Health and stuff like that.  Just because in C# you can do a different background for each and that would greatly simplify my graphics problem as well as a few other problems I think I might encounter.  When I make a program I like to make things as simple as humanly possible.  I don't want redundancies and I don't want to do a ton of math calculations if I don't have to.  I'd rather just create a groupbox with a certain tiling background picture instead of figuring out how many times to draw a given picture based on what the user set his display settings to.  Much simpler.


***EDIT*** Looking into it more I think I can get what I need using JPanels
Quote from: "Richard Lederer"There once was a time when all people believed in God and the church ruled. This time was called the Dark Ages
Quote from: "Demosthenes"A man is his own easiest dupe, for what he wishes to be true he generally believes to be true.
Quote from: "Oscar Wilde"Truth, in matters of religion, is simpl

LoneMateria

I'm still having difficulties with this.  I've created a JFrame which is my main window but there doesn't seem to be a way to stick an object in a certain spot.  In C# you can place any object in any position however in Java I seem to be limited to using the BorderLayout.CENTER (or north, east etc.)  Very frustrating Google doesn't seem to be helping me.  I need to be able to pick a spot to place my objects >.<  Can anyone help me?
Quote from: "Richard Lederer"There once was a time when all people believed in God and the church ruled. This time was called the Dark Ages
Quote from: "Demosthenes"A man is his own easiest dupe, for what he wishes to be true he generally believes to be true.
Quote from: "Oscar Wilde"Truth, in matters of religion, is simpl

AlP

Quote from: "LoneMateria"I'm still having difficulties with this.  I've created a JFrame which is my main window but there doesn't seem to be a way to stick an object in a certain spot.  In C# you can place any object in any position however in Java I seem to be limited to using the BorderLayout.CENTER (or north, east etc.)  Very frustrating Google doesn't seem to be helping me.  I need to be able to pick a spot to place my objects >.<  Can anyone help me?
Sorry I haven't done any serious GUI programming in a long time. That is certainly an area where C# shines over Java on the Windows desktop. On the rare occasions I do GUI programming I use C#. Lol. Maybe there's a Java programmer on the forum who can help...
"I rebel -- therefore we exist." - Camus

Tom62

Hi LoneMateria,

On a JFrame your can position your components at an exact location, if you set its LayoutManager to null and use the setBounds method of each component to set the position and size of the component.

FYI:  setBounds(int x, int y,  int width,  int height)
Moves and resizes this component. The new location of the top-left corner is specified by x and y, and the new size is specified by width and height.

Simple example:

import javax.swing.JButton;
import javax.swing.JFrame;

public class Absolute {
  public static void main(String[] args) {
    JFrame f = new JFrame();
    f.setLayout(null);

    JButton ok = new JButton("OK");
    ok.setBounds(50, 150, 80, 25);

    JButton close = new JButton("Close");
    close.setBounds(150, 150, 80, 25);

    f.add(ok);
    f.add(close);

    f.setSize(300, 250);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setVisible(true);
  }
}
The universe never did make sense; I suspect it was built on government contract.
Robert A. Heinlein

LoneMateria

Awesome thanx Tom.  I took Java in college where we did a ton of GUI work and I saved my projects.  But none of them actually had us set a certain object at a certain position.  C# we did it all the time (and I took them both the same semester).  Anyway i'm gonna grab some coffee and try it out.  Thanks again ^_^

***EDIT*** works like a charm thanks again Tom ^_^
Quote from: "Richard Lederer"There once was a time when all people believed in God and the church ruled. This time was called the Dark Ages
Quote from: "Demosthenes"A man is his own easiest dupe, for what he wishes to be true he generally believes to be true.
Quote from: "Oscar Wilde"Truth, in matters of religion, is simpl

Tom62

Glad to be of any help. Those LayoutManagers in Java can be a real pain in the you know where. Anyway, for games I'd recommend to draw your objects directly on a canvas. In general, Swing-and AWT components might be too "heavyweight" for your purpose, resulting in flickering screens. I must however admit that I've got more experience with Java GUI development than with games development.
The universe never did make sense; I suspect it was built on government contract.
Robert A. Heinlein

LoneMateria

I hope it doesn't flicker in the end.... I guess I'll deal with that when it comes.  I have some game development experience.  I took 2 courses in game programming in college ... one using XNA (which about made me blow my brains out because the book was garbage and didn't teach you anything ... seriously it would be like: This is how you rotate pyramid on the screen: Then it would give you 8 lines of code without explaining what is happening ... lets say I was close to hurting someone) and they used Dark Basic ... which is a terrible language.  The compiler was such garbage that if I couldn't figure out why the game isn't working i'd save, shutdown my compiler and then bring it back up and it would magically work... terrible.  But it taught me the basics which I should be able to duplicate into a Java program ... hopefully.  Worse case scenario I make it look pretty and add it to a portfolio.
Quote from: "Richard Lederer"There once was a time when all people believed in God and the church ruled. This time was called the Dark Ages
Quote from: "Demosthenes"A man is his own easiest dupe, for what he wishes to be true he generally believes to be true.
Quote from: "Oscar Wilde"Truth, in matters of religion, is simpl