Computing desk | ||
---|---|---|
< September 14 | << Aug | September | Oct >> | September 16 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
I'd be grateful for insight into the relative merits of a two-tier versus a three-tier architecture, from the point of view of the scalability of an IT application. Why might one approach be superior to the other? Consider, for instance, an Oracle Application Express (two-tier) versus J2EE or .Net three-tier architectures, for an application which might today serve 1,000 concurrent users, but next year 2,000 or 10,000.
I can (at least intuitively) understand the benefits of logical separation of elements of the application, per Multitier architecture, both in terms of modularisation of code and in the ability to provide distinct platforms for each of the tiers. And so I can see that there is some benefit, from the scalability perspective, in being able to ramp up the hardware provided to a distinct layer, based on an understanding of the pinch points in the system. But as a general proposition, can one approach be thought to be better than the other in its ability to scale, measured, I guess, in terms of cost of hardware deployed?
And - whilst we're on the subject - would I be right or wrong in postulating that a three-tier architecture will tend to need more tin than a two-tier architecture, all other things being equal?
I assure you this is not a homework question: I'm struggling to get an insight into what are for me rather abstract concepts, and I have an obscure interest which needs to be satisfied. thanks. --62.49.21.172 (talk) 00:23, 15 September 2009 (UTC)
Hi,
I've been given a laptop with a fresh install of Ubuntu (8.04, Hardy Heron) I'm a total linux newbie, but have spent a few days getting a feel for Ubuntu (and liking it a lot, I might add), and wanted to try doing some game dev on it. Python + pygame seems like a good way to go, and the system came with Python 2.5.2 installed. I've been reading through the docs on the pygame site on how to install it, and mostly it seems to come down to doing a "sudo apt-get install python-pygame", but whenever I do that I just get 'package not found'
As I said, I'm very new to the whole Linux thing, so I might be looking in the wrong repositories or something (I don't really know how to change that yet, but I get that you can) I tried using Ubuntu's add/remove software manager, and searching the 'all apps' category, but nothing came up for pygame.
Any help would be appreciated!
--67.171.37.222 (talk) 03:09, 15 September 2009 (UTC)
I have been searching for days and google only turns up garbage. Does anyone know or know how to find escrow systems that would be good for selling virtual items over the internet such as item from games or source code for freelance coding? Normal escrow sites only deal with physical items or domain names and have $25 minimum escrow fees, and then source code escrow sites charge about $1000 minimum fees and are designed for only working with large companies and enslaving them with long-term contracts. Are you ready for IPv6? (talk) 05:18, 15 September 2009 (UTC)
hello. Im on this project currently. To convert between the 2 coordinate system (SVY21 and WGS84) i found quite a bit of information. But just cant figure out how does SVY21 work. Any kind soul can help me with that? your aid will be greatly appreciated. —Preceding unsigned comment added by Razorsaber (talk • contribs) 05:56, 15 September 2009 (UTC)
is there any difference between db2 and sql?if its there then please help me.... —Preceding unsigned comment added by Kc28kc (talk • contribs) 10:35, 15 September 2009 (UTC)
I would like learn about the ARM processors, how and when they began, including the architecture of the processor. A lengthy and detailed response will do. —Preceding unsigned comment added by 196.2.2.228 (talk) 15:34, 15 September 2009 (UTC)
I have the problem at home, and apparently it's here at the library too.
I figure this computer must have the new version because the URL is gray except "wikipedia.org" is black.
I use the back button a lot but it seems that history repeats itself. Instead of going back, the back button seems to go forward before going back. I'm pretty sure I'm not clicking on the forward button by mistake.Vchimpanzee · talk · contributions · 17:53, 15 September 2009 (UTC)
This JAVA program works fine, except that the repaint() method doesn't work. Why is this and how can I fix it?
package towerdefense;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class TowerDefense extends JFrame implements ActionListener {
public static void main(String[] args) {
new TowerDefense();
}
JFrame game;
JPanel panel;
Image dbImage;
Graphics dbg;
Timer timer = new Timer(1, this);
JFileChooser openDialog;
int boardWidth;
int boardHeight;
int tileSize;
int pathLength;
int[][] coordinates;
int[][] directions;
boolean[][] board;
int maxHealth = 20;
int health = maxHealth;
Enemy enemy;
public TowerDefense() {
openDialog = new JFileChooser();
openDialog.addChoosableFileFilter(new MapFilter());
try {
int returnVal = openDialog.showOpenDialog(null);
if (returnVal == JFileChooser.APPROVE_OPTION) {
String filename = openDialog.getSelectedFile().toString();
FileReader reader = new FileReader(filename);
String text = "";
boolean keepGoing = true;
while (keepGoing) {
int character = reader.read();
if (character == -1) {
keepGoing = false;
} else {
text += (char) character;
}
}
String[] array = text.split("x");
String[] coordinateArray = array[2].split(";");
pathLength = coordinateArray.length;
coordinates = new int[pathLength][2];
directions = new int[pathLength][2];
for (int i = 0; i < pathLength; i++) {
coordinates[i][0] = Integer.parseInt(coordinateArray[i].split(",")[0]);
coordinates[i][1] = Integer.parseInt(coordinateArray[i].split(",")[1]);
directions[i][0] = Integer.parseInt(coordinateArray[i].split(",")[2]);
directions[i][1] = Integer.parseInt(coordinateArray[i].split(",")[3]);
}
boardWidth = Integer.parseInt(array[0]);
boardHeight = Integer.parseInt(array[1]);
tileSize = Math.min(getToolkit().getScreenSize().height / boardHeight, (getToolkit().getScreenSize().width - 300) / boardWidth);
board = new boolean[boardWidth][boardHeight];
for (int i = 0; i < boardWidth; i++) {
for (int j = 0; j < boardHeight; j++) {
board[i][j] = false;
}
}
for (int i = 0; i < pathLength; i++) {
board[coordinates[i][0]][coordinates[i][1]] = true;
}
enemy = new Enemy(coordinates[0][0], coordinates[0][1], 100, 0, directions, -tileSize / 2, 0, tileSize / 2);
}
} catch (Exception e) {
showErrorMessage(e);
}
game = new JFrame("Tower Defense");
panel = new JPanel();
game.setPreferredSize(new Dimension(getToolkit().getScreenSize().width, getToolkit().getScreenSize().height));
game.add(panel);
game.setExtendedState(MAXIMIZED_BOTH);
game.setDefaultCloseOperation(EXIT_ON_CLOSE);
game.setVisible(true);
game.add(new JCanvas());
timer.start();
}
public void actionPerformed(ActionEvent e) {
if(enemy.move()) {
health--;
}
repaint();
}
public void showErrorMessage(Exception e) {
JOptionPane.showMessageDialog(null, "An error has occurred.\n\nDescription:\n" + e.toString(), "Error!", JOptionPane.ERROR_MESSAGE);
System.exit(0);
}
class JCanvas extends Canvas {
public void paint(Graphics g) {
for (int i = 0; i < boardWidth; i++) {
for (int j = 0; j < boardHeight; j++) {
if (board[i][j]) {
g.setColor(Color.orange);
} else {
g.setColor(Color.black);
}
g.fillRect(i * tileSize, j * tileSize, tileSize, tileSize);
}
}
g.setColor(Color.blue);
if (enemy.isAlive) {
g.fillOval(enemy.x * tileSize + enemy.xOffset + tileSize / 2, enemy.y * tileSize + enemy.yOffset + tileSize / 2, tileSize / 4, tileSize / 4);
}
g.setColor(Color.black);
g.setFont(new Font("Courier", Font.BOLD, 50));
g.drawString("HP", getToolkit().getScreenSize().width - 300, 50);
if (health > maxHealth / 2) {
g.setColor(Color.green);
} else if (health > maxHealth / 4) {
g.setColor(Color.yellow);
} else {
g.setColor(Color.red);
}
g.fillRect(getToolkit().getScreenSize().width - 240, 0, health * 240 / maxHealth, 50);
if (health > maxHealth / 2) {
g.setColor(Color.magenta);
} else if (health > maxHealth / 4) {
g.setColor(Color.blue);
} else {
g.setColor(Color.cyan);
}
g.setFont(new Font("Helvetica", Font.PLAIN, 25));
g.drawString(health + "/" + maxHealth, getToolkit().getScreenSize().width - 240, 50);
}
}
}
|
--204.184.214.2 (talk) 19:01, 15 September 2009 (UTC)
Nimur's example of "proper" JFrame and ContentPane usage.
|
---|
package test;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Container;
import java.awt.Graphics;
import javax.swing.JFrame;
public class TowerDefense extends JFrame {
public static void main(String[] args) {
new TowerDefense();
}
public TowerDefense() {
super("Window Title");
this.setSize(640,480);
Container c = this.getContentPane();
c.add(new JCanvas());
this.repaint();
this.setVisible(true);
}
class JCanvas extends Canvas {
public void paint(Graphics g) {
g.setColor(Color.BLACK);
g.drawRect(50,50,50,50);
}
}
}
|
.
Hopefully you will understand this simple code, and see the changes you need to make to your own class. Primarily, you want to use the Container object, obtained by the getContentPane() method of the JFrame (or JPanel) that you plan to hold the drawable Canvas area. Watch out; you're secondary issue is that you're mixing up a JFrame instance called "game" with a TowerDefense object ("this"), which is also a JFrame. Nimur (talk) 23:33, 15 September 2009 (UTC)
Here's my code after making the changes you suggested (with all the irrelevant parts removed). It still doesn't work. What else should I change? --204.184.214.2 (talk) 18:35, 17 September 2009 (UTC)
package towerdefense;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class TowerDefense extends JFrame implements ActionListener {
public static void main(String[] args) {
new TowerDefense();
}
Timer timer = new Timer(1, this);
JFileChooser openDialog;
int boardWidth;
int boardHeight;
int tileSize;
int pathLength;
int[][] coordinates;
int[][] directions;
boolean[][] board;
int maxHealth = 20;
int health = maxHealth;
Enemy enemy;
public TowerDefense() {
super("Tower Defense");
//Store the map as an array
this.setPreferredSize(new Dimension(getToolkit().getScreenSize().width, getToolkit().getScreenSize().height));
this.setExtendedState(MAXIMIZED_BOTH);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.getContentPane().add(new JCanvas());
this.setVisible(true);
timer.start();
}
public void actionPerformed(ActionEvent e) {
if (health > 0) {
if (enemy.move()) {
health--;
}
}
repaint();
}
public void showErrorMessage(Exception e) {
//Display an error message
}
class JCanvas extends Canvas {
public void paint(Graphics g) {
//Draw stuff
}
}
}
|
--204.184.214.2 (talk) 18:36, 17 September 2009 (UTC)
Hello,
I've recently come across a few letters in a family archive that are in Dutch, Polish and Italian. Are there any places I can post scans of these to have them translated?
Thanks in advance for any help,
--Grey1618 (talk) 22:58, 15 September 2009 (UTC)